[ARVADOS] updated: 289e5d15402d12ad02ac77e911aca7a32746c905

git at public.curoverse.com git at public.curoverse.com
Tue Aug 19 09:40:12 EDT 2014


Summary of changes:
 .../app/controllers/collections_controller.rb      |  5 +++-
 .../app/controllers/projects_controller.rb         | 12 +++++-----
 apps/workbench/app/helpers/application_helper.rb   |  8 +++----
 .../app/views/collections/_choose_rows.html.erb    | 14 +++++++++++
 .../collections/_show_source_summary.html.erb      |  9 --------
 apps/workbench/app/views/collections/show.html.erb | 27 ++++++++++++++++------
 .../views/projects/_show_contents_rows.html.erb    |  2 +-
 7 files changed, 48 insertions(+), 29 deletions(-)

       via  289e5d15402d12ad02ac77e911aca7a32746c905 (commit)
      from  6db406e9a2fc78ed204460deb73151f44d94b030 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 289e5d15402d12ad02ac77e911aca7a32746c905
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Tue Aug 19 09:40:07 2014 -0400

    3504: Fix collection chooser.  Fix generic link render to use uuid if nothing
    else is available.  Fix tags for objects other than collections.

diff --git a/apps/workbench/app/controllers/collections_controller.rb b/apps/workbench/app/controllers/collections_controller.rb
index 4003fae..57c6bb5 100644
--- a/apps/workbench/app/controllers/collections_controller.rb
+++ b/apps/workbench/app/controllers/collections_controller.rb
@@ -45,6 +45,9 @@ class CollectionsController < ApplicationController
   def choose
     params[:limit] ||= 40
 
+    find_objects_for_index
+    @collections = @objects
+
     @filters += [['link_class','=','name'],
                  ['head_uuid','is_a','arvados#collection']]
 
@@ -55,7 +58,7 @@ class CollectionsController < ApplicationController
 
     @objects = Collection.
       filter([['uuid','in', at name_links.collect(&:head_uuid)]])
-    preload_links_for_objects @objects.to_a
+    preload_links_for_objects (@collections.to_a + @objects.to_a)
     super
   end
 
diff --git a/apps/workbench/app/controllers/projects_controller.rb b/apps/workbench/app/controllers/projects_controller.rb
index a45c740..ea9e503 100644
--- a/apps/workbench/app/controllers/projects_controller.rb
+++ b/apps/workbench/app/controllers/projects_controller.rb
@@ -176,13 +176,13 @@ class ProjectsController < ApplicationController
                                   filters: @filters,
                                   offset: @offset)
       @next_page_href = next_page_href(partial: :contents_rows)
+    end
 
-      uuids = @objects.map { |ob| ob.uuid }
-      @object_tags = {}
-      Link.limit(uuids.length*20).filter([["head_uuid", "in", uuids], ["link_class", "=", "tag"]]).each do |t|
-        @object_tags[t.head_uuid] ||= []
-        @object_tags[t.head_uuid] << t
-      end
+    uuids = @objects.map { |ob| ob.uuid }
+    @object_tags = {}
+    Link.limit(uuids.length*20).filter([["head_uuid", "in", uuids], ["link_class", "=", "tag"]]).each do |t|
+      @object_tags[t.head_uuid] ||= []
+      @object_tags[t.head_uuid] << t
     end
   end
 
diff --git a/apps/workbench/app/helpers/application_helper.rb b/apps/workbench/app/helpers/application_helper.rb
index 7872792..e3f6fdc 100644
--- a/apps/workbench/app/helpers/application_helper.rb
+++ b/apps/workbench/app/helpers/application_helper.rb
@@ -107,6 +107,9 @@ module ApplicationHelper
             end
           end
         end
+        if link_name.nil? or link_name.empty?
+          link_name = attrvalue
+        end
         if opts[:with_class_name]
           link_name = "#{resource_class.to_s}: #{link_name}"
         end
@@ -133,9 +136,6 @@ module ApplicationHelper
       if opts[:no_link]
         raw(link_name)
       else
-        if link_name.nil? or link_name.empty?
-          link_name = "(unnamed)"
-        end
         (link_to raw(link_name), { controller: resource_class.to_s.tableize, action: 'show', id: ((opts[:name_link].andand.uuid) || link_uuid) }, style_opts) + raw(tags)
       end
     else
@@ -186,8 +186,6 @@ module ApplicationHelper
     @unique_id ||= (Time.now.to_f*1000000).to_i
     span_id = object.uuid.to_s + '-' + attr.to_s + '-' + (@unique_id += 1).to_s
 
