Fix up table columns, use explicit Open button instead of linking uuid
authorTom Clegg <tom@curoverse.com>
Wed, 30 Apr 2014 22:22:28 +0000 (18:22 -0400)
committerTom Clegg <tom@curoverse.com>
Wed, 30 Apr 2014 22:22:28 +0000 (18:22 -0400)
apps/workbench/app/controllers/folders_controller.rb
apps/workbench/app/models/arvados_base.rb
apps/workbench/app/views/application/_content.html.erb
apps/workbench/app/views/application/_show_recent.html.erb
apps/workbench/app/views/application/index.html.erb
apps/workbench/app/views/folders/show.html.erb

index 3f536fbea4eeec21c1e30322daf123b613dcb16a..566b1a9da3277c199e5dd56da225dde17319e918 100644 (file)
@@ -3,8 +3,38 @@ class FoldersController < ApplicationController
     Group
   end
 
+  def index_pane_list
+    %w(My_folders Shared_with_me)
+  end
+
   def index
-    @objects = Group.where group_class: 'folder'
+    @my_folders = []
+    @shared_with_me = []
+    @objects = Group.where(group_class: 'folder').order('name')
+    owner_of = {}
+    moretodo = true
+    while moretodo
+      moretodo = false
+      @objects.each do |folder|
+        if !owner_of[folder.uuid]
+          moretodo = true
+          owner_of[folder.uuid] = folder.owner_uuid
+        end
+        if owner_of[folder.owner_uuid]
+          if owner_of[folder.uuid] != owner_of[folder.owner_uuid]
+            owner_of[folder.uuid] = owner_of[folder.owner_uuid]
+            moretodo = true
+          end
+        end
+      end
+    end
+    @objects.each do |folder|
+      if owner_of[folder.uuid] == current_user.uuid
+        @my_folders << folder
+      else
+        @shared_with_me << folder
+      end
+    end
   end
 
   def show
index 45a4d8b910941cbdff217c9e94df356844a9690b..9229cfcf7cacbedb2354f87e4ccaa873355a1056 100644 (file)
@@ -25,17 +25,23 @@ class ArvadosBase < ActiveRecord::Base
     super(*args)
     @attribute_sortkey ||= {
       'id' => nil,
-      'uuid' => '000',
-      'owner_uuid' => '001',
-      'created_at' => '002',
-      'modified_at' => '003',
-      'modified_by_user_uuid' => '004',
-      'modified_by_client_uuid' => '005',
-      'name' => '050',
-      'tail_uuid' => '100',
-      'head_uuid' => '101',
-      'info' => 'zzz-000',
-      'updated_at' => 'zzz-999'
+      'name' => '000',
+      'owner_uuid' => '002',
+      'event_type' => '100',
+      'link_class' => '100',
+      'group_class' => '100',
+      'tail_uuid' => '101',
+      'head_uuid' => '102',
+      'object_uuid' => '102',
+      'summary' => '104',
+      'description' => '104',
+      'properties' => '150',
+      'info' => '150',
+      'created_at' => '200',
+      'modified_at' => '201',
+      'modified_by_user_uuid' => '202',
+      'modified_by_client_uuid' => '203',
+      'uuid' => '999',
     }
   end
 
index 53444a5c9c72defe283deff498996f1c8ffb7782..8a0624b7afc9a7523a716599964e6fbde8a8b8db 100644 (file)
@@ -4,7 +4,7 @@
 <% pane_list ||= %w(recent) %>
 <% panes = Hash[pane_list.map { |pane|
      [pane, render(partial: 'show_' + pane.downcase,
-                   locals: { comparable: comparable })]
+                   locals: { comparable: comparable, objects: @objects })]
    }.compact] %>
 
 <ul class="nav nav-tabs">
index aabd0217efb3cc6fa82eaaec0b02da329acee3bc..ab1cd7f7af5d8835c0c5fc6053c6001d7900a467 100644 (file)
@@ -1,4 +1,4 @@
-<% if @objects.empty? %>
+<% if objects.empty? %>
 <br/>
 <p style="text-align: center">
   No <%= controller.controller_name.humanize.downcase %> to display.
@@ -6,9 +6,9 @@
 
 <% else %>
 
