myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [1914] branches/event_logging: Major re-styling o


From: noreply
Subject: [myexperiment-hackers] [1914] branches/event_logging: Major re-styling of news feeds.
Date: Fri, 31 Oct 2008 12:58:30 -0400 (EDT)

Revision
1914
Author
alekses6
Date
2008-10-31 12:58:29 -0400 (Fri, 31 Oct 2008)

Log Message

Major re-styling of news feeds.

Modified Paths

Diff

Modified: branches/event_logging/app/helpers/application_helper.rb (1913 => 1914)


--- branches/event_logging/app/helpers/application_helper.rb	2008-10-31 14:37:27 UTC (rev 1913)
+++ branches/event_logging/app/helpers/application_helper.rb	2008-10-31 16:58:29 UTC (rev 1914)
@@ -609,15 +609,16 @@
       nearest_day = news_item[0] - (news_item[0].hour.hours + news_item[0].min.minutes + news_item[0].sec.seconds)
       
       # bugfix to 'pad out' hours and minutes which are less than ten.. eg: 3:2 --> 03:02 [am]
-      time = "#{(news_item[0].hour < 10 ? "0#{news_item[0].hour}" : news_item[0].hour)}:#{(news_item[0].min < 10 ? "0#{news_item[0].min}" : news_item[0].min)} -"
+      time = "#{(news_item[0].hour < 10 ? "0#{news_item[0].hour}" : news_item[0].hour)}:#{(news_item[0].min < 10 ? "0#{news_item[0].min}" : news_item[0].min)}"
       
       if hash.has_key? nearest_day
-        hash[nearest_day] << "#{time} #{news_item[1]}"
+        hash[nearest_day] << ["#{time}", "#{news_item[1]}"]
       else
-        hash[nearest_day] = ["#{time} #{news_item[1]}"]
+        hash[nearest_day] = [["#{time}", "#{news_item[1]}"]]
       end
     end
     
+    # 0th element of the hash contains sequence number of "day", sort by days when news occurred
     rtn = hash.sort { |a, b|
       b[0] <=> a[0]
     }
@@ -1613,7 +1614,7 @@
               
               # need to check that current viewer allowed to see news entry about the current contributable
               if my_event || object.authorized?("view", current_viewer)
-                rtn << [timestamp, "#{culprit_link} #{action}d the #{link_to object_visible_name, object_path} #{model_visible_name(loggable_type.to_s)}."]
+                rtn << [timestamp, "#{culprit_link} <span class='news_feed_action'>#{action}d</span> the #{link_to object_visible_name, object_path} #{model_visible_name(loggable_type.to_s)}."]
               end
             rescue ActiveRecord::RecordNotFound
               # do nothing, but don't display the news entry for missing contributable item
@@ -1651,7 +1652,7 @@
                authorized = false unless my_event || object.authorized?("view", current_viewer)
                
                if authorized
-                 rtn << [timestamp, "#{culprit_link} added #{link_to object_visible_name, object_path} #{model_visible_name(object.class.to_s)} to #{pack_link} Pack."]
+                 rtn << [timestamp, "#{culprit_link} <span class='news_feed_action'>added</span> #{link_to object_visible_name, object_path} #{model_visible_name(object.class.to_s)} to #{pack_link} Pack."]
                end
              else
                # ..and check if external link can still be found
@@ -1660,7 +1661,7 @@
                
                # if allowed to see the pack, no further checks required as anyone can see external items
                if authorized
-                 rtn << [timestamp, "#{culprit_link} added an external link to #{pack_link} Pack: #{link_to remote_entry.title, remote_entry.uri, :title => tooltip_title_attrib(h(remote_entry.uri))}."]
+                 rtn << [timestamp, "#{culprit_link} <span class='news_feed_action'>added</span> an external link to #{pack_link} Pack: #{link_to remote_entry.title, remote_entry.uri, :title => tooltip_title_attrib(h(remote_entry.uri))}."]
                end
              end
            rescue ActiveRecord::RecordNotFound
@@ -1703,27 +1704,27 @@
           if authorized
             case action 
               when "invite"
-                rtn << [timestamp, "#{name(network_admin)} invited #{name(user)} to join the #{title(network)} Group."]
+                rtn << [timestamp, "#{name(network_admin)} <span class='news_feed_action'>invited</span> #{name(user)} to join the #{title(network)} Group."]
               when "request"
-                rtn << [timestamp, "#{name(user)} requested to join the #{title(network)} Group."]
+                rtn << [timestamp, "#{name(user)} <span class='news_feed_action'>requested</span> to join the #{title(network)} Group."]
               when "accept"
                 # even though it can be the admin who accepted the membership request,
                 # news item says that the "user" has joined the group - so it's not
                 # acceptable to show this event on the group admin's profile page
                 return nil if (contributor_news_only && contributor.id == network_admin.id)
                 
-                rtn << [timestamp, "#{name(user)} joined the #{title(network)} Group."]
+                rtn << [timestamp, "#{name(user)} <span class='news_feed_action'>joined</span> the #{title(network)} Group."]
               when "reject"
                 if log_entry.culprit_type == "User"
-                  rtn << [timestamp, "#{name(user)} rejected invitation to join the #{title(network)} Group."]
+                  rtn << [timestamp, "#{name(user)} <span class='news_feed_action'>rejected</span> invitation to join the #{title(network)} Group."]
                 else
-                  rtn << [timestamp, "#{name(network_admin)} rejected #{name(user)}'s request to join the #{title(network)} Group."]
+                  rtn << [timestamp, "#{name(network_admin)} <span class='news_feed_action'>rejected</span> #{name(user)}'s request to join the #{title(network)} Group."]
                 end
               when "destroy"
                 if log_entry.culprit_type == "User"
-                  rtn << [timestamp, "#{name(user)} has left the #{title(network)} Group."]
+                  rtn << [timestamp, "#{name(user)} has <span class='news_feed_action'>left</span> the #{title(network)} Group."]
                 else
-                  rtn << [timestamp, "#{name(network_admin)} removed #{name(user)} from the list of members of the #{title(network)} Group."]
+                  rtn << [timestamp, "#{name(network_admin)} <span class='news_feed_action'>removed</span> #{name(user)} from the list of members of the #{title(network)} Group."]
               end
             end
           else
@@ -1754,13 +1755,13 @@
         if authorized
           case action 
             when "create"
-              rtn << [timestamp, "#{culprit_link} requested friendship with #{name(referenced_user)}."]
+              rtn << [timestamp, "#{culprit_link} <span class='news_feed_action'>requested</span> friendship with #{name(referenced_user)}."]
             when "accept"
-              rtn << [timestamp, "#{culprit_link} and #{name(referenced_user)} became friends."]
+              rtn << [timestamp, "#{culprit_link} and #{name(referenced_user)} <span class='news_feed_action'>became friends</span>."]
             when "reject"
-              rtn << [timestamp, "#{culprit_link} rejected a friendship request from #{name(referenced_user)}."]
+              rtn << [timestamp, "#{culprit_link} <span class='news_feed_action'>rejected</span> a friendship request from #{name(referenced_user)}."]
             when "destroy"
-              rtn << [timestamp, "#{culprit_link} removed #{name(referenced_user)} from their friends list."]
+              rtn << [timestamp, "#{culprit_link} <span class='news_feed_action'>removed</span> #{name(referenced_user)} from their friends list."]
           end
         else
           return nil
@@ -1772,7 +1773,7 @@
             network = Network.find(log_entry.activity_loggable_id)
             
             # anyone is allowed to see new groups
-            rtn << [timestamp, "#{culprit_link} created the #{title(network)} Group."]
+            rtn << [timestamp, "#{culprit_link} <span class='news_feed_action'>created</span> the #{title(network)} Group."]
           rescue ActiveRecord::RecordNotFound
              # do nothing, but don't display the news entry for missing group
           end
@@ -1789,7 +1790,7 @@
             
             if authorized
               # title can't be blank for group announcements, so it's safe to assume it's going to be present;
-              rtn << [timestamp, "#{culprit_link} made an announcement \"#{link_to ann.title, group_announcement_path(log_entry.referenced_id, ann.id)}\" for group #{title(group)}."]
+              rtn << [timestamp, "#{culprit_link} <span class='news_feed_action'>made</span> an announcement \"#{link_to ann.title, group_announcement_path(log_entry.referenced_id, ann.id)}\" for group #{title(group)}."]
             end
           rescue ActiveRecord::RecordNotFound
             # do nothing, but don't display the news entry for missing group announcement / group
@@ -1855,7 +1856,7 @@
                 end
                 
                 if authorized
-                  rtn << [timestamp, "#{culprit_link} shared #{access_rights} #{shared_what_links_arr.join(", ")} with #{shared_with}."]
+                  rtn << [timestamp, "#{culprit_link} <span class='news_feed_action'>shared</span> #{access_rights} #{shared_what_links_arr.join(", ")} with #{shared_with}."]
                 end
               end
             rescue ActiveRecord::RecordNotFound
@@ -1875,7 +1876,7 @@
               authorized = ( my_event || object.authorized?("view", current_viewer) )
               
               if authorized
-                rtn << [timestamp, "#{culprit_link} rated #{link_to object_visible_name, object_path} #{model_visible_name(log_entry.referenced_type.to_s)} #{rating.rating} out of 5."]
+                rtn << [timestamp, "#{culprit_link} <span class='news_feed_action'>rated</span> #{link_to object_visible_name, object_path} #{model_visible_name(log_entry.referenced_type.to_s)} #{rating.rating} out of 5."]
               end
             rescue ActiveRecord::RecordNotFound
               # do nothing, but don't display the news entry for missing rating / object
@@ -1898,7 +1899,7 @@
             authorized = ( my_event || object.authorized?("view", current_viewer) )
             
             if authorized
-              rtn << [timestamp, "#{culprit_link} added #{link_to object_visible_name, object_path} #{model_visible_name(log_entry.referenced_type.to_s)} to #{link_to "favourites", user_path(log_entry.culprit_id) + "/favourites"}."]
+              rtn << [timestamp, "#{culprit_link} <span class='news_feed_action'>added</span> #{link_to object_visible_name, object_path} #{model_visible_name(log_entry.referenced_type.to_s)} to #{link_to "favourites", user_path(log_entry.culprit_id) + "/favourites"}."]
             end
           rescue ActiveRecord::RecordNotFound
             # do nothing, but don't display the news entry for missing bookmark / object
@@ -1945,7 +1946,7 @@
             authorized = ( my_event || object.authorized?("view", current_viewer) )
             
             if authorized
-              rtn << [timestamp, "#{culprit_link} #{link_to_unless reviewed_link.nil?, "reviewed", reviewed_link} #{link_to object_visible_name, object_path} #{model_visible_name(log_entry.referenced_type.to_s)}#{review_title_link}."]
+              rtn << [timestamp, "#{culprit_link} #{link_to_unless reviewed_link.nil?, (reviewed_link.nil? ? "<span class='news_feed_action'>reviewed</span>" : "reviewed"), reviewed_link} #{link_to object_visible_name, object_path} #{model_visible_name(log_entry.referenced_type.to_s)}#{review_title_link}."]
             end
           rescue ActiveRecord::RecordNotFound
             # do nothing, but don't display the news entry for missing review / object
@@ -1981,7 +1982,7 @@
             end
             
             if authorized
-              rtn << [timestamp, "#{culprit_link} credited #{credited_whom} for #{link_to object_visible_name, object_path} #{model_visible_name(object.class.to_s)}."]
+              rtn << [timestamp, "#{culprit_link} <span class='news_feed_action'>credited</span> #{credited_whom} for #{link_to object_visible_name, object_path} #{model_visible_name(object.class.to_s)}."]
             end
           rescue ActiveRecord::RecordNotFound
             # do nothing, but don't display the news entry for missing creditation / object
@@ -2006,7 +2007,7 @@
             authorized = ( my_event || attributed_to.authorized?("view", current_viewer) )
             
             if authorized
-              rtn << [timestamp, "#{culprit_link} attributed #{link_to attributed_what_visible_name, attributed_what_path} #{model_visible_name(attributed_what.class.to_s)} to #{link_to attributed_to_visible_name, attributed_to_path} #{model_visible_name(attributed_to.class.to_s)}."]
+              rtn << [timestamp, "#{culprit_link} <span class='news_feed_action'>attributed</span> #{link_to attributed_what_visible_name, attributed_what_path} #{model_visible_name(attributed_what.class.to_s)} to #{link_to attributed_to_visible_name, attributed_to_path} #{model_visible_name(attributed_to.class.to_s)}."]
             end
           rescue ActiveRecord::RecordNotFound
             # do nothing, but don't display the news entry for missing creditation / object
@@ -2025,7 +2026,7 @@
             authorized = ( my_event || object.authorized?("view", current_viewer) )
             
             if authorized
-              rtn << [timestamp, "#{culprit_link} tagged #{link_to object_visible_name, object_path} #{model_visible_name(log_entry.referenced_type.to_s)} with \"#{link_to tag.name, tag_path(tag.id)}\"."]
+              rtn << [timestamp, "#{culprit_link} <span class='news_feed_action'>tagged</span> #{link_to object_visible_name, object_path} #{model_visible_name(log_entry.referenced_type.to_s)} with \"#{link_to tag.name, tag_path(tag.id)}\"."]
             end
           rescue ActiveRecord::RecordNotFound
             # do nothing, but don't display the news entry for missing tagging / tag / object
@@ -2047,7 +2048,7 @@
             authorized = ( my_event || object.authorized?("view", current_viewer) )
             
             if authorized
-              rtn << [timestamp, "#{culprit_link} added #{link_to "citation", workflow_citation_path(object.id, citation.id)} for #{link_to object_visible_name, object_path} #{model_visible_name(log_entry.referenced_type.to_s)}."]
+              rtn << [timestamp, "#{culprit_link} <span class='news_feed_action'>added</span> #{link_to "citation", workflow_citation_path(object.id, citation.id)} for #{link_to object_visible_name, object_path} #{model_visible_name(log_entry.referenced_type.to_s)}."]
             end
           rescue ActiveRecord::RecordNotFound
              # do nothing, but don't display the news entry for missing citation / cited item
