Better naming "item_intro" (instead of article_intro)

This commit is contained in:
Stefan Schlott 2013-08-24 15:18:02 +02:00
parent 75d3a20cc3
commit 220866997f
7 changed files with 32 additions and 26 deletions

View file

@ -84,7 +84,7 @@ kind: empty
<% latest_articles(5).each do |item| %> <% latest_articles(5).each do |item| %>
<div class="row"> <div class="row">
<div class="span8"> <div class="span8">
<%= render 'article_intro', :article => item, :extended => true %> <%= render 'item_intro', :item => item, :extended => true %>
<p> <p>
<a itemprop="blogPost" href="<%= item.path() %>">Zum Artikel</a> <a itemprop="blogPost" href="<%= item.path() %>">Zum Artikel</a>
</div> </div>

View file

@ -2,7 +2,7 @@
<div class="row"> <div class="row">
<% latest_articles.select { |a| a[:created_at].year == @year }.each do |item| %> <% latest_articles.select { |a| a[:created_at].year == @year }.each do |item| %>
<div class="span8"> <div class="span8">
<%= render 'article_intro', :article => item, :extended => true %> <%= render 'item_intro', :item => item, :extended => true %>
<p> <p>
<a itemprop="blogPost" href="<%= item.path() %>">Zum Artikel</a> <a itemprop="blogPost" href="<%= item.path() %>">Zum Artikel</a>
</div> </div>

View file

@ -6,14 +6,12 @@
<% if item.attributes.has_key?(:subtitle) then %> <% if item.attributes.has_key?(:subtitle) then %>
<br/><small><%= item[:subtitle] %></small> <br/><small><%= item[:subtitle] %></small>
<% end %></h1> <% end %></h1>
<ul class="unstyled"> <p>
<li><i class="icon-calendar"></i> <time itemprop="dateCreated" datetime="<%= @item[:created_at].strftime("%Y-%m-%d") %>"><%= @item[:created_at].strftime("%d.%m.%Y") %></time></li> <i class="icon-calendar"></i> <time itemprop="dateCreated" datetime="<%= @item[:created_at].strftime("%Y-%m-%d") %>"><%= @item[:created_at].strftime("%d.%m.%Y") %></time>
<% if @item[:author] %><li><i class="icon-pencil"></i> @item[:author]</li><% end %> <% if @item[:author] %>- <i class="icon-pencil"></i> @item[:author]<% end %>
<% if @item[:refers_to] %><li><i class="icon-cogs"></i> <a href="<%= @items[sanitize_path(@item[:refers_to])].path() %>"><%= @items[sanitize_path(@item[:refers_to])][:title] %></a></li><% end %> <% if @item[:refers_to] %>- <i class="icon-cogs"></i> <a href="<%= @items[sanitize_path(@item[:refers_to])].path() %>"><%= @items[sanitize_path(@item[:refers_to])][:title] %></a><% end %>
<li><i class="icon-bookmark"></i> <a itemprop="url" href="<%= item.path() %>">Permalink</a></li> - <i class="icon-bookmark"></i> <a itemprop="url" href="<%= item.path() %>">Permalink</a>
</ul>
</header> </header>
<div class="clearfix"></div>
<p> <p>
<section> <section>
<%= yield %> <%= yield %>

View file

@ -1,15 +0,0 @@
<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 %>>
</header>
<div class="clearfix"></div>
<section>
<% if @extended then %>
<%= article_summary(@article) %>
<% end %>
</section>
</article>

23
layouts/item_intro.erb Normal file
View file

@ -0,0 +1,23 @@
<article>
<header><% if !@h then @h='h1' end %>
<<%= @h %>><a href="<%= @item.path() %>"><%= @item[:title]%></a>
<% if @item.attributes.has_key?(:subtitle) then %>
<br/><small><%= @item[:subtitle] %></small>
<% end %></<%= @h %>>
<%if @item[:kind]=='article' %>
<p>
<ul class="unstyled inline">
<li><i class="icon-calendar"></i> <time itemprop="dateCreated" datetime="<%= @item[:created_at].strftime("%Y-%m-%d") %>"><%= @item[:created_at].strftime("%d.%m.%Y") %></time></li>
<% if @item[:author] %><li><i class="icon-pencil"></i> @item[:author]</li><% end %>
<% if @item[:refers_to] %><li><i class="icon-cogs"></i> <a href="<%= @items[sanitize_path(@item[:refers_to])].path() %>"><%= @items[sanitize_path(@item[:refers_to])][:title] %></a></li><% end %>
<li><i class="icon-bookmark"></i> <a itemprop="url" href="<%= item.path() %>">Permalink</a></li>
<% end %>
</header>
<div class="clearfix"></div>
<section>
<% if @extended then %>
<%= article_summary(@item) %>
<% end %>
</section>
</article>

View file

@ -7,7 +7,7 @@
</div> </div>
<% latest_articles_referred_to(item.identifier,5).each do |item| %> <% latest_articles_referred_to(item.identifier,5).each do |item| %>
<div class="span8"> <div class="span8">
<%= render 'article_intro', :article => item, :extended => true %> <%= render 'item_intro', :item => item, :extended => true %>
<p> <p>
<a itemprop="blogPost" href="<%= item.path() %>">Zum Artikel</a> <a itemprop="blogPost" href="<%= item.path() %>">Zum Artikel</a>
</div> </div>

View file

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