-    puts "Span #{object.inspect} #{(object.andand.default_name || 'none')}"
-
     span_tag = content_tag 'span', attrvalue.to_s, {
       "data-emptytext" => ('(none)'),
       "data-placement" => "bottom",
diff --git a/apps/workbench/app/views/collections/_choose_rows.html.erb b/apps/workbench/app/views/collections/_choose_rows.html.erb
index 8079eb4..036e619 100644
--- a/apps/workbench/app/views/collections/_choose_rows.html.erb
+++ b/apps/workbench/app/views/collections/_choose_rows.html.erb
@@ -1,3 +1,17 @@
+<% @collections.each do |object| %>
+    <div class="row filterable selectable" data-object-uuid="<%= object.uuid %>"
+         data-preview-href="<%= chooser_preview_url_for object %>"
+         style="margin-left: 1em; border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #DDDDDD">
+      <i class="fa fa-fw fa-archive"></i>
+      <%= object.name %>
+      <% links_for_object(object).each do |tag| %>
+        <% if tag.link_class == 'tag' %>
+          <span class="label label-info"><%= tag.name %></span>
+        <% end %>
+      <% end %>
+    </div>
+<% end %>
+
 <% @name_links.each do |name_link| %>
   <% if (object = get_object(name_link.head_uuid)) %>
     <div class="row filterable selectable" data-object-uuid="<%= name_link.uuid %>"
diff --git a/apps/workbench/app/views/collections/_show_source_summary.html.erb b/apps/workbench/app/views/collections/_show_source_summary.html.erb
index 7479a30..e3f2995 100644
--- a/apps/workbench/app/views/collections/_show_source_summary.html.erb
+++ b/apps/workbench/app/views/collections/_show_source_summary.html.erb
@@ -1,12 +1,3 @@
-<% if @object.uuid.match /[0-9a-f]{32}/ %>
-<p>Found in collections:<p>
-<p>
-<% cols = Collection.filter([["portable_data_hash", "=", @object.portable_data_hash]]).each do |c| %>
-  <%= link_to_if_arvados_object c.owner_uuid, {:friendly_name => true} %> / <%= link_to_if_arvados_object c, {:friendly_name => true} %><br>
-<% end %>
-</p>
-<% end %>
-
 <% if not (@output_of.andand.any? or @log_of.andand.any?) %>
   <p><i>No source information available.</i></p>
 <% end %>
diff --git a/apps/workbench/app/views/collections/show.html.erb b/apps/workbench/app/views/collections/show.html.erb
index ee809d6..98bfafb 100644
--- a/apps/workbench/app/views/collections/show.html.erb
+++ b/apps/workbench/app/views/collections/show.html.erb
@@ -3,17 +3,30 @@
     <div class="panel panel-info">
       <div class="panel-heading">
 	<h3 class="panel-title">
-	  <%= if @object.respond_to? :name
-                render_editable_attribute @object, :name
-              else
-                @name_link.andand.name || @object.uuid
-              end%>
+          <% if @object.uuid.match /[0-9a-f]{32}/ %>
+            Content hash <%= @object.portable_data_hash %>
+          <% else %>
+	    <%= if @object.respond_to? :name
+                  render_editable_attribute @object, :name
+                else
+                  @name_link.andand.name || @object.uuid
+                end %>
+            <% end %>
 	</h3>
       </div>
       <div class="panel-body">
         <img src="/favicon.ico" class="pull-right" alt="" style="opacity: 0.3"/>
-	<p><i>Content hash:</i><br />
-	  <span class="arvados-uuid"><%= link_to @object.portable_data_hash, collection_path(@object.portable_data_hash) %></span></p>
+        <% if @object.uuid.match /[0-9a-f]{32}/ %>
+          <p>Found in collections:<p>
+          <p>
+            <% cols = Collection.filter([["portable_data_hash", "=", @object.portable_data_hash]]).each do |c| %>
+              <%= link_to_if_arvados_object c.owner_uuid, {:friendly_name => true} %> / <%= link_to_if_arvados_object c, {:friendly_name => true} %><br>
+            <% end %>
+          </p>
+        <% else %>
+	  <p><i>Content hash:</i><br />
+	    <span class="arvados-uuid"><%= link_to @object.portable_data_hash, collection_path(@object.portable_data_hash) %></span></p>
+        <% end %>
         <%= render partial: "show_source_summary" %>
       </div>
     </div>
diff --git a/apps/workbench/app/views/projects/_show_contents_rows.html.erb b/apps/workbench/app/views/projects/_show_contents_rows.html.erb
index a1c8fe8..c136187 100644
--- a/apps/workbench/app/views/projects/_show_contents_rows.html.erb
+++ b/apps/workbench/app/views/projects/_show_contents_rows.html.erb
@@ -30,7 +30,7 @@
       <br>
       <span class="tags-span">
     <span class="removable-tag-container">
-    <% if @object_tags[object.uuid] %>
+    <% if @object_tags and @object_tags[object.uuid] %>
       <% @object_tags[object.uuid].each do |tag_link| %>
         <span class="label label-info" data-tag-link-uuid="<%= tag_link.uuid %>">
           <%= link_to tag_link.name, controller: "links", filters: [["link_class", "=", "tag"], ["name", "=", tag_link.name]].to_json %>

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list