Updated the blog layout!

This commit is contained in:
Yann Esposito (Yogsototh) 2012-04-24 18:14:14 +02:00
parent 59da5a80bd
commit 7186435b9d
2 changed files with 28 additions and 20 deletions

View file

@ -49,3 +49,16 @@ def repair_html( html, debug=false )
depth.downto(0).each { |x| res<<= %{</#{parents[x]}>} }
res
end
def showArticle( article, language )
if /<img [^>]*>/ =~ article.compiled_content
image=$&
else
image=%{<img src="/Scratch/img/presentation.png" alt="basic logo"/>}
end
presentation=%{<figure>#{image}
<figcaption>
#{article[:title]} <span class="nicer">»</span>
</figcaption></figure>}
%{<div class="popularblock">#{link_to(presentation, article)}</div>}
end

View file

@ -5,7 +5,7 @@ menupriority: 2
noSubMenu: true
-----
<%
number_of_articles=5
number_of_articles=18
number_of_char_for_resume=800
language=@item_rep.path.sub(/\/Scratch\//,'').sub(/\/.*$/,'')
last_articles = @items.select do |a|
@ -61,10 +61,10 @@ fr: Articles populaires
<div class="popularblock">
<a href="/Scratch/en/blog/Haskell-the-Hard-Way/">
<figure>
<img src="/Scratch/img/blog/Haskell-the-Hard-Way/magritte_pleasure_principle.jpg" alt="Magritte pleasure principle"/>
<figcaption>
Learn Haskell Fast and Hard <span class="nicer">»</span>
</figcaption>
<img src="/Scratch/img/blog/Haskell-the-Hard-Way/magritte_pleasure_principle.jpg" alt="Magritte pleasure principle"/>
<figcaption>
Learn Haskell Fast and Hard <span class="nicer">»</span>
</figcaption>
</figure>
</a>
</div>
@ -72,28 +72,23 @@ fr: Articles populaires
<div class="flush"></div>
<h2 id="last-articles">
en: Last <%= number_of_articles %> Articles
en: <%= number_of_articles %> lastest Articles
fr: Les <%= number_of_articles %> derniers articles
</h2>
</div>
<% last_articles.each do |a| %>
<div class="resumearticle">
<h1> <%= calendar_for( a[:created_at], language ) %>
<%= link_to(a[:title]+%{ <span class="nicer">»</span>}, a) %> </h1>
<div class="corps">
<%= repair_html ( excerptize( a.reps[0].compiled_content, {:length => number_of_char_for_resume} ) ) %>
<div class="corps">
<%
i=2
last_articles.each do |a|
i+=1 %>
<%= showArticle(a, language) %>
<% if i % 3 == 2 %>
<div class="flush"></div>
<div>
<p>
fr: <%= link_to(%{en lire plus <span class="nicer">»</span>}, a) %>
en: <%= link_to(%{Read more <span class="nicer">»</span>}, a) %>
</p>
</div>
</div>
</div>
<% end %>
<% end %>
</div>
<div class="corps">
<div>