mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-04 23:11:47 +01:00
fix failing tests and small refactorings
This commit is contained in:
parent
e8c3ba2e28
commit
4e29bf69f7
8 changed files with 53 additions and 376 deletions
|
|
@ -1,25 +1,26 @@
|
|||
module FeedlistHelper
|
||||
|
||||
def linkoptions(format, options)
|
||||
merge_hashes( {:format => format}, options, user_token_hash)
|
||||
end
|
||||
|
||||
def rss_formatted_link(options = {})
|
||||
image_tag = image_tag("feed-icon.png", :size => "16X16", :border => 0, :class => "rss-icon")
|
||||
linkoptions = merge_hashes( {:format => 'rss'}, user_token_hash, options)
|
||||
link_to(image_tag, linkoptions, :title => "RSS feed")
|
||||
link_to(image_tag, linkoptions('rss', options), :title => "RSS feed")
|
||||
end
|
||||
|
||||
def text_formatted_link(options = {})
|
||||
linkoptions = merge_hashes( {:format => 'txt'}, user_token_hash, options)
|
||||
link_to(content_tag(:span, 'TXT', {:class => 'feed', :title => "Plain text feed"}), linkoptions)
|
||||
link_to(content_tag(:span, 'TXT', {:class => 'feed', :title => "Plain text feed"}), linkoptions('txt', options))
|
||||
end
|
||||
|
||||
def ical_formatted_link(options = {})
|
||||
linkoptions = merge_hashes( {:format => 'ics'}, user_token_hash, options)
|
||||
link_to(content_tag(:span, 'iCal', {:class=>"feed", :title => "iCal feed"}), linkoptions)
|
||||
link_to(content_tag(:span, 'iCal', {:class=>"feed", :title => "iCal feed"}), linkoptions('ics', options))
|
||||
end
|
||||
|
||||
def feed_links(feeds, link_options, title)
|
||||
space = " "
|
||||
html = ""
|
||||
html << rss_formatted_link(link_options)+space if feeds.include?(:rss)
|
||||
html << rss_formatted_link(link_options) +space if feeds.include?(:rss)
|
||||
html << text_formatted_link(link_options)+space if feeds.include?(:txt)
|
||||
html << ical_formatted_link(link_options)+space if feeds.include?(:ical)
|
||||
html << title
|
||||
|
|
|
|||
|
|
@ -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, "« #{project_name}".html_safe)
|
||||
end
|
||||
html << link_to_project(@previous_project, "« #{@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} »".html_safe)
|
||||
end
|
||||
html.html_safe
|
||||
html << link_to_project(@next_project, "#{@next_project.shortened_name} »".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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue