myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [3530] trunk: news feed source filtering and vari


From: noreply
Subject: [myexperiment-hackers] [3530] trunk: news feed source filtering and various style tweaks
Date: Wed, 8 May 2013 13:44:29 +0000 (UTC)

Revision
3530
Author
dgc
Date
2013-05-08 13:44:28 +0000 (Wed, 08 May 2013)

Log Message

news feed source filtering and various style tweaks

Modified Paths

Diff

Modified: trunk/app/helpers/activities_helper.rb (3529 => 3530)


--- trunk/app/helpers/activities_helper.rb	2013-05-07 14:06:29 UTC (rev 3529)
+++ trunk/app/helpers/activities_helper.rb	2013-05-08 13:44:28 UTC (rev 3530)
@@ -80,25 +80,25 @@
     type_bits = []
     type_vars = []
 
+    type_bits << "(activities.objekt_type = 'Network' AND activities.action = '')"
+    type_bits << "(activities.objekt_type = 'FeedItem' AND activities.action = '')"
+    type_bits << "(activities.objekt_type = 'Permission' AND activities.action = '')"
+    type_bits << "(activities.objekt_type = 'Comment' AND activities.action = '')"
+    type_bits << "(activities.objekt_type = 'GroupAnnouncement' AND activities.action = '')"
+    type_bits << "(activities.objekt_type = 'Membership' AND activities.action = '')"
+
     # Create the conditions
 
-    conditions_bits = []
-    conditions_vars = []
-
-    unless context_bits.empty?
-      conditions_bits << "(" + context_bits.join(" OR ") + ")"
-      conditions_vars += context_vars
+    if (context_bits.empty? && type_bits.empty?)
+      conditions = nil
+    elsif (!context_bits.empty? && type_bits.empty?)
+      conditions = ["(" + context_bits.join(" OR ") + ")", *context_vars]
+    elsif (context_bits.empty? && !type_bits.empty?)
+      conditions = ["(" + type_bits.join(" OR ") + ")", *type_vars]
+    else
+      conditions = ["((" + context_bits.join(" OR ") + ") AND (" + type_bits.join(" OR ") + "))", *(context_vars + type_vars)]
     end
 
-    unless type_bits.empty?
-      conditions_bits << "(" + type_bits.join(" OR ") + ")"
-      conditions_vars += type_vars
-    end
-
-    if context_bits.length > 0
-      conditions = [context_bits.join(" AND "), *context_vars]
-    end
-
     order = 'featured DESC, timestamp DESC, priority ASC'
 
     activities = Authorization.scoped(Activity,
@@ -116,6 +116,14 @@
       break if incoming.length == 0
 
       incoming.each do |activity|
+
+        # Special case for group announcements as they can be made private.
+
+        if activity.objekt.kind_of?(GroupAnnouncement) && !activity.objekt.public
+          next unless logged_in?
+          next unless activity.objekt.network.member?(current_user.id)
+        end
+
         if results.length > 0 && !opts[:no_combine] && combine_activities?(activity, results.last.first)
           results.last << activity
         else
@@ -267,8 +275,11 @@
     when "WorkflowVersion create"
       "<div style='float: left; width: 64px'>#{link_to(image_tag(workflow_version_preview_path(activity.objekt.workflow, activity.objekt.version, 'thumb'), :width => 64, :height => 64), workflow_version_path(activity.objekt.workflow, activity.objekt.version))}</div><div class='activity-text'>#{white_list(activity.objekt.revision_comments)}</div>"
     when "Permission create"
-      if activity.auth.class == Workflow
+      case activity.auth
+      when Workflow
         "<div><div style='float: left; margin: 6px'>#{link_to(image_tag(workflow_preview_path(activity.auth, 'thumb'), :width => 64, :height => 64), workflow_path(activity.auth))}</div>#{activity_text_summary(activity.auth.body_html, :min_chars => min_chars)}<div style='clear: both'></div></div>"
+      when Blob, Pack
+        "<div>#{activity_text_summary(activity.auth.body_html, :min_chars => min_chars)}</div>"
       end
     when "FeedItem create"
       "<div class='summary'>#{activity_text_summary(activity.objekt.content, :min_chars => min_chars)}</div>"
@@ -276,5 +287,15 @@
       activity_text_summary(activity.objekt.body_html, :min_chars => min_chars)
     end
   end
+
+  def activity_extra(activity_set, opts = {})
+
+    activity = activity_set.first
+
+    case activity.objekt ? "#{activity.objekt_type} #{activity.action}" : activity.action
+    when "FeedItem create"
+      "<div class='extra'>Content via #{link_to(h(activity.objekt.feed.uri), activity.objekt.feed.uri)}</div>"
+    end
+  end
 end
 

Modified: trunk/app/views/activities/_activity.rhtml (3529 => 3530)


--- trunk/app/views/activities/_activity.rhtml	2013-05-07 14:06:29 UTC (rev 3529)
+++ trunk/app/views/activities/_activity.rhtml	2013-05-08 13:44:28 UTC (rev 3530)
@@ -7,6 +7,7 @@
     <div class="activity-column">
       <%= activity_title(activity_set) -%>
       <%= activity_description(activity_set) -%>
+      <%= activity_extra(activity_set) -%>
       <% if activity_set.length == 1 %>
         <div class="actions">
           <% if enable_feature %>
@@ -22,10 +23,12 @@
               <% end %>
             <% end %>
           <% end %>
-          <% if (activity.comments.length == 0) && (activity_set.length == 1) %>
-            <span><a href=""  activity.id -%>').style.display = 'block'; return false;">Comment</a></span>
-          <% else %>
-            <span>Comment</span>
+          <% if Authorization.check('create', Comment, user, activity.context) %>
+            <% if (activity.comments.length == 0) && (activity_set.length == 1) %>
+              <span><a href=""  activity.id -%>').style.display = 'block'; return false;">Comment</a></span>
+            <% else %>
+              <span>Comment</span>
+            <% end %>
           <% end %>
           <span class="date"><%= datetime(activity.timestamp) -%></span>
         </div>

Modified: trunk/public/_javascript_s/tabs.js (3529 => 3530)


--- trunk/public/_javascript_s/tabs.js	2013-05-07 14:06:29 UTC (rev 3529)
+++ trunk/public/_javascript_s/tabs.js	2013-05-08 13:44:28 UTC (rev 3530)
@@ -1,7 +1,5 @@
 // tabs.js
 
-var tabImagesRoot = '/images/tabs/';
-
 function parent_el(el) {
 
   if (el.parentElement != undefined)
@@ -24,46 +22,31 @@
 
 function selectTab(tabsDiv, t) {
 
-  var html = '<table cellspacing=0 cellpadding=0><tr>';
+  var html = '';
 
-  if (tabsDiv.titles.length > 0)
-    html += '<td><img class="tabSeparator" src="" + tabImagesRoot + '/tab_separator.png"></td>';
-
   for (var i = 0; i < tabsDiv.titles.length; i++) {
 
     if (i == t) {
 
       tabsDiv.panes[i].style.display = 'block';
 
-      html += '<td class="tabSelIMG"><img src="" + tabImagesRoot;
-      html += '/selected_tab_start.png"></td>';
-      html += '<td class="tabSelected"><span 
+      html += '<span class="tab selected" 
       html += '_javascript_:return false;">';
-      html += tabsDiv.titles[i];
-      html += '</span></td>';
-      html += '<td class="tabSelIMG"><img src="" + tabImagesRoot;
-      html += '/selected_tab_end.png"></td>';
+      html += '<span class="inner">' + tabsDiv.titles[i] + '</span>';
+      html += '</span>';
 
     } else {
 
       tabsDiv.panes[i].style.display = 'none';
 
-      html += '<td class="tabUnselIMG"><img src="" + tabImagesRoot;
-      html += '/unselected_tab_start.png"></td>';
-      html += '<td class="tabUnselected"><span 
-      html += '_javascript_:selectTab(parent_el(parent_el(parent_el(parent_el(parent_el(this))))), ' + i +
+      html += '<span class="tab unselected" 
+      html += '_javascript_:selectTab(parent_el(this), ' + i +
           '); return false;">';
-      html += tabsDiv.titles[i];
-      html += '</span></td>';
-      html += '<td class="tabUnselIMG"><img src="" + tabImagesRoot;
-      html += '/unselected_tab_end.png"></td>';
+      html += '<span class="inner">' + tabsDiv.titles[i] + '</span>';
+      html += '</span>';
     }
-
-    html += '<td><img class="tabSeparator" src="" + tabImagesRoot + '/tab_separator.png"></td>';
   }
 
-  html += '</td></tr></table>';
-
   tabsDiv.innerHTML = html;
 }
 

Modified: trunk/public/stylesheets/styles.css (3529 => 3530)


--- trunk/public/stylesheets/styles.css	2013-05-07 14:06:29 UTC (rev 3529)
+++ trunk/public/stylesheets/styles.css	2013-05-08 13:44:28 UTC (rev 3530)
@@ -668,63 +668,50 @@
 	border: 0;
 	position: relative;
 	top: 1px;
+  padding-top: 6px;
+  padding-bottom: 6px;
 }
 
-.tabsContainer IMG {
-	border: 0;
-	margin: 0;
-	padding: 0;
-	vertical-align: middle;
+.tabsContainer .unselected {
+	border-bottom: 1px solid #909090;
+	color: #333333;
+	background: #d8d8d8;
 }
 
-.tabsContainer TABLE {
-	height: 24px;
-	border-spacing: 0;
+.tabsContainer .selected {
+  background: white;
 }
 
-.tabsContainer TABLE TR TD {
-	padding: 0;
-	vertical-align: middle;
-}
-
-.tabSeparator {
-  width: 1px;
-}
-
-.tabSelected {
+.tabsContainer .tab {
+  border-radius: 6px 6px 0px 0px;
+  -moz-border-radius: 6px 6px 6px 6px;
+  -webkit-border-top-left-radius: 6px;
+  -webkit-border-top-right-radius: 6px;
 	border-top: 1px solid #909090;
-	border-bottom: 1px solid white;
-	padding: 0;
-	padding-left: 0.5em;
-	padding-right: 0.5em;
-	vertical-align: middle;
+	border-left: 1px solid #909090;
+	border-right: 1px solid #909090;
+	padding-top: 4px;
+	padding-bottom: 4px;
+	padding-left: 0px;
+	padding-right: 0px;
 	white-space: nowrap;
 	pointer: pointer;
 	cursor: pointer;
+  margin-right: -1px;
 }
 
-.tabUnselected {
-	border-top: 1px solid #909090;
-	border-bottom: 1px solid #909090;
-	color: #333333;
-	background: #d8d8d8;
-	padding: 0;
-	padding-left: 0.5em;
-	padding-right: 0.5em;
-	vertical-align: middle;
-	white-space: nowrap;
-	pointer: pointer;
-	cursor: pointer;
+.tabsContainer .tab .inner {
+  padding-left: 6px;
+  padding-right: 6px;
+  padding-bottom: 4px;
 }
 
-.tabSelIMG {
-	border-bottom: 1px solid white;
-  width: 6px;
+.tabsContainer .unselected .inner {
+  border-bottom: 1px solid #909090;
 }
 
-.tabUnselIMG {
-	border-bottom: 1px solid #909090;
-  width: 6px;
+.tabsContainer .selected .inner {
+  border-bottom: 1px solid white;
 }
 
 .tabTitle {
@@ -1280,6 +1267,9 @@
 
 .addCommentBox {
 	background-color: #E8E8E8;
+  width: 510px;
+  padding: 8px;
+  margin: 8px;
 }
 
 .addCommentBox TEXTAREA {
@@ -1294,7 +1284,7 @@
 .activityCommentBox {
   padding: 4px;
 	background-color: #E8E8E8;
-  width: 400px;
+  width: 380px;
 }
 
 .activityCommentBox + .activityCommentBox {
@@ -2502,6 +2492,10 @@
   border: 1px dotted #999999;
 }
 
+.activity-feed LI.featured .activityCommentBox {
+	background-color: #E8E8C0;
+}
+
 .activity .avatar-column {
   width: 64px;
   float: left;
@@ -2535,6 +2529,12 @@
   font-size: 8pt;
 }
 
+.activity .extra {
+  color: gray;
+  margin-bottom: 4px;
+  font-size: 8pt;
+}
+
 .activity .actions INPUT {
   display: inline;
   border: none;

reply via email to

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