myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [3123] branches/events: various changes to activi


From: noreply
Subject: [myexperiment-hackers] [3123] branches/events: various changes to activities and style
Date: Mon, 10 Sep 2012 09:00:39 +0000 (UTC)

Revision
3123
Author
dgc
Date
2012-09-10 09:00:38 +0000 (Mon, 10 Sep 2012)

Log Message

various changes to activities and style

Modified Paths

Added Paths

Diff

Modified: branches/events/Rakefile (3122 => 3123)


--- branches/events/Rakefile	2012-09-06 15:07:53 UTC (rev 3122)
+++ branches/events/Rakefile	2012-09-10 09:00:38 UTC (rev 3123)
@@ -387,6 +387,24 @@
         :created_at => object.created_at)
   end
 
+  Network.all.each do |object|
+
+    activities << Activity.new(
+        :subject => object.owner,
+        :action ="" 'create',
+        :objekt => object,
+        :created_at => object.created_at)
+
+    if object.updated_at && object.updated_at != object.created_at
+
+      activities << Activity.new(
+          :subject => object.owner,
+          :action ="" 'edit',
+          :objekt => object,
+          :created_at => object.updated_at)
+    end
+  end
+
   activities.sort! do |a, b|
     a.created_at <=> b.created_at
   end

Modified: branches/events/app/controllers/comments_controller.rb (3122 => 3123)


--- branches/events/app/controllers/comments_controller.rb	2012-09-06 15:07:53 UTC (rev 3122)
+++ branches/events/app/controllers/comments_controller.rb	2012-09-10 09:00:38 UTC (rev 3123)
@@ -45,7 +45,7 @@
     
     respond_to do |format|
       if ajaxy
-        format.html { render :partial => "comments/comments", :locals => { :commentable => @context } }
+        format.html { render :partial => "workflows/activities", :locals => { :object => @context } }
       else
         format.html { redirect_to rest_resource_uri(@context) }
       end

Modified: branches/events/app/controllers/friendships_controller.rb (3122 => 3123)


--- branches/events/app/controllers/friendships_controller.rb	2012-09-06 15:07:53 UTC (rev 3122)
+++ branches/events/app/controllers/friendships_controller.rb	2012-09-10 09:00:38 UTC (rev 3123)
@@ -40,6 +40,7 @@
     
     respond_to do |format|
       if @friendship.accept!
+        Activity.create(:subject => User.find(from_id), :action ="" 'create', :objekt => @friendship)
         flash[:notice] = 'Friendship was successfully accepted.'
         format.html { redirect_to user_friendships_url(current_user.id) }
       else

Modified: branches/events/app/controllers/networks_controller.rb (3122 => 3123)


--- branches/events/app/controllers/networks_controller.rb	2012-09-06 15:07:53 UTC (rev 3122)
+++ branches/events/app/controllers/networks_controller.rb	2012-09-10 09:00:38 UTC (rev 3123)
@@ -378,6 +378,7 @@
 
     respond_to do |format|
       if @network.save
+        Activity.create(:subject => current_user, :action ="" 'create', :objekt => @network)
         if params[:network][:tag_list]
           @network.tags_user_id = current_user
           @network.tag_list = convert_tags_to_gem_format params[:network][:tag_list]
@@ -395,6 +396,7 @@
   def update
     respond_to do |format|
       if @network.update_attributes(params[:network])
+        Activity.create(:subject => current_user, :action ="" 'edit', :objekt => @network)
         @network.refresh_tags(convert_tags_to_gem_format(params[:network][:tag_list]), current_user) if params[:network][:tag_list]
         flash[:notice] = 'Group was successfully updated.'
         format.html { redirect_to network_url(@network) }

Modified: branches/events/app/controllers/workflows_controller.rb (3122 => 3123)


--- branches/events/app/controllers/workflows_controller.rb	2012-09-06 15:07:53 UTC (rev 3122)
+++ branches/events/app/controllers/workflows_controller.rb	2012-09-10 09:00:38 UTC (rev 3123)
@@ -7,7 +7,7 @@
 
   include ApplicationHelper
 
-  before_filter :login_required, :except => [:index, :show, :download, :named_download, :galaxy_tool, :galaxy_tool_download, :statistics, :launch, :search, :auto_complete]
+  before_filter :login_required, :except => [:index, :show, :download, :named_download, :galaxy_tool, :galaxy_tool_download, :statistics, :launch, :search, :auto_complete, :activities]
   
   before_filter :store_callback, : [:index, :search]
   before_filter :find_workflows_rss, : [:index]
