Module: FeedlistHelper

Defined in:
app/helpers/feedlist_helper.rb

Instance Method Summary collapse

Instance Method Details


30
31
32
# File 'app/helpers/feedlist_helper.rb', line 30

def all_feed_links(object, symbol)
  feed_links([:rss, :txt, :ical], { :controller=> 'todos', :action => 'index', symbol => object.to_param }, (:strong, object.name))
end

38
39
40
# File 'app/helpers/feedlist_helper.rb', line 38

def all_feed_links_for_context(context)
  all_feed_links(context, :context_id)
end

34
35
36
# File 'app/helpers/feedlist_helper.rb', line 34

def all_feed_links_for_project(project)
  all_feed_links(project, :project_id)
end

20
21
22
23
24
25
26
27
28
# File 'app/helpers/feedlist_helper.rb', line 20

def feed_links(feeds, link_options, title)
  space = " "
  html = ""
  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
  return html.html_safe
end

16
17
18
# File 'app/helpers/feedlist_helper.rb', line 16

def ical_formatted_link(options = {})
  link_to((:span, 'iCal', {:class=>"feed", :title => "iCal feed"}), linkoptions('ics', options))
end

#linkoptions(format, options) ⇒ Object


3
4
5
# File 'app/helpers/feedlist_helper.rb', line 3

def linkoptions(format, options)
  merge_hashes( {:format => format}, options, user_token_hash)
end

#merge_hashes(*hashes) ⇒ Object (protected)


44
45
46
# File 'app/helpers/feedlist_helper.rb', line 44

def merge_hashes(*hashes)
  hashes.inject(Hash.new){ |result, h| result.merge(h) }
end

7
8
9
10
# File 'app/helpers/feedlist_helper.rb', line 7

def rss_formatted_link(options = {})
  image_tag = image_tag("feed-icon.png", :size => "16X16", :border => 0, :class => "rss-icon")
  link_to(image_tag, linkoptions('rss', options), :title => "RSS feed")
end

12
13
14
# File 'app/helpers/feedlist_helper.rb', line 12

def text_formatted_link(options = {})
  link_to((:span, 'TXT', {:class => 'feed', :title => "Plain text feed"}), linkoptions('txt', options))
end

#user_token_hashObject (protected)


48
49
50
# File 'app/helpers/feedlist_helper.rb', line 48

def user_token_hash
  { :token => current_user.token }
end