myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [1999] branches/event_logging: Subscriptions.


From: noreply
Subject: [myexperiment-hackers] [1999] branches/event_logging: Subscriptions.
Date: Fri, 21 Nov 2008 13:34:41 -0500 (EST)

Revision
1999
Author
alekses6
Date
2008-11-21 13:34:41 -0500 (Fri, 21 Nov 2008)

Log Message

Subscriptions. "Quick summary" box added that lists top 3 items of each category on the home page.

Modified Paths

Added Paths

Diff

Modified: branches/event_logging/app/helpers/application_helper.rb (1998 => 1999)


--- branches/event_logging/app/helpers/application_helper.rb	2008-11-21 12:00:51 UTC (rev 1998)
+++ branches/event_logging/app/helpers/application_helper.rb	2008-11-21 18:34:41 UTC (rev 1999)
@@ -455,18 +455,22 @@
   #
   # NB! although not designed for groups, still used in some places - so
   # method name left unchanged, but functionality for groups added 
-  def contributable_name_from_instance(contributable)
+  def contributable_name_from_instance(contributable, truncate=nil)
+    name = ""
+    
     case contributable.class.to_s
       when "Workflow", "Pack"
-        return contributable.title
+        name = contributable.title
       when "Blob"
-        return ((contributable.title && contributable.title.length > 0) ? h(contributable.title) : h(contributable.local_name))
+        name = ((contributable.title && contributable.title.length > 0) ? h(contributable.title) : h(contributable.local_name))
       when "Network"
         # title is required for groups
-        return contributable.title
+        name = contributable.title
       else
         return "(#{contributable.class.to_s},#{contributable.id})"
     end
+    
+    return truncate ? truncate(name, truncate) : name
   end
   
   def contributable_url(contributableid, contributabletype, base_host=nil)

Modified: branches/event_logging/app/views/home/_group_announcements.rhtml (1998 => 1999)


--- branches/event_logging/app/views/home/_group_announcements.rhtml	2008-11-21 12:00:51 UTC (rev 1998)
+++ branches/event_logging/app/views/home/_group_announcements.rhtml	2008-11-21 18:34:41 UTC (rev 1999)
@@ -12,7 +12,7 @@
 					<% announcements.each do |a| %>
 						<li>
 							<p class="box_standout" style="font-size: 93%; padding: 0.2em 0.5em; margin: 0.1em 0; font-weight: bold;">
-								<%= link_to h(a.title), announcement_url(a) %>
+								<%= link_to h(a.title), group_announcement_url(a.network, a) %>
 							</p>
 							<p style="font-size: 77%; padding-left: 1.5em;"><b><%= datetime a.created_at, false %></b> by <b><%= name a.user %></b> for <b><%= title a.network -%></b> Group</p>
 						</li>

Modified: branches/event_logging/app/views/home/_news.rhtml (1998 => 1999)


--- branches/event_logging/app/views/home/_news.rhtml	2008-11-21 12:00:51 UTC (rev 1998)
+++ branches/event_logging/app/views/home/_news.rhtml	2008-11-21 18:34:41 UTC (rev 1999)
@@ -1,4 +1,6 @@
 <!-- News -->
+<% news_box_style ||= "" -%>
+
 <% benchmark "Home page news feed" do %>
 <div class="box" style="<%= news_box_style -%>">
 	<b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b></b>

Added: branches/event_logging/app/views/home/_summary.rhtml (0 => 1999)


--- branches/event_logging/app/views/home/_summary.rhtml	                        (rev 0)
+++ branches/event_logging/app/views/home/_summary.rhtml	2008-11-21 18:34:41 UTC (rev 1999)
@@ -0,0 +1,210 @@
+<!-- Quick Summary -->
+<% # NB! _javascript_ code opening correct tabs may break easily if the tab layout changes! -%>
+<% summary_box_max_length = 25 -%>
+
+<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, "&nbsp;"); -%>
+						<%= 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="" 
+			</p>
+		<% else %>
+			<p class="none_text">None</p>
+		<% end %>
+		
+		<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, "&nbsp;"); -%>
+						<%= 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="" 
+			</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, "&nbsp;"); -%>
+						<%= 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="" 
+			</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, "&nbsp;"); -%>
+						<%= 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="" 
+			</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, "&nbsp;") %>
+							<% 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 %>
+			</ul>
+			<p style="text-align: right; font-weight: bold; padding-top: 0; margin: 0 0 0.5em 0;">
+			  <a href="" 
+			</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) %>
+						<li>
+							<%= t_type = visible_name(t.taggable_type); icon(t.taggable_type, nil, t_type, nil, "&nbsp;") -%>
+							<% 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="" 
+			</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, "&nbsp;") -%>
+							<% 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="" 
+			</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, "&nbsp;") -%>
+							<% 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="" 
+			</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>
\ No newline at end of file