@@ -691,6 +691,12 @@
     render :partial => 'contributions/autocomplete_list', :locals => { :contributions => wfs }
   end
 
+  def activities
+    if params[:embed] == "yes"
+      render(:partial => "workflows/activities")
+    end
+  end
+
 protected
 
   def store_callback
@@ -723,6 +729,7 @@
   def find_workflow_auth
 
     action_permissions = {
+      "activities"              => "view",
       "create"                  => "create",
       "create_version"          => "edit",
       "destroy"                 => "destroy",

Modified: branches/events/app/helpers/application_helper.rb (3122 => 3123)


--- branches/events/app/helpers/application_helper.rb	2012-09-06 15:07:53 UTC (rev 3122)
+++ branches/events/app/helpers/application_helper.rb	2012-09-10 09:00:38 UTC (rev 3123)
@@ -56,7 +56,11 @@
       rtn = Time.at(old_dt.time)
     end
     
-    return long ? rtn.strftime("%A %d %B %Y @ %H:%M:%S (%Z)") : rtn.strftime("%d/%m/%y @ %H:%M:%S")
+    if long
+      "<span title='#{rtn.strftime("%A %d %B %Y @ %H:%M:%S (%Z)")}'>#{rtn.strftime("%A %d %B %Y @ %H:%M:%S (%Z)")}</span>"
+    else
+      "<span title='#{rtn.strftime("%d/%m/%y @ %H:%M:%S")}'>#{rtn.strftime("%d/%m/%y")}</span>"
+    end
   end
   
   def date(old_dt, long=true)
@@ -547,38 +551,6 @@
 
   def activity_feed(opts = {})
 
-    def link_aux(thing, label)
-
-      thing = thing.versioned_resource if thing.respond_to?(:versioned_resource)
-
-      case thing.class.name
-        when "Bookmark"
-          thing = thing.bookmarkable
-        when "Comment"
-          thing = thing.commentable
-        when "Citation"
-          thing = thing.workflow
-      end
-
-      if thing
-        link_to(label, polymorphic_path(thing))
-      else
-        h(label)
-      end
-    end
-
-    def subject_link(activity)
-      link_aux(activity.subject, activity.subject_label)
-    end
-
-    def objekt_link(activity)
-      link_aux(activity.objekt, activity.objekt_label)
-    end
-
-    def auth_link(activity)
-      link_aux(activity.auth, activity.auth.label)
-    end
-
     conditions_expr     = []
     conditions_operands = []
 
@@ -600,6 +572,18 @@
       conditions_operands << opts[:auth].id
     end
 
+    if opts[:include]
+      conditions_expr     << "activities.objekt_type IN (?)"
+      conditions_operands << opts[:include]
+    end
+
+    case opts[:filter]
+      when "comments"
+        conditions_expr << "activities.objekt_type = 'Comment'"
+      when "versions"
+        conditions_expr << "activities.objekt_type = 'WorkflowVersion'"
+    end
+
     unless conditions_expr.empty?
       conditions_expr = conditions_expr.map do |cond| "(#{cond})" end.join(' AND ')
       conditions = [conditions_expr] + conditions_operands
@@ -618,47 +602,39 @@
 
     markup = '<ol class="activity-feed">'
 
-    markup << activities.map do |activity|
+    activities
+  end
 
-      action = "" activity.objekt
-        "#{activity.objekt_type} #{activity.action}"
-      else
-        "#{activity.action}"
-      end
+  def activity_link(activity, source)
 
-      sentence = case action
-        when "Announcement create":    "#{subject_link(activity)} announced #{objekt_link(activity)}"
-        when "Announcement edit":      "#{subject_link(activity)} edited #{objekt_link(activity)}"
-        when "Blob create":            "#{subject_link(activity)} uploaded #{objekt_link(activity)}"
-        when "Blob edit":              "#{subject_link(activity)} edited #{objekt_link(activity)}"
-        when "BlobVersion create":     "#{subject_link(activity)} uploaded a new version of #{objekt_link(activity)}"
-        when "BlobVersion edit":       "#{subject_link(activity)} edited version #{activity.extra} of #{objekt_link(activity)}"
-        when "Bookmark create":        "#{subject_link(activity)} favourited #{objekt_link(activity)}"
-        when "Citation create":        "#{subject_link(activity)} added the citation #{objekt_link(activity)} to #{auth_link(activity)}"
-        when "Citation edit":          "#{subject_link(activity)} edited the citation #{objekt_link(activity)} on #{auth_link(activity)}"
-        when "Comment create":         "#{subject_link(activity)} commented on #{objekt_link(activity)}"
-        when "Pack create":            "#{subject_link(activity)} created #{objekt_link(activity)}"
-        when "Pack edit":              "#{subject_link(activity)} edited #{objekt_link(activity)}"
-        when "Rating create":          "#{subject_link(activity)} rated #{auth_link(activity)} with #{activity.extra}"
-        when "Review create":          "#{subject_link(activity)} added a review on #{auth_link(activity)}"
-        when "Review edit":            "#{subject_link(activity)} edited a review on #{auth_link(activity)}"
-        when "Tagging create":         "#{subject_link(activity)} tagged #{auth_link(activity)} with &quot;#{activity.objekt.tag.name}&quot;"
-        when "Workflow create":        "#{subject_link(activity)} uploaded #{objekt_link(activity)}"
-        when "Workflow edit":          "#{subject_link(activity)} edited #{objekt_link(activity)}"
-        when "WorkflowVersion create": "#{subject_link(activity)} uploaded a new version of #{objekt_link(activity)}"
-        when "WorkflowVersion edit":   "#{subject_link(activity)} edited version #{activity.extra} of #{objekt_link(activity)}"
-        when "register":               "#{subject_link(activity)} joined #{Conf.sitename}"
-        when "edit":                   "#{subject_link(activity)} edited their profile"
-        else "Unknown activity"
-      end
+    case source
+    when :subject
+      thing = activity.subject
+      label = activity.subject_label
+    when :object
+      thing = activity.objekt
+      label = activity.objekt_label
+    when :auth
+      thing = activity.auth
+      label = activity.auth.label
+    end
 
-      "<li>#{sentence}.</li>"
+    thing = thing.versioned_resource if thing.respond_to?(:versioned_resource)
 
-    end.join
+    case thing.class.name
+      when "Bookmark"
+        thing = thing.bookmarkable
+      when "Comment"
+        thing = thing.commentable
+      when "Citation"
+        thing = thing.workflow
+    end
 
-    markup << '</ol>'
-
-    markup
+    if thing
+      link_to(label, polymorphic_path(thing))
+    else
+      h(label)
+    end
   end
 
   def news(contributor, restrict_contributor=true, before=Time.now, after=Time.now-1.week, limit=30)

Modified: branches/events/app/helpers/contributions_helper.rb (3122 => 3123)


--- branches/events/app/helpers/contributions_helper.rb	2012-09-06 15:07:53 UTC (rev 3122)
+++ branches/events/app/helpers/contributions_helper.rb	2012-09-10 09:00:38 UTC (rev 3123)
@@ -4,4 +4,10 @@
 # See license.txt for details.
 
 module ContributionsHelper
+
+  def describe_version(version_number, version_count)
+    return "" if version_count < 2
+    return "(of #{version_count})"
+  end
+
 end

Modified: branches/events/app/models/comment.rb (3122 => 3123)


--- branches/events/app/models/comment.rb	2012-09-06 15:07:53 UTC (rev 3122)
+++ branches/events/app/models/comment.rb	2012-09-10 09:00:38 UTC (rev 3123)
@@ -4,14 +4,11 @@
 # See license.txt for details.
 
 class Comment < ActiveRecord::Base
+
   belongs_to :commentable, :polymorphic => true
-  
-  # NOTE: install the acts_as_votable plugin if you 
-  # want user to vote on the quality of comments.
-  #acts_as_voteable
-  
-  # NOTE: Comments belong to a user
   belongs_to :user
+
+  has_many :activities, :as => :objekt, :dependent => :destroy
   
   acts_as_solr :fields => [ :comment ] if Conf.solr_enable
   

Added: branches/events/app/views/activities/_activities.rhtml (0 => 3123)


--- branches/events/app/views/activities/_activities.rhtml	                        (rev 0)
+++ branches/events/app/views/activities/_activities.rhtml	2012-09-10 09:00:38 UTC (rev 3123)
@@ -0,0 +1,7 @@
+<ol class="activity-feed">
+  <% activities.each do |activity| %>
+    <li>
+      <%= render(:partial => "activities/activity", :locals => { :activity => activity } ) -%>
+    </li>
+  <% end %>
+</ol>

Added: branches/events/app/views/activities/_list.rhtml (0 => 3123)


--- branches/events/app/views/activities/_list.rhtml	                        (rev 0)
+++ branches/events/app/views/activities/_list.rhtml	2012-09-10 09:00:38 UTC (rev 3123)
@@ -0,0 +1,16 @@
+<% if Authorization.check('create', Comment, current_user, context) %>
+  <div class="addCommentBox">
+    <% form_remote_tag(
+        :url =""      polymorphic_path(context) + "/comments",
+        :update =>   'activities', 
+        :loading =>  "Element.show('addcomment_indicator')",
+        :complete => "Element.hide('addcomment_indicator'); new Effect.Highlight('activities', { duration: 1.5 }); $('comment').value = '';") do %>
+      <%= text_area_tag("comment[comment]") -%>
+      <br/>
+      <%= submit_tag "Post comment" %>
+      <%= image_tag "/images/spinner.gif", :id => "addcomment_indicator", :style => "margin-left: 1em; display: none;" %>
+    <% end %>
+  </div>
+<% end %>
+
+<%= render(:partial => "activities/activities", :locals => { :activities => activities } ) -%>

Modified: branches/events/app/views/contributions/_uploader_box.rhtml (3122 => 3123)


--- branches/events/app/views/contributions/_uploader_box.rhtml	2012-09-06 15:07:53 UTC (rev 3122)
+++ branches/events/app/views/contributions/_uploader_box.rhtml	2012-09-10 09:00:38 UTC (rev 3123)
@@ -8,4 +8,9 @@
 			<%= contributor(contributable.contribution.contributor_id, contributable.contribution.contributor_type, true, 60) %>
 		</center>
 	</p>
+
+	<p class="metadata-datetime">Created on <%= datetime(contributable.contribution.created_at, false) -%></p>
+	<% if contributable.contribution.created_at != contributable.contribution.updated_at %>
+    <p class="metadata-datetime">Updated on <%= datetime(contributable.contribution.updated_at, false) -%></p>
+  <% end %>
 </div>

Modified: branches/events/app/views/contributions/_version_selector.rhtml (3122 => 3123)


--- branches/events/app/views/contributions/_version_selector.rhtml	2012-09-06 15:07:53 UTC (rev 3122)
+++ branches/events/app/views/contributions/_version_selector.rhtml	2012-09-10 09:00:38 UTC (rev 3123)
@@ -6,66 +6,52 @@
   }
 </script>
 