@@ -2057,7 +2058,7 @@
       when "PictureSelection"
         # TODO: how to check that picture selection is still valid?
         # anyone can see picture selections of others (news only generated for friends / user's networks' members anyway)
-        rtn << [timestamp, "#{culprit_link} selected a new profile picture #{link_to image_tag(avatar_url(log_entry.referenced_id, 50), :alt => h(culprit.name)), user_path(log_entry.culprit_id)}."]
+        rtn << [timestamp, "#{culprit_link} <span class='news_feed_action'>selected</span> a new profile picture.<br/>#{link_to image_tag(avatar_url(log_entry.referenced_id, 50), :alt => h(culprit.name), :class => 'framed', :style => "vertical-align:text-top; margin: 0.2em 0;"), user_path(log_entry.culprit_id)}"]
       
       when "Profile"
         case action
@@ -2066,7 +2067,7 @@
           when "update"
             # only friends of the user will see this event
             if my_event || (logged_in? && current_viewer.friend?(log_entry.culprit_id))
-              rtn << [timestamp, "#{culprit_link} has updated their #{link_to "profile", user_path(log_entry.culprit_id)}."]
+              rtn << [timestamp, "#{culprit_link} has <span class='news_feed_action'>updated</span> their #{link_to "profile", user_path(log_entry.culprit_id)}."]
             end
         end
         
@@ -2078,7 +2079,7 @@
             user_link = name(log_entry.activity_loggable_id)
             return nil if user_link.nil?
             
-            rtn << [timestamp, "#{user_link} joined #{link_to "myExperiment", "/"}."]
+            rtn << [timestamp, "#{user_link} <span class='news_feed_action'>joined</span> #{link_to "myExperiment", "/"}."]
           when "update"
             # for now this event is not shown to anyone - event to the user themself,
             # partly because every time when user logs in "last seen" field is set, which
@@ -2105,7 +2106,7 @@
             end
             
             # anyone allowed to see site announcements
-            rtn << [timestamp, "#{culprit_link} made a #{link_to_unless ann_link.nil?, "site announcement", ann_link}#{ann_title_link}."]
+            rtn << [timestamp, "#{culprit_link} <span class='news_feed_action'>made</span> a #{link_to_unless ann_link.nil?, "site announcement", ann_link}#{ann_title_link}."]
           rescue ActiveRecord::RecordNotFound
             # do nothing, but don't display the news entry for missing site announcement
           end

Modified: branches/event_logging/app/views/layouts/_news.rhtml (1913 => 1914)


--- branches/event_logging/app/views/layouts/_news.rhtml	2008-10-31 14:37:27 UTC (rev 1913)
+++ branches/event_logging/app/views/layouts/_news.rhtml	2008-10-31 16:58:29 UTC (rev 1914)
@@ -10,13 +10,14 @@
 				<%= timeago_fuzzy news_day[0] %>
       <% end %>
     </p>
-    <ul class="news_feed_day">
+		<table class="news_feed_day">
       <% news_day[1].each do |news_item| %>
-        <li class="news_feed_item">
-          <%= news_item %>
-        </li>
+				<tr>
+					<td><%= news_item[0] -%></td>
+					<td style="text-align: left;"><%= news_item[1] -%></td>
+				</tr>
       <% end %>
-    </ul>
+		</table>
   <% end %>
   </div>
 <% else %>

Modified: branches/event_logging/public/stylesheets/styles.css (1913 => 1914)


--- branches/event_logging/public/stylesheets/styles.css	2008-10-31 14:37:27 UTC (rev 1913)
+++ branches/event_logging/public/stylesheets/styles.css	2008-10-31 16:58:29 UTC (rev 1914)
@@ -747,18 +747,27 @@
 	border-bottom: 1px dotted #999999;
 }
 
-.news_feed_div ul.news_feed_day {
+.news_feed_div table.news_feed_day {
+	margin-top: 0.3em;
 	padding-left: 0.8em;
-	list-style-type: none;
-	margin-top: 0.4em;
-	margin-left: 0.5em;
-	margin-bottom: 0.5em;
+}
+
+.news_feed_div table.news_feed_day td {
+	font-size: 93%;
+	vertical-align: top;
 	line-height: 1.4;
+	padding-top: 0.2em;
+	padding-bottom: 0.2em;
 }
 
-.news_feed_div ul.news_feed_day li.news_feed_item {
-	list-style: none;
+.news_feed_div table.news_feed_day a {
+	font-weight: regular;
+}
+
+.news_feed_action{
 	font-size: 93%;
+	font-weight: bold;
+	color: #990000;
 }
 
 /* end css newsfeed */

reply via email to

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