myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [3345] trunk: Refactor workflow table to support


From: noreply
Subject: [myexperiment-hackers] [3345] trunk: Refactor workflow table to support skinned search results
Date: Thu, 24 Jan 2013 14:58:23 +0000 (UTC)

Revision
3345
Author
fbacall
Date
2013-01-24 14:58:22 +0000 (Thu, 24 Jan 2013)

Log Message

Refactor workflow table to support skinned search results

Modified Paths

Added Paths

Diff

Modified: trunk/app/views/layouts/_myexperiment.rhtml (3344 => 3345)


--- trunk/app/views/layouts/_myexperiment.rhtml	2013-01-23 16:43:32 UTC (rev 3344)
+++ trunk/app/views/layouts/_myexperiment.rhtml	2013-01-24 14:58:22 UTC (rev 3345)
@@ -8,7 +8,8 @@
   <% if @lod_rdf %><link rel="alternate" href="" @lod_rdf -%>" type="application/rdf+xml" title="RDF+XML" /><% end %>
   <% if @lod_xml %><link rel="alternate" href="" @lod_xml -%>" type="application/xml" title="REST XML" /><% end %>
   <link rel="shortcut icon" href="" type="image/x-icon"/>
-  <%= stylesheet_link_tag 'reset-fonts-grids', 'base-min', 'acts_as_taggable_stylesheet', 'star_rating', 'gadgets', address@hidden"stylesheets"] %>
+  <%= stylesheet_link_tag 'reset-fonts-grids', 'base-min', 'acts_as_taggable_stylesheet',
+                          'star_rating', 'gadgets', 'misc_skinning', address@hidden"stylesheets"] %>
   <%= _javascript__include_tag :defaults, "boxover.js" %>
 
   <% if controller.action_name.downcase == "timeline" %>

Added: trunk/app/views/skins/branding/_biovel.html.erb (0 => 3345)


--- trunk/app/views/skins/branding/_biovel.html.erb	                        (rev 0)
+++ trunk/app/views/skins/branding/_biovel.html.erb	2013-01-24 14:58:22 UTC (rev 3345)
@@ -0,0 +1,5 @@
+<div style="text-align: center; margin-top: 0.5em;">
+  <span class="owner">Project</span>
+  <%= link_to image_tag('/images/biovel.png', :style => 'width: 60px; height: 60px; margin-top: 0.2em;') + '<br/>BioVeL',
+              network_path(643) -%>
+</div>
\ No newline at end of file

Modified: trunk/app/views/users/_avatar.rhtml (3344 => 3345)


--- trunk/app/views/users/_avatar.rhtml	2013-01-23 16:43:32 UTC (rev 3344)
+++ trunk/app/views/users/_avatar.rhtml	2013-01-24 14:58:22 UTC (rev 3345)
@@ -1,7 +1,7 @@
 <% size ||= 100 -%>
 <% you_string ||= "" -%>
 <% if user.kind_of? Fixnum then user = User.find(user) end -%>
-<div style="text-align:center; width: <%= size+6 %>px; line-height: 1.2em; padding: 0.2em 0;">
+<div class="avatar">
 	<%= avatar(user, size) %>
 	<span style="display:block;margin-top:2px;text-align:center;">
 		<% if size > 59 %>

Modified: trunk/app/views/workflows/_table.rhtml (3344 => 3345)


--- trunk/app/views/workflows/_table.rhtml	2013-01-23 16:43:32 UTC (rev 3344)
+++ trunk/app/views/workflows/_table.rhtml	2013-01-24 14:58:22 UTC (rev 3345)
@@ -1,138 +1,137 @@
 <% query ||= false -%>
-<% odd_row = false -%>
 
 <% unless collection.empty? %>
+  <% collection.each do |workflow| %>
+    <% # If only one item in collection, check if 'show' permission is available (eg: if this partial was called from contributions/table) -%>
+    <% if collection.size == 1 -%>
+      <% show ||= Authorization.check("view", workflow, current_user) -%>
+    <% else -%>
+      <% show = Authorization.check("view", workflow, current_user) -%>
+    <% end -%>
+    <% if show -%>
+      <% cache(:controller => 'workflows_cache', :action ="" 'listing', :id => workflow.id) do -%>
+        <div class="resource_list_item <%= workflow.contribution.policy.layout -%>">
 