-<div class="contribution_version_selector_box">
+<div class="contribution_section_box">
 
-  <table>
-    <tbody>
-      <tr>
-        <td class="heading" style="vertical-align: top;">
-          <%= info_icon_with_tooltip("This box shows version #{version.version.to_s} for this entry") -%>
-          <span><%= "Version #{version.version.to_s} #{resource.describe_version(version.version)}" -%></span>
-          <span class="count_text">(of <%= resource.versions.length -%>)</span>
-          <a name="versions"></a>
-        </td>
-        <td>
-          <% if resource.versions.length > 1 %>
-             <form  return false;" style="text-align: right;">
-              <b>View version: </b>
-              <select id="resource_versions" 
-                <% resource.versions.reverse.each do |v| %>
-                  <option value="<%= send(path, resource, v.version.to_s) %>" <%= "selected" if v.version == version.version -%>>
-                      <%= "#{v.version.to_s} #{resource.describe_version(v.version)}" %>
-                  </option>
-                <% end %>
-              </select>
-            </form>
+  <%
+    if resource.versions.length == 1
+      title = "Information"
+    else
+      title = "Version Information"
+    end
+  %>
+
+  <p class="heading"><%= info_icon_with_tooltip("Information about this particular version") -%> <%= title -%></p>
+
+  <% if resource.versions.length > 1 %>
+    <form  return false;" style="text-align: right;">
+      <p>
+        Version
+        <select id="resource_versions" 
+          <% resource.versions.reverse.each do |v| %>
+            <option value="<%= send(path, resource, v.version.to_s) %>" <%= "selected" if v.version == version.version -%>>
+                <%= "#{v.version.to_s} #{describe_version(v.version, resource.versions.length)}" %>
+            </option>
           <% end %>
