Module: FeedlistHelper
- Defined in:
- app/helpers/feedlist_helper.rb
Instance Method Summary collapse
- #all_feed_links(object, symbol) ⇒ Object
- #all_feed_links_for_context(context) ⇒ Object
- #all_feed_links_for_project(project) ⇒ Object
- #feed_links(feeds, link_options, title) ⇒ Object
- #ical_formatted_link(options = {}) ⇒ Object
- #linkoptions(format, options) ⇒ Object
- #merge_hashes(*hashes) ⇒ Object protected
- #rss_formatted_link(options = {}) ⇒ Object
- #text_formatted_link(options = {}) ⇒ Object
- #user_token_hash ⇒ Object protected
Instance Method Details
#all_feed_links(object, symbol) ⇒ Object
29 30 31 |
# File 'app/helpers/feedlist_helper.rb', line 29 def all_feed_links(object, symbol) feed_links([:rss, :txt, :ical], { :controller => 'todos', :action => 'index', symbol => object.to_param }, content_tag(:strong, object.name)) end |
#all_feed_links_for_context(context) ⇒ Object
37 38 39 |
# File 'app/helpers/feedlist_helper.rb', line 37 def all_feed_links_for_context(context) all_feed_links(context, :context_id) end |
#all_feed_links_for_project(project) ⇒ Object
33 34 35 |
# File 'app/helpers/feedlist_helper.rb', line 33 def all_feed_links_for_project(project) all_feed_links(project, :project_id) end |
#feed_links(feeds, link_options, title) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'app/helpers/feedlist_helper.rb', line 19 def feed_links(feeds, , title) space = " " html = "" html << rss_formatted_link() + space if feeds.include?(:rss) html << text_formatted_link() + space if feeds.include?(:txt) html << ical_formatted_link() + space if feeds.include?(:ical) html << title return html.html_safe end |
#ical_formatted_link(options = {}) ⇒ Object
15 16 17 |
# File 'app/helpers/feedlist_helper.rb', line 15 def ical_formatted_link( = {}) link_to(content_tag(:span, 'iCal', { :class => "feed", :title => "iCal feed" }), ('ics', )) end |
#linkoptions(format, options) ⇒ Object
2 3 4 |
# File 'app/helpers/feedlist_helper.rb', line 2 def (format, ) merge_hashes({ :format => format }, , user_token_hash) end |
#merge_hashes(*hashes) ⇒ Object (protected)
43 44 45 |
# File 'app/helpers/feedlist_helper.rb', line 43 def merge_hashes(*hashes) hashes.inject({}) { |result, h| result.merge(h) } end |
#rss_formatted_link(options = {}) ⇒ Object
6 7 8 9 |
# File 'app/helpers/feedlist_helper.rb', line 6 def rss_formatted_link( = {}) image_tag = image_tag("feed-icon.png", :size => "16X16", :border => 0, :class => "rss-icon") link_to(image_tag, ('rss', ), :title => "RSS feed") end |
#text_formatted_link(options = {}) ⇒ Object
11 12 13 |
# File 'app/helpers/feedlist_helper.rb', line 11 def text_formatted_link( = {}) link_to(content_tag(:span, 'TXT', { :class => 'feed', :title => "Plain text feed" }), ('txt', )) end |
#user_token_hash ⇒ Object (protected)
47 48 49 |
# File 'app/helpers/feedlist_helper.rb', line 47 def user_token_hash { :token => current_user.token } end |