-<table class="alt_table">	
-	<% for workflow in collection %>
-		<% # If only one item in collection, check if 'show' permission is available (eg: if this partial was called from contributions/table) -%>
-		<% if collection.size == 1 -%>
-			<% show ||= Authorization.check("view", workflow, current_user) -%>
-		<% else -%>
-			<% show = Authorization.check("view", workflow, current_user) -%>
-		<% end -%>
-	  <% if show -%>
-		<tr class="<%= (odd_row = !odd_row) ? "odd_row" : "even_row" %>">
-			<% cache(:controller => 'workflows_cache', :action ="" 'listing', :id => workflow.id) do -%>
-			    <td style="width: 100px;">
-						<div class="workflow_type_box" style="width: auto; margin-bottom: 2em;">
+          <div class="avatar_panel">
+            <div class="workflow_type_box">
               <%= link_to(h(workflow.content_type.title), content_type_path(workflow.content_type)) %>
-						</div>
-			    	<p style="margin-top:0; padding-top:0; text-align: center;"><b><%= owner_text workflow -%></b></p>
-						<center><%= contributor(workflow.contribution.contributor_id, workflow.contribution.contributor_type, true, 60) %></center>
-					</td>
-			    <td style="text-align: left; max-width: 350px">
-			      <a name="<%= workflow.title.gsub(/ /, "_") %>"></a>
-			      <p class="title">
-					  	<%= icon "workflow", nil, nil, nil, '' %>
-              <% truncated_title = truncate(workflow.title, :length => 35) %>
-							<%=link_to(query ? highlight_all(truncated_title, query) : truncated_title, workflow_path(workflow),
+            </div>
+            <span class="owner"><%= owner_text workflow -%></span>
+            <%= contributor(workflow.contribution.contributor_id, workflow.contribution.contributor_type, true, 60) %>
+            <% if layout = workflow.contribution.policy.layout %>
+              <% begin %>
+                <%= render :partial => "skins/branding/#{layout}" %>
+              <% rescue ActionView::MissingTemplate %>
+              <% end %>
+            <% end %>
+          </div>
+
+          <div class="main_panel">
+
+            <div class="actions">
+              <%= icon "show", workflow_path(workflow), nil, nil, "View" %>
+              <% if Authorization.check("download", workflow, current_user) -%>
+                <%= icon "download", download_workflow_path(workflow), nil, nil, "Download (v#{workflow.versions.count})" %>
+                <% if ( session[:callback] && (session[:callback][:types].include?(workflow.content_type_id))) -%>
+                  <%= icon "download", callback_url(workflow).to_s, nil, {:rel => 'nofollow'}, session[:callback][:label] -%>
+                <% end %>
+              <% end %>
+              <% if mine?(workflow) %>
+                <%= icon "manage", edit_workflow_path(workflow), nil, nil, "Manage" %>
+              <% end %>
+            </div>
+
+            <a name="<%= workflow.title.gsub(/ /, "_") %>"></a>
+
+            <p class="title">
+              <%= icon "workflow", nil, nil, nil, '' %>
+              <% truncated_title = truncate(workflow.title, :length => 45) %>
+              <%=link_to(query ? highlight_all(truncated_title, query) : truncated_title, workflow_path(workflow),
                          :title => workflow.title) %>
-							<span style="font-weight:normal;">(<%= workflow.current_version %>)							</span>
-					  </p>
-					
-						<p style="font-size: 85%; margin-top: 0; padding-top: 0;">
-							<b>Created:</b> <%=datetime workflow.contribution.created_at, false -%>
-							<% unless workflow.contribution.created_at == workflow.contribution.updated_at %>
-								|	<b>Last updated:</b> <%=datetime workflow.contribution.updated_at, false -%>
-							<% end %>
-						</p>
-						
-					  <% unless (creditors = workflow.creditors).empty? %>
-					  	<p style="font-size:85%;">
-							<b>Credits:</b>
-							<% creditors.each do |c| %>
-								<% if c.creditor_type == 'User' %>
-									<%= icon('user', nil, nil, nil, '') %> 
-								<% elsif c.creditor_type == 'Network' %>
-									<%= icon('network-member', nil, nil, nil, '') %>
-								<% end %>
-								<%= contributor(c.creditor_id, c.creditor_type) %>
-							<% end %>
-					  	</p>
-					  <% end %>
-					  <% unless (attributors = workflow.attributors).empty? %>
-					  	<p style="font-size:85%;">
-							<b>Attributions:</b>
-							<% attributors.each do |a| %>
-								<% if Authorization.check("view", a.attributor, current_user) -%>
-									<% if a.attributor_type == 'Workflow' %>
-										<%= icon('workflow', nil, nil, nil, '') %> 
-									<% elsif a.attributor_type == 'Blob' %>
-										<%= icon('blob', nil, nil, nil, '') %>
-									<% end %>
-									<%= contributable(a.attributor_id, a.attributor_type) %>
-								<% end %>
-							<% end %>
-					  	</p>
-					  <% end %>
-						
+              <span style="font-weight:normal;">
+                (<%= workflow.current_version %>)
+              </span>
+            </p>
+
+            <p>
+              <b>Created:</b> <%=datetime workflow.contribution.created_at, false -%>
+              <% unless workflow.contribution.created_at == workflow.contribution.updated_at %>
+                |	<b>Last updated:</b> <%=datetime workflow.contribution.updated_at, false -%>
+              <% end %>
+            </p>
+
+            <% unless (creditors = workflow.creditors).empty? %>
+              <p>
+                <b>Credits:</b>
+                <% creditors.each do |c| %>
+                  <% if c.creditor_type == 'User' %>
+                    <%= icon('user', nil, nil, nil, '') %>
+                  <% elsif c.creditor_type == 'Network' %>
+                    <%= icon('network-member', nil, nil, nil, '') %>
+                  <% end %>
+                  <%= contributor(c.creditor_id, c.creditor_type) %>
+                <% end %>
+              </p>
+            <% end %>
+
+            <% unless (attributors = workflow.attributors).empty? %>
+              <p>
+                <b>Attributions:</b>
+                <% attributors.each do |a| %>
+                  <% if Authorization.check("view", a.attributor, current_user) -%>
+                    <% if a.attributor_type == 'Workflow' %>
+                      <%= icon('workflow', nil, nil, nil, '') %>
+                    <% elsif a.attributor_type == 'Blob' %>
+                      <%= icon('blob', nil, nil, nil, '') %>
+                    <% end %>
+                    <%= contributable(a.attributor_id, a.attributor_type) %>
+                  <% end %>
+                <% end %>
+              </p>
+            <% end %>
+
             <% if workflow.license_id.nil? %>
-              <p style="font-size:85%;"><b>License: </b>No license</p>
+              <p><b>License: </b>No license</p>
             <% else %>
-              <p style="font-size:85%;"><b>License: </b><% @license = License.find(workflow.license_id) %><%= link_to h(@license.title), license_path(@license) %></p>
+              <p><b>License: </b><% @license = License.find(workflow.license_id) %><%= link_to h(@license.title), license_path(@license) %></p>
             <% end %>
-					  
-            <% desc_style = "font-size: 85%;" %>
 
-            <% unless workflow.image.nil? && workflow.svg.nil? -%>
-              <p style="margin: 0; border: 0; width: 101px; float: left">
-                <%= link_to image_tag(workflow_preview_path(workflow, 'thumb'), :class => 'framed_nospace'), workflow_path(workflow) %>
-              </p>
+            <div class="desc">
+              <% unless workflow.image.nil? && workflow.svg.nil? -%>
+                <div class="preview">
+                  <%= link_to image_tag(workflow_preview_path(workflow, 'thumb'), :class => 'framed_nospace'), workflow_path(workflow) %>
+                </div>
+              <% end -%>
+              <% if workflow.body and workflow.body.length > 0 -%>
+                <% desc = truncate(strip_html(workflow.body), :length => 500) -%>
+                <%= query ? highlight_all(desc, query) : desc %>
+              <% else -%>
+                <span class="none_text">No description</span>
+              <% end -%>
+            </div>
 
-              <% desc_style << " margin-left: 110px; width: 250px;" %>
-            <% end -%>
+            <p>
+              <a href="" workflow_path(workflow) + '#ratings' -%>"><b>Rating: </b><%= number_with_precision(workflow.rating, :precision => 1) %> / 5 (<%= pluralize workflow.ratings.count, 'rating' %>)</a> |
+              <a href="" workflow_path(workflow) + '#versions' -%>"><b>Versions: </b><%= workflow.versions.count %></a> |
+              <a href="" workflow_path(workflow) + '#reviews' -%>"><b>Reviews: </b><%= workflow.reviews.count %></a> |
+              <a href="" workflow_path(workflow) + '#comments' -%>"><b>Comments: </b><%= workflow.comments.count %></a> |
+              <a href="" workflow_path(workflow) + '#citations' -%>"><b>Citations: </b><%= workflow.citations.count %></a>
+            </p>
 
-            <p style="margin: 0; padding: 0; border: 0;">
-              <div class="desc" style="<%= desc_style -%>">
-                <% if workflow.body and workflow.body.length > 0 -%>
-                  <% desc = truncate(strip_html(workflow.body), :length => 500) -%>
-                  <%= query ? highlight_all(desc, query) : desc %>
-                <% else -%>
-                  <span class="none_text">No description</span>                      
-                <% end -%>
-              </div>
+            <p>
+              <b>Viewed:</b> <%=pluralize workflow.contribution.site_viewings_count, "time" %> |
+              <b>Downloaded:</b> <%=pluralize workflow.contribution.site_downloads_count, "time" %>
             </p>
-					  
-            <div style="clear: both"></div>
 
-					  <p style="font-size: 85%;">
-							<a href="" workflow_path(workflow) + '#ratings' -%>"><b>Rating: </b><%= number_with_precision(workflow.rating, :precision => 1) %> / 5 (<%= pluralize workflow.ratings.count, 'rating' %>)</a> |
-							<a href="" workflow_path(workflow) + '#versions' -%>"><b>Versions: </b><%= workflow.versions.count %></a> |
-							<a href="" workflow_path(workflow) + '#reviews' -%>"><b>Reviews: </b><%= workflow.reviews.count %></a> |
-							<a href="" workflow_path(workflow) + '#comments' -%>"><b>Comments: </b><%= workflow.comments.count %></a> |
-							<a href="" workflow_path(workflow) + '#citations' -%>"><b>Citations: </b><%= workflow.citations.count %></a>
-					  </p>
-						
-						<p style="font-size: 85%;">
-							<b>Viewed:</b> <%=pluralize workflow.contribution.site_viewings_count, "time" %> |
-				      <b>Downloaded:</b> <%=pluralize workflow.contribution.site_downloads_count, "time" %>
-						</p>
-					  
-					  <% unless (tags = workflow.tags).empty? %>
-							<a href="" workflow_path(workflow) + '#tags' -%>"><p style="font-size: 85%;"><b>Tags</b> (<%=tags.count-%>):</p></a>
-							<div style="display:inline;" class="tags_onesize"><%= tag_cloud_from_collection tags, true %></div>
-					  <% else %>
-							<p style="font-size: 85%;"><i>This Workflow has no tags!</i></p>
-					  <% end %>	
-			    </td>
-			<% end -%>
-			    <td class="actions" style="width: 120px;">
-			      <%= icon "show", workflow_path(workflow), nil, nil, "View" %>
-				  	<% if Authorization.check("download", workflow, current_user) -%>
-						<%= icon "download", download_workflow_path(workflow), nil, nil, "Download (v#{workflow.versions.count})" %>
-						<% if ( session[:callback] && (session[:callback][:types].include?(workflow.content_type_id))) -%>
-							<%= icon "download", callback_url(workflow).to_s, nil, {:rel => 'nofollow'}, session[:callback][:label] -%>
-						<% end %>
-					<% end %>
-			      <% if mine?(workflow) %><%= icon "manage", edit_workflow_path(workflow), nil, nil, "Manage" %><% end %>
-						<br/><br/>
-						
-			    </td>
-		</tr>
-  	<% end -%>
-	<% end -%>
-
-</table>
-
+            <% unless (tags = workflow.tags).empty? %>
+              <a href="" workflow_path(workflow) + '#tags' -%>"><p><b>Tags</b> (<%=tags.count-%>):</p></a>
+              <div style="display:inline;" class="tags_onesize"><%= tag_cloud_from_collection tags, true %></div>
+            <% else %>
+              <p><i>This Workflow has no tags!</i></p>
+            <% end %>
+          </div>
+        </div>
+      <% end -%>
+    <% end -%>
+  <% end -%>
 <% end %>

Added: trunk/public/stylesheets/misc_skinning.css (0 => 3345)


--- trunk/public/stylesheets/misc_skinning.css	                        (rev 0)
+++ trunk/public/stylesheets/misc_skinning.css	2013-01-24 14:58:22 UTC (rev 3345)
@@ -0,0 +1,7 @@
+table.alt_table tr.odd_row.biovel td, table.alt_table tr.even_row.biovel td, .resource_list_item.biovel {
+  background-color: #EEFFCC;
+}
+
+table.alt_table.biovel, .resource_list_item.biovel {
+  border-color: #99cc33;
+}

Modified: trunk/public/stylesheets/styles.css (3344 => 3345)


--- trunk/public/stylesheets/styles.css	2013-01-23 16:43:32 UTC (rev 3344)
+++ trunk/public/stylesheets/styles.css	2013-01-24 14:58:22 UTC (rev 3345)
@@ -868,12 +868,12 @@
 	font-weight: normal;
 }
 