-        </td>
-      </tr>
-    </tbody>
-  </table>
+        </select>
+      </p>
+    </form>
+  <% end %>
       
-  <div id="version_info_box" style="color: #666666;  font-size: 85%; margin: 0.6em 0.5em 0.2em 0.5em; border-top: 1px solid #DDDDDD; padding-top: 0.4em;">
-    <p style="text-align: center;">
-      <b>Version created on:</b>
-      <span><%= datetime version.created_at, false %></span>
-      <% if version.respond_to?(:contributor_id) && version.respond_to?(:contributor_type) %>
-        <b>by:</b>
-        <span><%= contributor(version.contributor_id, version.contributor_type) %></span>
+  <% if resource.respond_to?(:content_type) %>
+    <p class="workflow-type">Type: <%= link_to(h(@viewing_version.content_type.title), content_type_path(@viewing_version.content_type)) %></p>
+  <% end %>
+
+  <p class="metadata-datetime">
+    Created on
+    <span><%= datetime version.created_at, false %></span>
+    <% if version.respond_to?(:contributor_id) && version.respond_to?(:contributor_type) %>
+      <br />by <span><%= contributor(version.contributor_id, version.contributor_type) %></span>
+    <% end %>
+  </p>
+
+  <% if version.created_at != version.updated_at %>
+    <p class="metadata-datetime">
+      Updated on
+      <span><%= datetime version.updated_at, false %></span>
+      <% if version.respond_to?(:last_edited_by) %>
+        <br />by <span><%= contributor(version.last_edited_by, "User") %></span>
       <% end %>