Modified: branches/event_logging/app/views/home/index.rhtml (1998 => 1999)


--- branches/event_logging/app/views/home/index.rhtml	2008-11-21 12:00:51 UTC (rev 1998)
+++ branches/event_logging/app/views/home/index.rhtml	2008-11-21 18:34:41 UTC (rev 1999)
@@ -5,6 +5,7 @@
 	<div id="tabsContainer" class="tabsContainer" style="margin-top: 2em;"></div>
 	
 	<% if logged_in? -%>
+		<a name="my_news"></a>
 		<div class="tabContainer">
 			<div class="tabTitle"><b>My News</b></div>
 			<div class="tabContent">
@@ -22,22 +23,24 @@
 		</div>
 	<% end -%>
 	
+	<a name="public_news"></a>
 	<div class="tabContainer">
 		<div class="tabTitle"><b>Public News</b></div>
 		<div class="tabContent">
-			<div>
-				<center>
+			<div class="left">
+			  <%= render :partial => "summary" %>
+			</div>
+			<div class="right">
 				  <%= render :partial => "news", :locals => {:news_box_title => feed_icon_tag("myExperiment Public News", home_public_news_rss_url) + "&nbsp;Public News",
-                                                     :news_box_style => "width: 550px; text-align: left;",
                                                      :news_for => nil,
                                                      :required_news_count => DEFAULT_ANONYMOUS_HOME_PAGE_NEWS_COUNT,
                                                      :required_news_timeframe => DEFAULT_ANONYMOUS_HOME_PAGE_NEWS_TIMEFRAME} %>
-  			</center>
-				<div class="clearer">&nbsp;</div>
 			</div>
+			<div class="clearer">&nbsp;</div>
 		</div>
 	</div>
 	
+	<a name="announcements"></a>
 	<div class="tabContainer">
 		<div class="tabTitle"><b>Announcements</b></div>
 		<div class="tabContent">
@@ -51,6 +54,7 @@
 		</div>
 	</div>
 	
+	<a name="new_users"></a>
 	<div class="tabContainer">
 		<div class="tabTitle"><b>New Users</b></div>
 		<div class="tabContent">
@@ -59,6 +63,7 @@
 		</div>
 	</div>
 	
+	<a name="latest_groups"></a>
 	<div class="tabContainer">
 		<div class="tabTitle"><b>Latest Groups</b></div>
 		<div class="tabContent">
@@ -67,6 +72,8 @@
 		</div>
 	</div>
 	
+	<a name="updated_items"></a>
+	<a name="latest_tags"></a>
 	<div class="tabContainer">
 		<div class="tabTitle"><b>Updated Items</b></div>
 		<div class="tabContent">
@@ -80,6 +87,7 @@
 		</div>
 	</div>
 	
+	<a name="user_opinions"></a>
 	<div class="tabContainer">
 		<div class="tabTitle"><b>User Opinions</b></div>
 		<div class="tabContent">

Modified: branches/event_logging/public/stylesheets/styles.css (1998 => 1999)


--- branches/event_logging/public/stylesheets/styles.css	2008-11-21 12:00:51 UTC (rev 1998)
+++ branches/event_logging/public/stylesheets/styles.css	2008-11-21 18:34:41 UTC (rev 1999)
@@ -518,6 +518,22 @@
 	line-height: 1.5;
 }
 
+#home_container .quick_summary_section_title{
+	font-weight: bold;
+	margin: 0.5em 0 0 0;
+	padding: 0 0 0.2em 0;
+	border-bottom: 1px dotted #999999;
+}
+
+#home_container .quick_summary_list {
+	margin: 0.3em 0 0 0.5em;
+	font-size: 93%;
+}
+
+#home_container .quick_summary_list li {
+  list-style-type: none;
+}
+
 /* begin css rounded corners - based on "Snazzy Corners" */
 
 #home_container .xtop, 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]