myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [3054] branches/versions: refactored version sele


From: noreply
Subject: [myexperiment-hackers] [3054] branches/versions: refactored version selector and history tab
Date: Sat, 28 Jul 2012 22:30:43 +0000 (UTC)

Revision
3054
Author
dgc
Date
2012-07-28 22:30:43 +0000 (Sat, 28 Jul 2012)

Log Message

refactored version selector and history tab

Modified Paths

Added Paths

Removed Paths

Diff

Modified: branches/versions/app/views/blobs/show.rhtml (3053 => 3054)


--- branches/versions/app/views/blobs/show.rhtml	2012-07-28 22:28:58 UTC (rev 3053)
+++ branches/versions/app/views/blobs/show.rhtml	2012-07-28 22:30:43 UTC (rev 3054)
@@ -31,12 +31,13 @@
 	|
 	<%= link_to "Favourited By (address@hidden)", "#favourited_by" %>
 	| 
+  <br/>
+  |
+  <%= link_to("Version History", "#version_history") -%>
+  |
 	<% if logged_in? and @blob.owner?(current_user) %>
-	  <br/>
+	  <a href=""
 	  |
-		<!-- NB! Index of the 'sharing' tab might change! -->
-	  <a href="" 
-	  |
 	<% end %>
 	<%= link_to "Comments (address@hidden)", "#comments" %> 
 	|
@@ -139,14 +140,22 @@
 <br/>
 
 <div id="tabsContainer" class="tabsContainer"></div>
-	
+
+<div class="tabContainer">
+  <div class="tabTitle">Version History</div>
+  <div class="tabContent">
+    <a name="version_history"></a>
+    <%= render :partial => "contributions/versions", :locals => { :resource => @blob, :path => :blob_version_path } %>
+  </div>
+</div>
+
 <% if logged_in? and @blob.owner? current_user %>
   
-	<a name="sharing"></a>
 	<div class="tabContainer">
     <div class="tabTitle">Sharing</div>
     <div class="tabContent">
 
+      <a name="sharing"></a>
       <%= render :partial => "contributions/sharing_summary",  :locals => { :contributable => @blob } %>
       <%= render :partial => "contributions/updating_summary", :locals => { :contributable => @blob } %>
 	  

Modified: branches/versions/app/views/contributions/_version_selector.rhtml (3053 => 3054)


--- branches/versions/app/views/contributions/_version_selector.rhtml	2012-07-28 22:28:58 UTC (rev 3053)
+++ branches/versions/app/views/contributions/_version_selector.rhtml	2012-07-28 22:30:43 UTC (rev 3054)
@@ -39,24 +39,33 @@
     <p style="text-align: center;">
       <b>Version created on:</b>
       <span><%= datetime version.created_at, false %></span>
-      <span>&nbsp;&nbsp;|&nbsp;&nbsp;</span>
-      <span><%= link_to_function "Revision comments " + expand_image, visual_effect(:toggle_blind, "version_info_box_comments", :duration => 0.3) %></span>
+      <% if version.respond_to?(:contributor_id) && version.respond_to?(:contributor_type) %>
+        <b>by:</b>
+        <span><%= contributor(version.contributor_id, version.contributor_type) %></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>
   
-  <div id="version_info_box_comments" style="display: none; border: 1px dotted #CCCCCC; padding: 0.3em 0.5em;">
-    <% unless version.revision_comments.blank? -%>
+  <% 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 %>
-    <% else %>
-      <p><i>None</i></p>
-    <% end %>
-  </div>
+    </div>
+  <% end %>
+
 </div>
 

Added: branches/versions/app/views/contributions/_versions.rhtml (0 => 3054)


--- branches/versions/app/views/contributions/_versions.rhtml	                        (rev 0)
+++ branches/versions/app/views/contributions/_versions.rhtml	2012-07-28 22:30:43 UTC (rev 3054)
@@ -0,0 +1,41 @@
+<p>In chronological order:</p>
+
+<ol class="version_history">
+  <% resource.versions.each do |version| %>
+    <li>
+      <div class="title">
+        <%= link_to(version.title, send(path, resource, version.version)) %>
+      </div>
+      <div class="metadata">
+
+        <p>
+          Created
+          <% if version.respond_to?(:contributor_id) %>
+            by <%= contributor version.contributor_id, version.contributor_type %>
+          <% end %>
+          on <%= datetime version.created_at %>
+        </p>
+
+        <% unless version.created_at == version.updated_at %>
+          <p>
+            Last edited
+            <% if version.respond_to?(:last_edited_by) %>
+              by <%= contributor version.last_edited_by, "User" %>
+            <% end %>
+            on <%= datetime version.updated_at %>
+          </p>
+        <% end %>
+
+        <% if !version.revision_comments.blank? %>
+          <p>
+            <div>Comment:</div>
+            <div class="comment">
+              <%= white_list version.revision_comments %>
+            </div>
+          </p>
+        <% end %>
+      </div>
+    </li>
+  <% end %>
+</ol>
+

Deleted: branches/versions/app/views/workflows/_version_meta.rhtml (3053 => 3054)