-      <% if !version.revision_comments.blank? %>
-        <span>&nbsp;&nbsp;|&nbsp;&nbsp;</span>
-        <span><%= link_to_function "Revision comment " + expand_image, visual_effect(:toggle_blind, "version_info_box_comments", :duration => 0.3) %></span>
-      <% end %>
     </p>
-    
-    <% unless version.created_at == version.updated_at %>
-      <p style="text-align: center;">
-        <b>Last edited on:</b>
-        <span><%= datetime version.updated_at, false %></span>
-        <% if version.respond_to?(:last_edited_by) %>
-          <b>by:</b>
-          <span><%= contributor(version.last_edited_by, "User") %></span>
-        <% end %>
-      </p>
-    <% end %>
-  </div>
-  
-  <% if !version.revision_comments.blank? -%>
-    <div id="version_info_box_comments" style="display: none; border: 1px dotted #CCCCCC; padding: 0.3em 0.5em;">
-      <%= white_list version.revision_comments %>
-    </div>
   <% end %>
-
 </div>
-

Modified: branches/events/app/views/home/index.rhtml (3122 => 3123)


--- branches/events/app/views/home/index.rhtml	2012-09-06 15:07:53 UTC (rev 3122)
+++ branches/events/app/views/home/index.rhtml	2012-09-10 09:00:38 UTC (rev 3123)
@@ -3,16 +3,10 @@
 	
 	<div class="left">
 		<%= render :partial => "announcements" %>
-		<%= render :partial => "latest_groups" %>
-		<%= render :partial => "latest_tags" %>
 	</div>
 	
 	<div class="right">
-		<%= render :partial => "news" %>
-		<%= render :partial => "updated_items" %>
-		<%= render :partial => "new_users" %>
-		<%= render :partial => "latest_reviews" %>
-		<%= render :partial => "latest_comments" %>
+    <%= render(:partial => "activities/list", :locals => { :activities => activity_feed(:include => ["Workflow", "WorkflowVersion", "Comment", "Review"]) }) -%>
 	</div>
 	
 	<div class="clearer">&nbsp;</div>

Modified: branches/events/app/views/users/show.rhtml (3122 => 3123)


--- branches/events/app/views/users/show.rhtml	2012-09-06 15:07:53 UTC (rev 3122)
+++ branches/events/app/views/users/show.rhtml	2012-09-10 09:00:38 UTC (rev 3123)
@@ -363,7 +363,7 @@
   <% case (@tab||"News"); when "News" %>
 
     <h3>Activity from <%=h @user.name -%></h3>
-    <%= activity_feed(:subject => @user) -%>
+    <%= render(:partial => "activities/list", :locals => { :activities => activity_feed(:subject => @user, :include => ["Workflow", "WorkflowVersion", "Comment", "Review"]), :context => @user }) -%>
 
   <% when "Friends" %>
 

