2007-03-30 04:36:52 +00:00
|
|
|
module FeedlistHelper
|
|
|
|
|
|
|
|
|
|
def rss_formatted_link(options = {})
|
|
|
|
|
image_tag = image_tag("feed-icon.png", :size => "16X16", :border => 0, :class => "rss-icon")
|
2007-09-26 12:05:21 +00:00
|
|
|
linkoptions = merge_hashes( {:format => 'rss'}, user_token_hash, options)
|
2007-03-30 04:36:52 +00:00
|
|
|
link_to(image_tag, linkoptions, :title => "RSS feed")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def text_formatted_link(options = {})
|
2007-09-26 12:05:21 +00:00
|
|
|
linkoptions = merge_hashes( {:format => 'txt'}, user_token_hash, options)
|
2007-03-30 04:36:52 +00:00
|
|
|
link_to('<span class="feed">TXT</span>', linkoptions, :title => "Plain text feed" )
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def ical_formatted_link(options = {})
|
2007-09-26 12:05:21 +00:00
|
|
|
linkoptions = merge_hashes( {:format => 'ics'}, user_token_hash, options)
|
2007-03-30 04:36:52 +00:00
|
|
|
link_to('<span class="feed">iCal</span>', linkoptions, :title => "iCal feed" )
|
|
|
|
|
end
|
|
|
|
|
|
2007-07-30 05:29:18 +00:00
|
|
|
protected
|
|
|
|
|
|
|
|
|
|
def merge_hashes(*hashes)
|
|
|
|
|
hashes.inject(Hash.new){ |result, h| result.merge(h) }
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def user_token_hash
|
|
|
|
|
{ :token => current_user.token }
|
|
|
|
|
end
|
|
|
|
|
|
2007-03-30 04:36:52 +00:00
|
|
|
end
|