clean code

This commit is contained in:
did 2011-03-07 20:31:08 +01:00
parent d2f5757d5b
commit 11ccb31088
2 changed files with 6 additions and 5 deletions

View File

@ -6,6 +6,7 @@ BOARD:
- duostack version
- 2 different sites on the same main domain (one in www, the other one in something else) (Raphael Costa)
- seo section for the page form: seo title, seo keywords, seo description
- icon for redirection page in the pages section (back-office)
BACKLOG:

View File

@ -40,7 +40,7 @@ module Locomotive
css << 'first' if index == 0
css << 'last' if index == entries.size - 1
children_output << render_entry_link(p,css.join(' '), 1)
children_output << render_entry_link(p, css.join(' '), 1)
end
output = children_output.join("\n")
@ -70,7 +70,7 @@ module Locomotive
end
# Returns a list element, a link to the page and its children
def render_entry_link(page,css,depth)
def render_entry_link(page, css, depth)
selected = @current_page.fullpath =~ /^#{page.fullpath}/ ? ' on' : ''
icon = @options[:icon] ? '<span></span>' : ''
@ -78,14 +78,14 @@ module Locomotive
output = %{<li id="#{page.slug.dasherize}" class="link#{selected} #{css}">}
output << %{<a href="/#{page.fullpath}">#{label}</a>}
output << render_entry_children(page,depth.succ) if (depth.succ <= @options[:depth].to_i)
output << render_entry_children(page, depth.succ) if (depth.succ <= @options[:depth].to_i)
output << %{</li>}
output.strip
end
# Recursively creates a nested unordered list for the depth specified
def render_entry_children(page,depth)
def render_entry_children(page, depth)
output = %{}
children = page.children_with_minimal_attributes.reject { |c| !include_page?(c) }
@ -96,7 +96,7 @@ module Locomotive
css << 'first' if children.first == c
css << 'last' if children.last == c
output << render_entry_link(c,css.join(' '),depth)
output << render_entry_link(c, css.join(' '), depth)
end
output << %{</ul>}
end