--- branches/versions/app/views/workflows/_version_meta.rhtml	2012-07-28 22:28:58 UTC (rev 3053)
+++ branches/versions/app/views/workflows/_version_meta.rhtml	2012-07-28 22:30:43 UTC (rev 3054)
@@ -1,34 +0,0 @@
-<p>
-	<b>Created on:</b>
-	<%= datetime version.created_at %>
-</p>
-
-<p>
-	<b>Created by:</b>
-	<%= contributor version.contributor_id, version.contributor_type %>
-</p>
-
-<% unless version.created_at == version.updated_at %>
-
-	<p>
-		<b>Last edited on:</b>
-		<%= datetime version.updated_at %>
-	</p>
-	
-	<p>
-		<b>Last edited by:</b>
-		<%= contributor version.last_edited_by, "User" %>
-	</p>
-
-<% end %>
-
-<p>
-	<b>Revision comments:</b>
-</p>
-<% unless version.revision_comments.blank? -%>
-	<div>
-		<%= white_list version.revision_comments %>
-	</div>
-<% else %>
-	<p><i>None</i></p>
-<% end %>

Deleted: branches/versions/app/views/workflows/_versions.rhtml (3053 => 3054)


--- branches/versions/app/views/workflows/_versions.rhtml	2012-07-28 22:28:58 UTC (rev 3053)
+++ branches/versions/app/views/workflows/_versions.rhtml	2012-07-28 22:30:43 UTC (rev 3054)
@@ -1,39 +0,0 @@
-<p>
-  <b>Earliest Version:</b><br/>
-  <%= versioned_workflow_link(workflow, workflow.versions.first.version ) %>
-	<div class="contribution_version_meta_info_box" style="margin-bottom: 0.6em;">
-		<%= render :partial => "version_meta", :locals => { :version => workflow.versions.first } %>
-	</div>
-</p>
-
-<% if @latest_version_number > 2 %>
-<p>
-  <b>Previous Versions:</b><br/>
-  <% (address@hidden).each do |v| %>
-		<% if (link = versioned_workflow_link(workflow, v)) %>
-    	<%= link %><br/>
-			<div class="contribution_version_meta_info_box" style="margin-bottom: 0.6em;">
-				<%= render :partial => "version_meta", :locals => { :version => workflow.find_version(v) } %>
-			</div>
-		<% else %>
-			<p>[<%= v.to_s %>] - <i>does not exist</i></p>
-		<% end %>
-  <% end %>
-</p>
-<% end %>
-
-<% if @latest_version_number > 1 %>
-  <p>
-    <b>Latest Version:</b><br/>
-    <%= versioned_workflow_link(workflow, @latest_version_number) %>
-		<div class="contribution_version_meta_info_box" style="margin-bottom: 0.6em;">
-			<%= render :partial => "version_meta", :locals => { :version => workflow.versions.last } %>
-		</div>
-  </p>
-<% end %>
-
-<% if workflow.versions.length == 1 %>
-  <p>
-    This Workflow only has one version.
-  </p>
-<% end %>

Modified: branches/versions/app/views/workflows/show.rhtml (3053 => 3054)


--- branches/versions/app/views/workflows/show.rhtml	2012-07-28 22:28:58 UTC (rev 3053)
+++ branches/versions/app/views/workflows/show.rhtml	2012-07-28 22:30:43 UTC (rev 3054)
@@ -1,13 +1,5 @@
 <% t "#{h @workflow.title} (#{h @workflow.contributor_name}) [#{h(@workflow.type_display_name)} Workflow]" -%>
 
-<script type="text/_javascript_">
-  function showWorkflowVersion(form) {
-    var url = ""
-		location.href = ""
-		form.submit
-  }
-</script>
-
 <ul class="sectionIcons">
 	<% if @authorised_to_edit -%>
 		<li><%= icon('new', new_version_workflow_path(@workflow), nil, nil, 'Upload New Version')%></li>
@@ -28,8 +20,6 @@
 
 <%= render :partial => "contributions/datetime_info", :locals => { :contributable => @workflow } -%>
 
-<!-- the code for 'selectTab()' should be refactored at some point to get -->
-<!-- tab name as a string, not it's ID; for now IDs are used -->
 <div class="contribution_mini_nav">
 	|
 	<%= link_to "License", "#license" %>
@@ -50,12 +40,12 @@
 	|
 	<br/>
 	|
-	<a href=""  (<%= @workflow.citations.length -%>)</a>
+	<a href="" (<%= @workflow.citations.length -%>)</a>
 	|
-	<a href=""  History</a>
-	|
+  <a href="" History</a>
+  |
 	<% if logged_in? and @workflow.owner?(current_user) %>
-	  <a href="" 
+	  <a href=""
 	  |
 	<% end %>
 	<%= link_to "Reviews (address@hidden)", "#reviews" %>
@@ -68,63 +58,9 @@
 <div class="contribution_left_box">
 	
 	<div class="contribution_version_box">
