3 articles before and after in the menu

This commit is contained in:
Yann Esposito (Yogsototh) 2010-04-16 11:18:57 +02:00
parent 32bd61fd68
commit d1790ce781
5 changed files with 92 additions and 27 deletions

View file

@ -452,6 +452,9 @@ table.impact tr td
:width 100%
:text-align center
#choixrss
width: 100%
clear: both
#choix
padding: 1em
text-align: left
@ -473,3 +476,18 @@ table.impact tr td
line-heigh: 2em
.date
font-size: .8em
#next_before_articles
clear: both
width: 100%
:font-size 1.2em
:padding
:top 1em
:bottom 1em
#previous_articles
float: left
width: 45%
text-align: left
#next_articles
float: right
width: 45%
text-align: right

View file

@ -452,7 +452,7 @@ newcorps
<p>
I've done some
<a href="/YBlog/Softwares.html" >Mac sofwares</a>.
<a href="http://yannesposito.com/YBlog/Softwares.html" >Mac sofwares</a>.
Such as screen saver using Quartz Composer, Dashboard widgets and
Objective-C.
@ -461,6 +461,6 @@ newcorps
<h4> Web </h4>
<p>
<%= lnkto("You can see details on how I did this website","/blog/nanoc"); %>.
<%= lnkto("You can see details on how I did this website","/about/technical_details"); %>.
</p>

View file

@ -453,7 +453,7 @@ newcorps
</h4>
<p>
Parmis les
<a href="/YBlog/Softwares.html" >programmes pour Mac</a> que j'ai
<a href="http://yannesposito.com/YBlog/Softwares.html" >programmes pour Mac</a> que j'ai
réalisé ; certains sont disponibles au public.
@ -461,7 +461,6 @@ newcorps
<h4> Web </h4>
<p>
<%= lnkto("Vous pouvez voir ici les détails sur la création de ce site web","/blog/nanoc"); %>.
<%= lnkto("Vous pouvez voir ici les détails sur la création de ce site web","/about/technical_details"); %>.
</p>

View file

@ -78,30 +78,60 @@ self.instance_variable_set(:@conf, conf)
<div id="content">
<div id="entete">
<div id="rss">
<span>
<a href="http://feeds.feedburner.com/yannespositocom<%= language %>">
<%= tradOf(:subscribe) %>
<img src="/Scratch/img/menu/rss-128.png" alt="rss" height="32"/>
</a>
<sup>
<a href="/Scratch/<%=language%>/rss"><%= tradOf(:whatsthis) %></a>
</sup>
</span>
</div>
<div id="choix">
<%= tradOf(:langue) %>
<div id="choixlang">
<ul>
<% languages.each do |l| %>
<% dest=@item_rep.path.sub(/^\/Scratch\/..\//, %{/Scratch/#{l}/}) %>
<% if @item_rep.path != dest %>
<li><a href="<%=dest%>" onclick="setLanguage('<%=l%>')"><%= l %></a></li>
<% end %>
<% end %>
</ul>
<div id="choixrss">
<div id="rss">
<span>
<a href="http://feeds.feedburner.com/yannespositocom<%= language %>">
<%= tradOf(:subscribe) %>
<img src="/Scratch/img/menu/rss-128.png" alt="rss" height="32"/>
</a>
<sup>
<a href="/Scratch/<%=language%>/rss"><%= tradOf(:whatsthis) %></a>
</sup>
</span>
</div>
<div id="choix">
<%= tradOf(:langue) %>
<div id="choixlang">
<ul>
<% languages.each do |l| %>
<% dest=@item_rep.path.sub(/^\/Scratch\/..\//, %{/Scratch/#{l}/}) %>
<% if @item_rep.path != dest %>
<li><a href="<%=dest%>" onclick="setLanguage('<%=l%>')"><%= l %></a></li>
<% end %>
<% end %>
</ul>
</div>
</div>
</div>
<% if article %>
<div id="next_before_articles">
<div id="previous_articles">
<%
(1..3).each do |n|
a=article_brother(-n)
if not a.nil?
%>
<div class="previous_article">
<%= link_to('&larr; ' + a[:title], a) %>
</div>
<% end %>
<% end %>
</div>
<div id="next_articles">
<%
(1..3).each do |n|
a=article_brother(n)
if not a.nil?
%>
<div class="next_article">
<%= link_to(a[:title] + '&rarr; ', a) %>
</div>
<% end %>
<% end %>
</div>
</div>
<% end %>
<div id="liens">
<%= generateMenu %>
</div>

View file

@ -136,3 +136,21 @@ def previousFor(page)
end
link_to(tradOf(:previous)+"&nbsp;&larr;", target)
end
def brother_for_at(page,n)
brothers=getSortedChildren(page.parent)
i=brothers.index(page)
if i.nil?
return nil
end
brothers[ brothers.index(page) + n ]
end
def article_brother(n)
if depthOf(@item) > 3
page=@item.parent
else
page=@item
end
brother_for_at(page,n)
end