-<% attr_blacklist = ' created_at modified_at modified_by_user_uuid modified_by_client_uuid updated_at' %>
+<% attr_blacklist = ' created_at modified_at modified_by_user_uuid modified_by_client_uuid updated_at owner_uuid group_class' %>
 
-<%= render partial: "paging", locals: {results: @objects, object: @object} %>
+<%= render partial: "paging", locals: {results: objects, object: @object} %>
 
 <%= form_tag do |f| %>
 
@@ -16,7 +16,8 @@
   <thead>
     <tr>
       <th></th>
-      <% @objects.first.attributes_for_display.each do |attr, attrvalue| %>
+      <th></th>
+      <% objects.first.attributes_for_display.each do |attr, attrvalue| %>
       <% next if attr_blacklist.index(" "+attr) %>
       <th class="arv-attr-<%= attr %>">
         <%= controller.model_class.attribute_info[attr.to_sym].andand[:column_heading] or attr.sub /_uuid/, '' %>
   </thead>
       
   <tbody>
-    <% @objects.each do |object| %>
+    <% objects.each do |object| %>
     <tr data-object-uuid="<%= object.uuid %>">
       <td>
         <%= render :partial => "selection_checkbox", :locals => {:object => object} %>
       </td>
+      <td>
+        <%= render :partial => "show_object_button", :locals => {object: object} %>
+      </td>
 
       <% object.attributes_for_display.each do |attr, attrvalue| %>
       <% next if attr_blacklist.index(" "+attr) %>
       <td class="arv-object-<%= object.class.to_s %> arv-attr-<%= attr %>">
         <% if attr == 'uuid' %>
-        <%= link_to_if_arvados_object object %>
-        <%= link_to_if_arvados_object(object, { link_text: raw('<i class="icon-hand-right"></i>') }) %>
+        <span class="arvados-uuid"><%= attrvalue %></span>
         <% else %>
         <% if object.attribute_editable? attr %>
         <%= render_editable_attribute object, attr %>
@@ -65,6 +68,6 @@
 
 <% end %>
 
-<%= render partial: "paging", locals: {results: @objects, object: @object} %>
+<%= render partial: "paging", locals: {results: objects, object: @object} %>
 
 <% end %>
index a32e7bfdb9ff897d6ca6fc18735d9b774049cc61..20af6485b088c67f4ad6ae612ffc63916ead8c4e 100644 (file)
@@ -1,5 +1,5 @@
 <% content_for :page_title do %>
-<%= controller.model_class.to_s.pluralize.underscore.capitalize.gsub('_', ' ') %>
+<%= controller.controller_name.humanize.capitalize %>
 <% end %>
 
 <% content_for :tab_line_buttons do %>
index c7db5623526f79e05459e322590bfb75107c06cd..ec79e7b9a88f5e20837c831927fa2cb7af27b588 100644 (file)
       <div class="panel-body">
         <p>
         </p>
-        <table class="table">
+        <table class="table table-condensed arv-index">
           <tbody>
             <colgroup>
+              <col width="3%" />
+              <col width="8%" />
               <col width="30%" />
-              <col width="20%" />
-              <col width="20%" />
-              <col width="30%" />
+              <col width="15%" />
+              <col width="15%" />
+              <col width="29%" />
             </colgroup>
             <% @objects.each do |object| %>
             <tr>
+              <td>
+                <%= render :partial => "selection_checkbox", :locals => {object: object} %>
+              </td>
+              <td>
+                <%= render :partial => "show_object_button", :locals => {object: object} %>
+              </td>
               <td>
                 <% name_link = @objects.links_for(object, 'name').first || Link.new(link_class: "name", owner_uuid: @object.uuid, tail_uuid: @object.uuid, head_uuid: object.uuid, name: "") %>
                 <%= render_editable_attribute name_link, 'name', nil, { 'data-emptytext' => "Unnamed #{object.class}" } %>
                 </span>
               </td>
               <td class="arvados-uuid">
-                <%= link_to_if_arvados_object(object, {no_tags: true}) %>
+                <%= object.uuid %>
               </td>
             </tr>
             <% end %>
           <thead>
             <tr>
               <th>
-                Name
               </th>
               <th>
               </th>
               <th>
-                Modified
+                name
+              </th>
+              <th>
+                type
+              </th>
+              <th>
+                modified
               </th>
               <th>
-                UUID
+                uuid
               </th>
             </tr>
           </thead>