Modified: branches/events/app/views/workflows/show.rhtml (3122 => 3123)


--- branches/events/app/views/workflows/show.rhtml	2012-09-06 15:07:53 UTC (rev 3122)
+++ branches/events/app/views/workflows/show.rhtml	2012-09-10 09:00:38 UTC (rev 3123)
@@ -19,8 +19,6 @@
 	Workflow Entry: <%=h @workflow.title %>
 </h1>
 
-<%= render :partial => "contributions/datetime_info", :locals => { :contributable => @workflow } -%>
-
 <div class="contribution_mini_nav">
   <ul class="link_list">
     <li><%= link_to "License", "#license" %></li>
@@ -40,63 +38,32 @@
     <li><%= link_to "Reviews (address@hidden)", "#reviews" %></li>
     <li><%= link_to "Comments (address@hidden)", "#comments" %></li>
   </ul>
+  <hr />
 </div>
 
-
 <div class="contribution_left_box">
 	
 	<div class="contribution_version_box">
 
-    <%= render(:partial => "contributions/version_selector", :locals => { :resource => @workflow, :version => @viewing_version, :path => :workflow_version_path }) %>
-
 		<div class="contribution_version_inner_box">
-			
+
+<% if false %>
 			<h3>
-				<%= info_icon_with_tooltip("This section shows the preview of this version of the Workflow (click on the image to expand)") %>
-				Preview
-			</h3>
-			
-			<% unless @viewing_version.image.nil? && @viewing_version.svg.nil? %>
-				<p style="font-size: 85%; font-weight: normal; margin-bottom: 0.5em; text-align: center;">
-					 (Click on the image to get the full size)
-				</p>
-				<div class="contribution_preview" style="width: 100%;">
-					<center>
-						<%= link_to image_tag(workflow_version_preview_path(@workflow, @viewing_version.version, 'medium')), workflow_version_preview_path(@workflow, @viewing_version.version, 'full'), :popup => true %>
-					</center>
-				</div>
-				<% if @authorised_to_edit %>
-					<br/>
-					<p style="text-align: right; color: #666666;">[ <%= link_to "change preview image", workflow_version_edit_url(@workflow.id, @viewing_version.version) %> ]</p>
-				<% end %>
-			<% else %>
-				<p class="none_text">
-					Not available
-				</p>
-				<% if @authorised_to_edit %>
-					<p style="text-align: right; color: #666666;">[ <%= link_to "add a preview image", workflow_version_edit_url(@workflow.id, @viewing_version.version) %> ]</p>
-				<% end %>
-			<% end %>
-			
-			<br/>
-			
-			<% unless @viewing_version.svg.nil? %>
-				<ul class="sectionIcons">
-					<li style="margin-left: 0;"><%= icon('picture', workflow_version_preview_path(@workflow, @viewing_version.version, 'svg'), nil, nil, 'Download Scalable Diagram (SVG)') %></li>
-				</ul>
-			<% end %>
-			
-			<br/>
-			
-			<h3>
 				<%= info_icon_with_tooltip("This section shows the overall description for this version of the Workflow") %>
 				Description
 			</h3>
+<% end %>
 			
 			<% unless @viewing_version.body.blank? %>
-				<div class="contribution_description">
-					<%= @viewing_version.body_html %>
-				</div>
+        <div style="overflow: hidden">
+          <div class="inset-preview">
+						<%= link_to image_tag(workflow_version_preview_path(@workflow, @viewing_version.version, 'medium')), workflow_version_preview_path(@workflow, @viewing_version.version, 'full'), :popup => true %>
+          </div>
+          <div class="contribution_description">
+            <%= @viewing_version.body_html %>
+          </div>
+          <div style="clear: both"></div>
+        </div>
 				<% if @authorised_to_edit %>
 					<p style="text-align: right; color: #666666;">[ <%= link_to "edit", workflow_version_edit_url(@workflow.id, @viewing_version.version) %> ]</p>
 				<% end %>
@@ -105,6 +72,13 @@
 					Not set
 				</p>
 			<% end %>
+
+      <h3><%= info_icon_with_tooltip("This shows the activity for this Workflow") %> Activity</h3>
+
+      <a name="activity"></a>
+      <div id="activities">
+        <%= render(:partial => "workflows/activities", :locals => { :object => @workflow } ) -%>
+      </div>
 			
 			<br/>
 			
