fix failing tests and small refactorings

This commit is contained in:
Reinier Balt 2012-07-18 11:42:26 +02:00
parent e8c3ba2e28
commit 4e29bf69f7
8 changed files with 53 additions and 376 deletions

View file

@ -2,29 +2,17 @@ module ProjectsHelper
def project_next_prev
html = ""
if @previous_project
project_name = truncate(@previous_project.name, :length => 40, :omission => "...")
html << link_to_project(@previous_project, "&laquo; #{project_name}".html_safe)
end
html << link_to_project(@previous_project, "&laquo; #{@previous_project.shortened_name}".html_safe) if @previous_project
html << " | " if @previous_project && @next_project
if @next_project
project_name = truncate(@next_project.name, :length => 40, :omission => "...")
html << link_to_project(@next_project, "#{project_name} &raquo;".html_safe)
end
html.html_safe
html << link_to_project(@next_project, "#{@next_project.shortened_name} &raquo;".html_safe) if @next_project
return html.html_safe
end
def project_next_prev_mobile
prev_project,next_project= "", ""
if @previous_project
project_name = truncate(@previous_project.name, :length => 40, :omission => "...")
prev_project = content_tag(:li, link_to_project_mobile(@previous_project, "5", project_name), :class=>"prev")
end
if @next_project
project_name = truncate(@next_project.name, :length => 40, :omission => "...")
next_project = content_tag(:li, link_to_project_mobile(@next_project, "6", project_name), :class=>"next")
end
return content_tag(:ul, "#{prev_project}#{next_project}".html_safe, :class=>"next-prev-project").html_safe
prev_project = content_tag(:li, link_to_project_mobile(@previous_project, "5", @previous_project.shortened_name), :class=>"prev") if @previous_project
next_project = content_tag(:li, link_to_project_mobile(@next_project, "6", @next_project.shortened_name), :class=>"next") if @next_project
return content_tag(:ul, "#{prev_project}#{next_project}".html_safe, :class=>"next-prev-project")
end
def link_to_delete_project(project, descriptor = sanitize(project.name))