Modified: branches/event_logging/app/views/home/_summary.rhtml (2005 => 2006)
--- branches/event_logging/app/views/home/_summary.rhtml 2008-11-27 12:12:21 UTC (rev 2005)
+++ branches/event_logging/app/views/home/_summary.rhtml 2008-11-27 12:26:43 UTC (rev 2006)
@@ -6,209 +6,212 @@
<% # "My News" tab is added in front of others -%>
<% tab_id_correction = logged_in? ? 1 : 0 -%>
-<div class="box">
- <b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b></b>
- <div class="box_title">
- Quick Summary
- </div>
-
- <div class="content">
- <p class="quick_summary_section_title">
- Site Announcements
- </p>
- <% unless (announcements = Announcement.latest(3)).empty? %>
- <ul class="quick_summary_list">
- <% announcements.each do |a| %>
- <li>
- <%= icon("announcement", nil, "Announcement", nil, " "); -%>
- <%= link_to truncate(h(a.title), summary_box_max_length), announcement_url(a), :title => tooltip_title_attrib(h(a.title)) %>
- </li>
- <% end %>
- </ul>
- <p style="text-align: right; font-weight: bold; padding-top: 0; margin: 0 0 0.5em 0;">
- <a href="" 1+tab_id_correction -%>)">more...</a>
- </p>
- <% else %>
- <p class="none_text">None</p>
- <% end %>
+<% viewer_id = (logged_in? ? current_user.id : "public") %>
+<% cache_timeout({ :controller => 'home_cache', :action ="" 'quick_summary', :id => viewer_id } , NEWS_CACHE_TIMEOUT.seconds.from_now ) do -%>
+ <div class="box">
+ <b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b></b>
+ <div class="box_title">
+ Quick Summary
+ </div>
- <p class="quick_summary_section_title">
- Group Announcements
- </p>
- <% unless (announcements = GroupAnnouncement.latest_public(3)).empty? %>
- <ul class="quick_summary_list">
- <% announcements.each do |a| %>
- <li>
- <%= icon("announcement", nil, "Announcement", nil, " "); -%>
- <%= link_to truncate(h(a.title), summary_box_max_length), group_announcement_url(a.network, a), :title => tooltip_title_attrib(h(a.title)) %>
- </li>
- <% end %>
- </ul>
- <p style="text-align: right; font-weight: bold; padding-top: 0; margin: 0 0 0.5em 0;">
- <a href="" 1+tab_id_correction -%>)">more...</a>
+ <div class="content">
+ <p class="quick_summary_section_title">
+ Site Announcements
</p>
- <% else %>
- <p class="none_text">None</p>
- <% end %>
-
- <p class="quick_summary_section_title">
- New Users
- </p>
- <% unless (users = User.most_recent(3)).empty? %>
- <ul class="quick_summary_list">
- <% users.each do |user| -%>
- <li>
- <%= icon("user", nil, "User", nil, " "); -%>
- <%= link_to name(user, summary_box_max_length), user_path(user) -%>
- </li>
- <% end -%>
- </ul>
- <p style="text-align: right; font-weight: bold; padding-top: 0; margin: 0 0 0.5em 0;">
- <a href="" 2+tab_id_correction -%>)">more...</a>
- </p>
- <% else %>
- <p class="none_text">None</p>
- <% end %>
-
- <p class="quick_summary_section_title">
- Latest Groups
- </p>
- <% unless (groups = Network.recently_created(3)).empty? %>
- <ul class="quick_summary_list">
- <% groups.each do |group| -%>
- <li>
- <%= icon("network", nil, "Group", nil, " "); -%>
- <%= link_to title(group, summary_box_max_length), group_path(group) -%>
- </li>
- <% end -%>
- </ul>
- <p style="text-align: right; font-weight: bold; padding-top: 0; margin: 0 0 0.5em 0;">
- <a href="" 3+tab_id_correction -%>)">more...</a>
- </p>
- <% else %>
- <p class="none_text">None</p>
- <% end %>
-
- <p class="quick_summary_section_title">
- Updated Items
- </p>
- <% unless (contributions = Contribution.last_updated(10)).empty? %>
- <ul class="quick_summary_list">
- <% counter = 0 -%>
- <% contributions.each do |c| %>
- <% break if counter >= 3 -%>
- <% if c.authorized?('show', nil) %>
+ <% unless (announcements = Announcement.latest(3)).empty? %>
+ <ul class="quick_summary_list">
+ <% announcements.each do |a| %>
<li>
- <%= c_type = visible_name(c.contributable_type); icon(c.contributable_type, nil, c_type, nil, " ") %>
- <% c_id = c.contributable.id; c_name = contributable_name_from_instance(c.contributable) -%>
- <%= link_to truncate(c_name, summary_box_max_length), contributable_url(c_id, c.contributable_type), :alt => c_name, :title => tooltip_title_attrib(c_type + ": " + c_name) -%>
+ <%= icon("announcement", nil, "Announcement", nil, " "); -%>
+ <%= link_to truncate(h(a.title), summary_box_max_length), announcement_url(a), :title => tooltip_title_attrib(h(a.title)) %>
</li>
- <% counter += 1 -%>
<% end %>
- <% end %>
- </ul>
- <p style="text-align: right; font-weight: bold; padding-top: 0; margin: 0 0 0.5em 0;">
- <a href="" 4+tab_id_correction -%>)">more...</a>
+ </ul>
+ <p style="text-align: right; font-weight: bold; padding-top: 0; margin: 0 0 0.5em 0;">
+ <a href="" 1+tab_id_correction -%>)">more...</a>
+ </p>
+ <% else %>
+ <p class="none_text">None</p>
+ <% end %>
+
+ <p class="quick_summary_section_title">
+ Group Announcements
</p>
- <% else %>
- <p class="none_text">None</p>
- <% end %>
-
- <p class="quick_summary_section_title">
- Latest Tags
- </p>
- <% unless (taggings = Tagging.latest(10)).empty? %>
- <ul class="quick_summary_list">
- <% counter = 0 -%>
- <% taggings.each do |t| %>
- <% break if counter >= 3 -%>
-
- <% t_item = t.taggable -%>
- <% if t_item.authorized?('show', nil) %>
+ <% unless (announcements = GroupAnnouncement.latest_public(3)).empty? %>
+ <ul class="quick_summary_list">
+ <% announcements.each do |a| %>
<li>
- <%= t_type = visible_name(t.taggable_type); icon(t.taggable_type, nil, t_type, nil, " ") -%>
- <% t_item_id = t_item.id; t_name = contributable_name_from_instance(t_item) -%>
-
- <% tag_text = h(t.tag) -%>
- <% tooltip = "<b>#{h(t.user.name)}</b> tagged <b>#{t_name} #{t_type}</b> with \"#{tag_text}\"" -%>
- <%= link_to truncate(tag_text, summary_box_max_length), tag_url(t.tag), :title => tooltip_title_attrib(tooltip) -%>
+ <%= icon("announcement", nil, "Announcement", nil, " "); -%>
+ <%= link_to truncate(h(a.title), summary_box_max_length), group_announcement_url(a.network, a), :title => tooltip_title_attrib(h(a.title)) %>
</li>
- <% counter += 1 -%>
<% end %>
- <% end %>
- </ul>
- <p style="text-align: right; font-weight: bold; padding-top: 0; margin: 0 0 0.5em 0;">
- <a href="" 4+tab_id_correction -%>)">more...</a>
+ </ul>
+ <p style="text-align: right; font-weight: bold; padding-top: 0; margin: 0 0 0.5em 0;">
+ <a href="" 1+tab_id_correction -%>)">more...</a>
+ </p>
+ <% else %>
+ <p class="none_text">None</p>
+ <% end %>
+
+ <p class="quick_summary_section_title">
+ New Users
</p>
- <% else %>
- <p class="none_text">None</p>
- <% end %>
-
- <p class="quick_summary_section_title">
- Latest Comments
- </p>
- <% unless (comments = Comment.latest(10)).empty? %>
- <ul class="quick_summary_list">
- <% counter = 0 -%>
- <% comments.each do |c| %>
- <% break if counter >= 3 -%>
-
- <% c_item = c.commentable -%>
- <% if c_item.authorized?('show', nil) %>
- <li>
- <%= c_type = visible_name(c.commentable_type); icon(c.commentable_type, nil, c_type, nil, " ") -%>
- <% c_item_id = c_item.id; c_name = contributable_name_from_instance(c_item) -%>
-
- <% comment_text = strip_html(white_list(c.comment)) -%>
- <% comment_link = eval("#{c_type.downcase}_url(#{c_item_id})") + "#comment_#{c.id}" -%>
- <% tooltip = "<b>#{h(c.user.name)}</b> commented on <b>#{c_name} #{c_type}</b>: \"#{truncate(comment_text, 150)}\"" -%>
- <%= link_to truncate(comment_text, summary_box_max_length), comment_link, :title => tooltip_title_attrib(tooltip) -%>
+ <% unless (users = User.most_recent(3)).empty? %>
+ <ul class="quick_summary_list">
+ <% users.each do |user| -%>
+ <li>
+ <%= icon("user", nil, "User", nil, " "); -%>
+ <%= link_to name(user, summary_box_max_length), user_path(user) -%>
</li>
- <% counter += 1 -%>
- <% end %>
- <% end %>
- </ul>
- <p style="text-align: right; font-weight: bold; padding-top: 0; margin: 0 0 0.5em 0;">
- <a href="" 5+tab_id_correction -%>)">more...</a>
+ <% end -%>
+ </ul>
+ <p style="text-align: right; font-weight: bold; padding-top: 0; margin: 0 0 0.5em 0;">
+ <a href="" 2+tab_id_correction -%>)">more...</a>
+ </p>
+ <% else %>
+ <p class="none_text">None</p>
+ <% end %>
+
+ <p class="quick_summary_section_title">
+ Latest Groups
</p>
- <% else %>
- <p class="none_text">None</p>
- <% end %>
-
- <p class="quick_summary_section_title">
- Latest Reviews
- </p>
- <% unless (reviews = Review.latest(10)).empty? %>
- <ul class="quick_summary_list">
- <% counter = 0 -%>
- <% reviews.each do |r| %>
- <% break if counter >= 3 -%>
-
- <% r_item = r.reviewable -%>
- <% if r_item.authorized?('show', nil) %>
- <li>
- <%= r_type = visible_name(r.reviewable_type); icon(r.reviewable_type, nil, r_type, nil, " ") -%>
- <% r_item_id = r_item.id; r_name = contributable_name_from_instance(r_item) -%>
-
- <% review_title = h(r.title) %>
- <% review_text = (review_title.blank? ? strip_html(white_list(r.review)) : review_title) -%>
- <% review_link = review_url(r_item, r) -%>
- <% tooltip = "<b>#{h(r.user.name)}</b> reviewed <b>#{r_name} #{r_type}</b>: \"#{truncate(review_text, 150)}\"" -%>
- <%= link_to truncate(review_text, summary_box_max_length), review_link, :title => tooltip_title_attrib(tooltip) -%>
+ <% unless (groups = Network.recently_created(3)).empty? %>
+ <ul class="quick_summary_list">
+ <% groups.each do |group| -%>
+ <li>
+ <%= icon("network", nil, "Group", nil, " "); -%>
+ <%= link_to title(group, summary_box_max_length), group_path(group) -%>
</li>
- <% counter += 1 -%>
+ <% end -%>
+ </ul>
+ <p style="text-align: right; font-weight: bold; padding-top: 0; margin: 0 0 0.5em 0;">
+ <a href="" 3+tab_id_correction -%>)">more...</a>
+ </p>
+ <% else %>
+ <p class="none_text">None</p>
+ <% end %>
+
+ <p class="quick_summary_section_title">
+ Updated Items
+ </p>
+ <% unless (contributions = Contribution.last_updated(10)).empty? %>
+ <ul class="quick_summary_list">
+ <% counter = 0 -%>
+ <% contributions.each do |c| %>
+ <% break if counter >= 3 -%>
+ <% if c.authorized?('show', nil) %>
+ <li>
+ <%= c_type = visible_name(c.contributable_type); icon(c.contributable_type, nil, c_type, nil, " ") %>
+ <% c_id = c.contributable.id; c_name = contributable_name_from_instance(c.contributable) -%>
+ <%= link_to truncate(c_name, summary_box_max_length), contributable_url(c_id, c.contributable_type), :alt => c_name, :title => tooltip_title_attrib(c_type + ": " + c_name) -%>
+ </li>
+ <% counter += 1 -%>
+ <% end %>
<% end %>
- <% end %>
- </ul>
- <p style="text-align: right; font-weight: bold; padding-top: 0; margin: 0 0 0.5em 0;">
- <a href="" 5+tab_id_correction -%>)">more...</a>
+ </ul>
+ <p style="text-align: right; font-weight: bold; padding-top: 0; margin: 0 0 0.5em 0;">
+ <a href="" 4+tab_id_correction -%>)">more...</a>
+ </p>
+ <% else %>
+ <p class="none_text">None</p>
+ <% end %>
+
+ <p class="quick_summary_section_title">
+ Latest Tags
</p>
- <% else %>
- <p class="none_text">None</p>
- <% end %>
-
-
-
+ <% unless (taggings = Tagging.latest(10)).empty? %>
+ <ul class="quick_summary_list">
+ <% counter = 0 -%>
+ <% taggings.each do |t| %>
+ <% break if counter >= 3 -%>
+
+ <% t_item = t.taggable -%>
+ <% if t_item.authorized?('show', nil) %>
+ <li>
+ <%= t_type = visible_name(t.taggable_type); icon(t.taggable_type, nil, t_type, nil, " ") -%>
+ <% t_item_id = t_item.id; t_name = contributable_name_from_instance(t_item) -%>
+
+ <% tag_text = h(t.tag) -%>
+ <% tooltip = "<b>#{h(t.user.name)}</b> tagged <b>#{t_name} #{t_type}</b> with \"#{tag_text}\"" -%>
+ <%= link_to truncate(tag_text, summary_box_max_length), tag_url(t.tag), :title => tooltip_title_attrib(tooltip) -%>
+ </li>
+ <% counter += 1 -%>
+ <% end %>
+ <% end %>
+ </ul>
+ <p style="text-align: right; font-weight: bold; padding-top: 0; margin: 0 0 0.5em 0;">
+ <a href="" 4+tab_id_correction -%>)">more...</a>
+ </p>
+ <% else %>
+ <p class="none_text">None</p>
+ <% end %>
+
+ <p class="quick_summary_section_title">
+ Latest Comments
+ </p>
+ <% unless (comments = Comment.latest(10)).empty? %>
+ <ul class="quick_summary_list">
+ <% counter = 0 -%>
+ <% comments.each do |c| %>
+ <% break if counter >= 3 -%>
+
+ <% c_item = c.commentable -%>
+ <% if c_item.authorized?('show', nil) %>
+ <li>
+ <%= c_type = visible_name(c.commentable_type); icon(c.commentable_type, nil, c_type, nil, " ") -%>
+ <% c_item_id = c_item.id; c_name = contributable_name_from_instance(c_item) -%>
+
+ <% comment_text = strip_html(white_list(c.comment)) -%>
+ <% comment_link = eval("#{c_type.downcase}_url(#{c_item_id})") + "#comment_#{c.id}" -%>
+ <% tooltip = "<b>#{h(c.user.name)}</b> commented on <b>#{c_name} #{c_type}</b>: \"#{truncate(comment_text, 150)}\"" -%>
+ <%= link_to truncate(comment_text, summary_box_max_length), comment_link, :title => tooltip_title_attrib(tooltip) -%>
+ </li>
+ <% counter += 1 -%>
+ <% end %>
+ <% end %>
+ </ul>
+ <p style="text-align: right; font-weight: bold; padding-top: 0; margin: 0 0 0.5em 0;">
+ <a href="" 5+tab_id_correction -%>)">more...</a>
+ </p>
+ <% else %>
+ <p class="none_text">None</p>
+ <% end %>
+
+ <p class="quick_summary_section_title">
+ Latest Reviews
+ </p>
+ <% unless (reviews = Review.latest(10)).empty? %>
+ <ul class="quick_summary_list">
+ <% counter = 0 -%>
+ <% reviews.each do |r| %>
+ <% break if counter >= 3 -%>
+
+ <% r_item = r.reviewable -%>
+ <% if r_item.authorized?('show', nil) %>
+ <li>
+ <%= r_type = visible_name(r.reviewable_type); icon(r.reviewable_type, nil, r_type, nil, " ") -%>
+ <% r_item_id = r_item.id; r_name = contributable_name_from_instance(r_item) -%>
+
+ <% review_title = h(r.title) %>
+ <% review_text = (review_title.blank? ? strip_html(white_list(r.review)) : review_title) -%>
+ <% review_link = review_url(r_item, r) -%>
+ <% tooltip = "<b>#{h(r.user.name)}</b> reviewed <b>#{r_name} #{r_type}</b>: \"#{truncate(review_text, 150)}\"" -%>
+ <%= link_to truncate(review_text, summary_box_max_length), review_link, :title => tooltip_title_attrib(tooltip) -%>
+ </li>
+ <% counter += 1 -%>
+ <% end %>
+ <% end %>
+ </ul>
+ <p style="text-align: right; font-weight: bold; padding-top: 0; margin: 0 0 0.5em 0;">
+ <a href="" 5+tab_id_correction -%>)">more...</a>
+ </p>
+ <% else %>
+ <p class="none_text">None</p>
+ <% end %>
+
+
+
+ </div>
+ <b class="xbottom"><b class="xb5"></b><b class="xb6"></b><b class="xb7"></b><b class="xb1"></b></b>
</div>
- <b class="xbottom"><b class="xb5"></b><b class="xb6"></b><b class="xb7"></b><b class="xb1"></b></b>
-</div>
\ No newline at end of file
+<% end -%>
\ No newline at end of file