@@ -117,8 +91,6 @@
         
         <% if @authorised_to_download %>
 
-          <br />
-
           <ul class="sectionIcons">
             <li style="margin-left: 0;"><%= icon('workflow', @named_download_url, "Download Workflow file/package (for version address@hidden)", nil, "Download Workflow File/Package (address@hidden)") -%></li>
           </ul>
@@ -137,6 +109,18 @@
             </ul>
           <% end %>
 
+          <% unless @viewing_version.svg.nil? %>
+
+            <br />
+
+            <ul class="sectionIcons">
+              <li style="margin-left: 0;"><%= icon('picture', workflow_version_preview_path(@workflow, @viewing_version.version, 'svg'), nil, nil, 'Download Scalable Diagram (SVG)') %></li>
+            </ul>
+          <% end %>
+          
+          <br />
+
+
         <% else %>
           <p class="none_text">
             You do not have permission to download this workflow
@@ -172,38 +156,19 @@
 	
 <!-- BEGIN tabs -->
 	
+<ul class="sectionIcons">
+  <% if Authorization.check('create', Review, current_user, @workflow) %>
+    <li><%= icon('review', new_workflow_review_path(@workflow), nil, nil, 'Write a Review') %></li>
+  <% end %>
+  <% if Authorization.check('create', Citation, current_user, @workflow) %>
+    <li><%= icon('new', new_workflow_citation_path(@workflow), nil, nil, 'New Citation', nil) %></li>
+  <% end %>
+</ul>
+
 <br/>
 
 <div id="tabsContainer" class="tabsContainer"></div>
 
-<div class="tabContainer">
-  <div class="tabTitle">Comments</div>
-  <div class="tabContent">
-    <a name="comments"></a>
-    <div id="commentsBox">
-      <%= render :partial => "comments/comments", :locals => { :commentable => @workflow } %>
-    </div>
-  </div>
-</div>
-
-<div class="tabContainer">
-  <div class="tabTitle">Activity</div>
-  <div class="tabContent">
-    <a name="activity"></a>
-    <%= activity_feed(:auth => @workflow) -%>
-  </div>
-</div>
-
-<div class="tabContainer">
-  <div class="tabTitle">Reviews</div>
-  <div class="tabContent">
-    <a name="reviews"></a>
-    <div id="ratingsBox">
-      <%= render :partial => "reviews/reviews", :locals => { :reviewable => @workflow } %>
-    </div>
-  </div>
-</div>
-
 <%= render :partial => "contributions/citations_tab", :locals => { :item => @workflow } %>
 
 <% if @authorised_to_download -%>
@@ -279,11 +244,9 @@
 </div>
 
 <div class="contribution_right_box">
-	<div class="contribution_section_box" style= "font-size: 100%; padding: 0.7em 0.9em; font-weight: bold;">
-		<p><%= info_icon_with_tooltip("The type of workflow system that this Workflow is designed for.") %> Workflow Type</p>
-    <p><%= link_to(h(@viewing_version.content_type.title), content_type_path(@viewing_version.content_type)) %></p>
-	</div>
-	
+
+  <%= render(:partial => "contributions/version_selector", :locals => { :resource => @workflow, :version => @viewing_version, :path => :workflow_version_path }) %>
+
 	<%= render :partial => "contributions/uploader_box", :locals => { :contributable => @workflow } %>
 	
 	<%= render :partial => "contributions/license_box", :locals => { :contributable => @workflow } %>

Modified: branches/events/config/routes.rb (3122 => 3123)


--- branches/events/config/routes.rb	2012-09-06 15:07:53 UTC (rev 3122)
+++ branches/events/config/routes.rb	2012-09-10 09:00:38 UTC (rev 3123)
@@ -121,6 +121,7 @@
                  :edit_version => :get, 
                  :update_version => :put, 
                  :process_tag_suggestions => :post,
+                 :activities => :get,
                  :tag_suggestions => :get } do |workflow|
     # workflows have nested citations
     workflow.resources :citations

Modified: branches/events/public/stylesheets/styles.css (3122 => 3123)


--- branches/events/public/stylesheets/styles.css	2012-09-06 15:07:53 UTC (rev 3122)
+++ branches/events/public/stylesheets/styles.css	2012-09-10 09:00:38 UTC (rev 3123)
@@ -72,7 +72,7 @@
 }
 
 th,td {
-	text-align: center;
+	/*text-align: center;*/
 	border: none;
 	/*border: 1px solid #CCCCCC;*/
 }