-table.alt_table p.title {
+p.title {
 	margin-top: 0;
 	padding-top: 0;
 	margin-bottom: 0.2em;
 	font-weight: bold;
-	font-size: 108%;
+  font-size: 120%;
 }
 
 table.alt_table .desc {
@@ -995,10 +995,6 @@
 	/*border: 2px solid #F5F5F5;*/ 
 }
 
-.sectionIcons li:first {
-	margin-left: 0;
-}
-
 .sectionIcons li:hover {
 }
 
@@ -1139,7 +1135,7 @@
 
 .contribution_section_box .stats_box p {
 	font-size: 93%;
-	text-align: centre;
+	text-align: center;
 	line-height: 1.3;
 	padding: 0;
 }
@@ -1926,7 +1922,7 @@
 .workflow_type_box {
 	border: 1px solid #DDDDDD; 
 	background-color: #FFFFCC; 
-	margin: 0; 
+	margin: 0 0 0.5em 0;
 	padding: 0.4em 0.5em; 
 	font-size: 77%; 
 	color: #990000; 
@@ -1954,13 +1950,13 @@
 }
 
 .unselected_tag_suggestion {
-  border: 1px SOLID white;
+  border: 1px solid white;
   padding-left: 4px;
   padding-right: 4px;
 }
 
 .unselected_tag_suggestion:hover {
-  border: 1px SOLID #d0d0f0;
+  border: 1px solid #d0d0f0;
   background-color: white;
   padding-left: 4px;
   padding-right: 4px;
@@ -1969,14 +1965,14 @@
 }
 
 .selected_tag_suggestion {
-  border: 1px SOLID #a0a0c0;
+  border: 1px solid #a0a0c0;
   background-color: #d0d0f0;
   padding-left: 4px;
   padding-right: 4px;
 }
 
 .selected_tag_suggestion:hover {
-  border: 1px SOLID #a0a0c0;
+  border: 1px solid #a0a0c0;
   background-color: #d0d0f0;
   padding-left: 4px;
   padding-right: 4px;
@@ -2001,7 +1997,7 @@
 }
 
 .classification {
-  border: 1px SOLID gray;
+  border: 1px solid gray;
   padding: 3px;
   padding-left: 6px;
   padding-right: 6px;
@@ -2390,4 +2386,69 @@
 
 input[type="radio"], input[type="checkbox"] {
   vertical-align: top;
+}
+
+.resource_list_item {
+  border: 1px solid #ccc;
+  background-color: #F5F5F5;
+  padding: 0.5em;
+  margin-bottom: 0.5em;
+}
+
+.resource_list_item p {
+  font-size: 85%;
+}
+
+.resource_list_item p.title {
+  font-size: 100%;
+}
+
+.resource_list_item .avatar_panel {
+  width: 6em;
+  float: left;
+  text-align: center;
+}
+.resource_list_item .main_panel {
+  margin-left: 6.5em;
+}
+
+.resource_list_item .main_panel .preview {
+  float: left;
+  margin: 0 0.5em 0.2em 0;
+}
+
+.resource_list_item .main_panel .desc {
+  border: 1px dotted #999999;
+  margin: 0.5em 0;
+  padding: 0.4em 0.6em;
+  background-color: #FFFFCC;
+  text-align: left;
+  line-height: 1.3;
+  overflow: hidden;
+  word-wrap: break-word;
+}
+
+.resource_list_item .actions {
+  float: right;
+  text-align: left;
+  border: 1px solid #ccc;
+  background-color: #fff;
+  padding: 0.25em;
+  margin: 0 0 0.5em 0.5em;
+}
+.resource_list_item .actions a {
+  display: block;
+  border-bottom: 0px solid #999999;
+  margin-bottom: 0.3em;
+  font-size: 85%;
+  font-weight: normal;
+}
+
+span.owner {
+  font-weight: bold;
+}
+
+div.avatar {
+  text-align:center;
+  padding: 0.2em 0;
 }
\ No newline at end of file

reply via email to

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