Diff
Modified: branches/event_logging/app/helpers/application_helper.rb (1976 => 1977)
--- branches/event_logging/app/helpers/application_helper.rb 2008-11-17 16:08:27 UTC (rev 1976)
+++ branches/event_logging/app/helpers/application_helper.rb 2008-11-17 16:33:47 UTC (rev 1977)
@@ -1136,6 +1136,92 @@
str.gsub(/<(\/|\s)*[^(#{preserve_arr})][^>]*>/,'')
end
+ def feed_discovery_tags(controller)
+ feed_links = []
+
+ # news on individual contributable items / individual users & groups
+ # (done in generic way to avoid repetition of code)
+ if ["workflows", "blobs", "packs", "users", "networks"].include?(controller.controller_name.to_s) && controller.action_name.to_s == "show"
+ item_type = controller.controller_name.to_s.singularize.downcase
+ item_id = controller.assigns[item_type].id
+ item_visible_type = controller_visible_name(controller.controller_name.to_s.camelcase).singularize
+ unless item_type == "user"
+ item_visible_name = "'#{controller.assigns[item_type].title}' #{item_visible_type}"
+ else
+ item_visible_name = controller.assigns[item_type].name + "'s Public"
+ end
+
+ feed_url = eval("formatted_news_#{item_visible_type.downcase}_url(#{item_id}, :rss)")
+ feed_links << "<link href="" rel=\"alternate\" type=\"application/rss+xml\" title=\"myExperiment.org - #{item_visible_name} News\" />"
+ end
+
+ case controller.controller_name.to_s
+ when "home"
+ if controller.action_name.to_s == "index"
+ # all feeds on "home" page
+
+ if !logged_in?
+ feed_links << "<link href="" rel=\"alternate\" type=\"application/rss+xml\" title=\"myExperiment.org - Public News\" />"
+ else
+ # will have secure "My News" feed here when it's implemented
+ end
+
+ feed_links << "<link href="" rel=\"alternate\" type=\"application/rss+xml\" title=\"myExperiment.org - Site Announcements\" />"
+ feed_links << "<link href="" rel=\"alternate\" type=\"application/rss+xml\" title=\"myExperiment.org - Latest Groups\" />"
+ feed_links << "<link href="" rel=\"alternate\" type=\"application/rss+xml\" title=\"myExperiment.org - Updated Items\" />"
+ feed_links << "<link href="" rel=\"alternate\" type=\"application/rss+xml\" title=\"myExperiment.org - Latest Tags\" />"
+ feed_links << "<link href="" rel=\"alternate\" type=\"application/rss+xml\" title=\"myExperiment.org - Latest Comments\" />"
+ feed_links << "<link href="" rel=\"alternate\" type=\"application/rss+xml\" title=\"myExperiment.org - Latest Reviews\" />"
+ end
+ when "users"
+ # if controller.action_name.to_s == "show"
+ # (individual user news - covered in generic block a the top of the method)
+ # end
+ when "networks"
+ if controller.action_name.to_s == "all" || controller.action_name.to_s == "index"
+ # latest groups
+ feed_links << "<link href="" rel=\"alternate\" type=\"application/rss+xml\" title=\"myExperiment.org - Latest Groups\" />"
+ elsif controller.action_name.to_s == "show"
+ # (individual group news - covered in generic block a the top of the method)
+ # group shared items
+ feed_links << "<link href="" :rss)}\" rel=\"alternate\" type=\"application/rss+xml\" title=\"myExperiment.org - Shared Items of 'address@hidden' Group\" />"
+ end
+ when "workflows"
+ # latest workflows
+ if controller.action_name.to_s == "all" || controller.action_name.to_s == "index"
+ feed_links << "<link href="" rel=\"alternate\" type=\"application/rss+xml\" title=\"myExperiment.org - Latest Workflows\" />"
+ # elsif controller.action_name.to_s == "show"
+ # (individual workflow news - covered in generic block a the top of the method)
+ end
+ when "blobs"
+ # latest files
+ if controller.action_name.to_s == "all" || controller.action_name.to_s == "index"
+ feed_links << "<link href="" rel=\"alternate\" type=\"application/rss+xml\" title=\"myExperiment.org - Latest Files\" />"
+ # elsif controller.action_name.to_s == "show"
+ # (individual file news - covered in generic block a the top of the method)
+ end
+ when "packs"
+ # latest packs
+ if controller.action_name.to_s == "all" || controller.action_name.to_s == "index"
+ feed_links << "<link href="" rel=\"alternate\" type=\"application/rss+xml\" title=\"myExperiment.org - Latest Packs\" />"
+ elsif controller.action_name.to_s == "show"
+ # (individual pack news - covered in generic block a the top of the method)
+ feed_links << "<link href="" :rss)}\" rel=\"alternate\" type=\"application/rss+xml\" title=\"myExperiment.org - 'address@hidden' Pack Items\" />"
+ end
+ when "tags"
+ # latest tags
+ if controller.action_name.to_s == "index"
+ feed_links << "<link href="" rel=\"alternate\" type=\"application/rss+xml\" title=\"myExperiment.org - Latest Tags\" />"
+ end
+ when "announcements"
+ if controller.action_name.to_s == "index"
+ feed_links << "<link href="" rel=\"alternate\" type=\"application/rss+xml\" title=\"myExperiment.org - Site Announcements\" />"
+ end
+ end
+
+ return feed_links
+ end
+
def feed_icon_tag(title, url, style='')
(@feed_icons ||= []) << { :url ="" url, :title => title }
alt_text = "Subscribe to #{title} feed"
Modified: branches/event_logging/app/views/blobs/all.rhtml (1976 => 1977)
--- branches/event_logging/app/views/blobs/all.rhtml 2008-11-17 16:08:27 UTC (rev 1976)
+++ branches/event_logging/app/views/blobs/all.rhtml 2008-11-17 16:33:47 UTC (rev 1977)
@@ -1,6 +1,6 @@
<% t "All" -%>
-<h2>All Files</h2>
+<h2><%= feed_icon_tag "Latest Files", formatted_files_path(:rss), "margin-right: 0.3em;" -%> All Files</h2>
<%= render :partial => "layouts/paginate", :locals => { :collection => @blobs } %>
Modified: branches/event_logging/app/views/layouts/_feed_link_tags.rhtml (1976 => 1977)
--- branches/event_logging/app/views/layouts/_feed_link_tags.rhtml 2008-11-17 16:08:27 UTC (rev 1976)
+++ branches/event_logging/app/views/layouts/_feed_link_tags.rhtml 2008-11-17 16:33:47 UTC (rev 1977)
@@ -1,11 +1,6 @@
-<% if controller.controller_name.to_s == "workflows" and (controller.action_name.to_s == "all" or controller.action_name.to_s == "index") -%>
- <link href="" workflows_url %>.rss" rel="alternate" type="application/rss+xml" title="myExperiment.org - Latest Workflows" />
-<% end -%>
+<% # The idea of creating this file was to keep a collection of RSS feeds better maintainable; -%>
+<% # To reduce processing to the minimum "case" on controller_name is done -%>
-<% if controller.controller_name.to_s == "home" or (controller.controller_name.to_s == "announcements" and controller.action_name.to_s == "index") -%>
- <link href="" announcements_url %>.rss" rel="alternate" type="application/rss+xml" title="myExperiment.org - Site Announcements" />
-<% end -%>
-
-<% if controller.controller_name.to_s == "packs" and controller.action_name.to_s == "show" -%>
- <link href="" formatted_items_pack_path(@pack, :rss) -%>" rel="alternate" type="application/rss+xml" title="myExperiment.org - Pack items feed" />
+<% feed_discovery_tags(controller).each do |tag_to_output| -%>
+ <%= tag_to_output -%>
<% end -%>
\ No newline at end of file
Modified: branches/event_logging/app/views/networks/all.rhtml (1976 => 1977)
--- branches/event_logging/app/views/networks/all.rhtml 2008-11-17 16:08:27 UTC (rev 1976)
+++ branches/event_logging/app/views/networks/all.rhtml 2008-11-17 16:33:47 UTC (rev 1977)
@@ -1,6 +1,6 @@
<% t "All" -%>
-<h2>All Groups</h2>
+<h2><%= feed_icon_tag("Latest Groups on myExperiment", formatted_groups_path(:rss)) -%> All Groups</h2>
<%= render :partial => "layouts/paginate", :locals => { :collection => @networks } %>
Modified: branches/event_logging/app/views/packs/all.rhtml (1976 => 1977)
--- branches/event_logging/app/views/packs/all.rhtml 2008-11-17 16:08:27 UTC (rev 1976)
+++ branches/event_logging/app/views/packs/all.rhtml 2008-11-17 16:33:47 UTC (rev 1977)
@@ -1,6 +1,6 @@
<% t "All" -%>
-<h2>All Packs</h2>
+<h2><%= feed_icon_tag "Latest Packs", formatted_packs_path(:rss), "margin-right: 0.3em;" -%> All Packs</h2>
<%= render :partial => "layouts/paginate", :locals => { :collection => @packs } %>