@@ -1087,16 +1087,20 @@
 	line-height: 1.5;
 }
 
+.contribution_mini_nav HR {
+  border: none;
+	height: 1px;
+  color: #E0E0E0;
+  background-color: #E0E0E0;
+}
+
 .contribution_left_box {
 	float: left;
 	width: 73.5%;
 }
 
-.contribution_description {
-	text-align: left;
-	background-color: #FFFFFF;
-	border: 1px solid #CCCCCC;
-	padding: 0.3em 1em;
+.contribution_description PRE {
+  background: inherit;
 }
 
 .contribution_preview img {
@@ -1113,6 +1117,7 @@
 .contribution_section_box {
 	background-color: #F8F8C8;
 	border-bottom: 1px solid #CCCC99;
+	border-right: 1px solid #CCCC99;
 	padding: 0.3em 0.3em;
 	text-align: center;
 	margin-bottom: 0.6em;
@@ -1329,13 +1334,20 @@
 }
 
 .addCommentBox {
-	margin-top: 3em;
-	padding: 1em;
-	width: 500px;
-	background-color: #EEEEEE;
-	border: 1px dotted #999999;
+	margin-top: 10px;
+  padding: 8px;
+	background-color: #E0E0E0;
 }
 
+.addCommentBox TEXTAREA {
+  padding: 4px;
+  width: 500px;
+}
+
+.addCommentBox INPUT {
+  margin-top: 4px;
+}
+
 /* End Comments styles */
 
 /* Begin Reviews styles */
@@ -2379,3 +2391,64 @@
   content: "\0000a0";
 }
 
+OL.activity-feed {
+  margin: 0;
+}
+
+.activity-feed LI {
+  list-style: none;
+}
+
+.activity-feed LI + LI {
+  border-top: 1px SOLID #E0E0E0;
+}
+
+DIV.activity IMG.framed  {
+  border: 0;
+  padding: 0;
+}
+
+.activity {
+  padding-top: 12px;
+  padding-bottom: 12px;
+}
+
+.activity .avatar-column {
+  width: 64px;
+  float: left;
+}
+
+.activity .activity-column {
+  margin-left: 72px;
+}
+
+.activity .actions {
+  font-size: 8pt;
+}
+
+.activity .date {
+  color: gray;
+}
+
+.activity SPAN + SPAN:before {
+  content: " ยท ";
+  color: gray;
+}
+
+.inset-preview {
+  float: left;
+  margin-right: 16px;
+  margin-bottom: 16px;
+}
+
+.inset-preview IMG {
+  max-width: 200px;
+}
+
+.workflow-type {
+}
+
+.metadata-datetime {
+  font-size: 8pt;
+}
+

Modified: branches/events/vendor/plugins/versioning/lib/versioning.rb (3122 => 3123)


--- branches/events/vendor/plugins/versioning/lib/versioning.rb	2012-09-06 15:07:53 UTC (rev 3122)
+++ branches/events/vendor/plugins/versioning/lib/versioning.rb	2012-09-10 09:00:38 UTC (rev 3123)
@@ -44,13 +44,6 @@
         def new_version?
           new_record? || (changed_versioned_attributes - mutable_attributes).length > 0
         end
-
-        def describe_version(version_number)
-          return "" if versions.count < 2
-          return "(earliest)" if version_number == versions.first.version
-          return "(latest)" if version_number == versions.last.version
-          return ""
-        end
       end
 
       before_save do |resource|

Modified: branches/events/vendor/plugins/white_list_formatted_content/init.rb (3122 => 3123)


--- branches/events/vendor/plugins/white_list_formatted_content/init.rb	2012-09-06 15:07:53 UTC (rev 3122)
+++ branches/events/vendor/plugins/white_list_formatted_content/init.rb	2012-09-10 09:00:38 UTC (rev 3123)
@@ -161,6 +161,12 @@
     
     def body_html_with_formatting
       body_html = auto_link(body.starts_with?('<') ? body : render_plain_text_to_html(body))
+
+      # remove empty paragraphs
+
+      body_html.gsub!("<p></p>", "")
+      body_html.gsub!("<p>&nbsp;</p>", "")
+
       white_list(body_html)
     end
 end

reply via email to

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