-		<div class="contribution_version_selector_box">
-			<table>
-				<tbody>
-					<tr>
-						<td class="heading" style="vertical-align: top;">
-							<%= info_icon_with_tooltip("This box shows version address@hidden of the Workflow file for this Workflow entry") -%>
-							<span><%= "Version address@hidden address@hidden(@viewing_version_number)}" -%></span>
-							<span class="count_text">(of <%= @workflow.versions.length -%>)</span>
-						  <a name="versions"></a>
-						</td>
-						<td>
-							<% if @latest_version_number > 1 %>
-	             	<form  return false;" style="text-align: right;">
-						    	<b>View version: </b>
-						    	<select id="workflow_versions" 
-							  		<% @workflow.versions.reverse.each do |w| %>
-							    		<option value="<%= versioned_workflow_url(@workflow, w.version.to_s) %>" <%= "selected" if w.version == @viewing_version_number -%>>
-							      			<%= "#{w.version.to_s} address@hidden(w.version)}" %>
-							    		</option>
-							  		<% end %>
-									</select>
-								</form>
-							<% end %>
-						</td>
-					</tr>
-				</tbody>
-			</table>
-			
-			<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 @viewing_version.created_at, false %></span>
-					<b>by:</b>
-					<span><%= contributor @viewing_version.contributor_id, @viewing_version.contributor_type %></span>
-					<span>&nbsp;&nbsp;|&nbsp;&nbsp;</span>
-					<span><%= link_to_function "Revision comments " + expand_image, visual_effect(:toggle_blind, "version_info_box_comments", :duration => 0.3) %></span>
-				</p>
-				
-				<% unless @viewing_version.created_at == @viewing_version.updated_at %>
-					<p style="text-align: center;">
-						<b>Last edited on:</b>
-						<span><%= datetime @viewing_version.updated_at, false %></span>
-						<b>by:</b>
-						<span><%= contributor @viewing_version.last_edited_by, "User" %></span>
-					</p>
-				<% end %>
-			</div>
-			
-			<div id="version_info_box_comments" style="display: none; border: 1px dotted #CCCCCC; padding: 0.3em 0.5em;">
-				<% unless @viewing_version.revision_comments.blank? -%>
-					<%= white_list @viewing_version.revision_comments %>
-				<% else %>
-					<p><i>None</i></p>
-				<% end %>
-			</div>
-		</div>
-		
+
+    <%= render(:partial => "contributions/version_selector", :locals => { :resource => @workflow, :version => @viewing_version, :path => :workflow_version_path }) %>
+
 		<% if @authorised_to_edit %>
 			<div style="margin-top: 1em;">
 				<ul class="sectionIcons" style="margin-top: 0.7em; margin-bottom: 0.6em;">
@@ -337,24 +273,23 @@
 
 <div id="tabsContainer" class="tabsContainer"></div>
 
-<a name="citations"></a>
 <%= render :partial => "contributions/citations_tab", :locals => { :item => @workflow } %>
 
-<a name="version_history"></a>
 <div class="tabContainer">
   <div class="tabTitle">Version History</div>
   <div class="tabContent">
-      <%= render :partial => "workflows/versions", :locals => { :workflow => @workflow } %>
+    <a name="version_history"></a>
+    <%= render :partial => "contributions/versions", :locals => { :resource => @workflow, :path => :workflow_version_path } %>
   </div>
 </div>
 
 <% if logged_in? and @workflow.owner?(current_user) %>
   
-	<a name="sharing"></a>
 	<div class="tabContainer">
     <div class="tabTitle">Sharing</div>
     <div class="tabContent">
 
+      <a name="sharing"></a>
       <%= render :partial => "contributions/sharing_summary",  :locals => { :contributable => @workflow } %>
       <%= render :partial => "contributions/updating_summary", :locals => { :contributable => @workflow } %>
 	  

Modified: branches/versions/public/stylesheets/styles.css (3053 => 3054)


--- branches/versions/public/stylesheets/styles.css	2012-07-28 22:28:58 UTC (rev 3053)
+++ branches/versions/public/stylesheets/styles.css	2012-07-28 22:30:43 UTC (rev 3054)
@@ -1254,16 +1254,6 @@
 	border: 1px solid #CCCCCC;
 }
 
-.contribution_version_meta_info_box {
-	padding: 0.3em 0.6em; 
-	border: 1px dotted #999999;
-	background-color: #FFFFCC;
-	color: #333333;
-	line-height: 1.2;
-	font-size: 85%;
-	margin-left: 2.5em;  
-}
-
 .contribution_currentlicense {
 	padding: 0 0 0.5em 0;
 }
@@ -2335,3 +2325,22 @@
   background: #ffc0c0;
 }
 
+.version_history .title {
+  font-size: 16px;
+}
+
+.version_history .metadata {
+  margin-left: 12px;
+  margin-top: 6px;
+  margin-bottom: 6px;
+}
+
+.version_history .comment {
+	padding: 6px;
+	border: 1px dotted #999999;
+	background-color: #FFFFCC;
+	color: #333333;
+	line-height: 1.2;
+	font-size: 85%;
+}
+

reply via email to

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