Generic article teaser. Treat h1/h2 problem

This commit is contained in:
Stefan Schlott 2013-08-23 20:03:07 +02:00
parent 0e6b0d7e43
commit 27f48271e2
4 changed files with 24 additions and 25 deletions

15
layouts/article_intro.erb Normal file
View file

@ -0,0 +1,15 @@
<article>
<header><% if !@h then @h='h1' end %>
<<%= @h %>><a href="<%= @article.path() %>"><%= @article[:title]%></a>
<% if @article.attributes.has_key?(:subtitle) then %>
<br/><small><%= @article[:subtitle] %></small>
<% end %></<%= @h %>>
<div class="clearfix"></div>
</header>
<section>
<% if @extended then %>
<%= article_summary(@article) %>
<% end %>
</section>
</article>

View file

@ -1,21 +0,0 @@
-----
filter: erb
-----
<%
prjname = @project.identifier.split('/')[2]
%>
<article id="p_<%= prjname %>">
<header>
<h1><a href="/projects/<%= prjname %>"><%= @project[:title]%></a></h1>
<% if @project.attributes.has_key?(:subtitle) then %>
<h2><%= @project[:subtitle] %></h2>
<% end %>
<div class="clearfix"></div>
</header>
<section class="<%= @classes %>">
<% if @extended then %>
<%= article_summary(@project) %>
<% end %>
</section>
</article>

View file

@ -1,3 +1,5 @@
<% @projects.each do |prj| %>
<%= render 'project_intro', :project => prj, :classes => "hyphenate", :extended => @extended %>
<div class="span8">
<%= render 'article_intro', :article => prj, :h => 'h2', :extended => @extended %>
</div>
<% end %>