[ARVADOS] updated: 467b636f7d1b34f7695f55af972ae90132fc8063

git at public.curoverse.com git at public.curoverse.com
Thu Aug 6 12:04:58 EDT 2015


Summary of changes:
 apps/workbench/app/models/arvados_base.rb          |  4 ++++
 apps/workbench/app/models/user.rb                  |  3 +++
 .../application/_delete_object_button.html.erb     |  2 +-
 .../views/application/_show_home_button.html.erb   |  3 +++
 .../app/views/application/_show_recent.html.erb    | 23 +++++++---------------
 5 files changed, 18 insertions(+), 17 deletions(-)
 create mode 100644 apps/workbench/app/views/application/_show_home_button.html.erb

       via  467b636f7d1b34f7695f55af972ae90132fc8063 (commit)
      from  75eaaaa74a4a7ec6821008fe93dbee598ee24dee (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 467b636f7d1b34f7695f55af972ae90132fc8063
Author: radhika <radhika at curoverse.com>
Date:   Thu Aug 6 12:00:20 2015 -0400

    6880: added deletable? method and used to determine whether or not to show this button in the delete_object_button partial.
    6916: created and moved logic into show_home_button partial rather than determine whether or not to show the button in the generic view.

diff --git a/apps/workbench/app/models/arvados_base.rb b/apps/workbench/app/models/arvados_base.rb
index 29379a0..b02db7a 100644
--- a/apps/workbench/app/models/arvados_base.rb
+++ b/apps/workbench/app/models/arvados_base.rb
@@ -357,6 +357,10 @@ class ArvadosBase < ActiveRecord::Base
        (ArvadosBase.find(owner_uuid).writable_by.include? current_user.uuid rescue false)))) or false
   end
 
+  def deletable?
+    editable?
+  end
+
   # Array of strings that are the names of attributes that can be edited
   # with X-Editable.
   def editable_attributes
diff --git a/apps/workbench/app/models/user.rb b/apps/workbench/app/models/user.rb
index 7aaa4fe..3b5b308 100644
--- a/apps/workbench/app/models/user.rb
+++ b/apps/workbench/app/models/user.rb
@@ -60,4 +60,7 @@ class User < ArvadosBase
                                                params))
   end
 
+  def deletable?
+    false
+  end
 end
diff --git a/apps/workbench/app/views/application/_delete_object_button.html.erb b/apps/workbench/app/views/application/_delete_object_button.html.erb
index 6d6383e..086484c 100644
--- a/apps/workbench/app/views/application/_delete_object_button.html.erb
+++ b/apps/workbench/app/views/application/_delete_object_button.html.erb
@@ -1,4 +1,4 @@
-<% if object.editable? %>
+<% if object.editable? and object.deletable? %>
   <%= link_to({action: 'destroy', id: object.uuid}, method: :delete, remote: true, data: {confirm: "Really delete #{object.class_for_display.downcase} '#{object.friendly_link_name}'?"}) do %>
     <i class="glyphicon glyphicon-trash"></i>
   <% end %>
diff --git a/apps/workbench/app/views/application/_show_home_button.html.erb b/apps/workbench/app/views/application/_show_home_button.html.erb
new file mode 100644
index 0000000..0acd384
--- /dev/null
+++ b/apps/workbench/app/views/application/_show_home_button.html.erb
@@ -0,0 +1,3 @@
+<% if (current_user.is_admin and controller.model_class == User) %>
+  <%= link_to 'Home', "/projects/#{object.uuid}" %>
+<% end %>
diff --git a/apps/workbench/app/views/application/_show_recent.html.erb b/apps/workbench/app/views/application/_show_recent.html.erb
index f423c04..8712c0a 100644
--- a/apps/workbench/app/views/application/_show_recent.html.erb
+++ b/apps/workbench/app/views/application/_show_recent.html.erb
@@ -8,9 +8,6 @@
 
 <% attr_blacklist = ' created_at modified_at modified_by_user_uuid modified_by_client_uuid updated_at owner_uuid group_class properties' %>
 
-<% show_home_link = (current_user.is_admin and controller.model_class == User) %>
-<% show_delete_btn = (controller.model_class != User) %>
-
 <%= render partial: "paging", locals: {results: objects, object: @object} %>
 
 <%= form_tag do |f| %>
@@ -28,11 +25,9 @@
         <%= controller.model_class.attribute_info[attr.to_sym].andand[:column_heading] or attr.sub /_uuid/, '' %>
       </th>
       <% end %>
-      <% if show_home_link %>
-        <th class="arv-user-home">
-          <!-- a column for user's home -->
-        </th>
-      <% end %>
+      <th>
+        <!-- a column for user's home -->
+      </th>
       <th>
         <!-- a column for delete buttons -->
       </th>
@@ -61,15 +56,11 @@
         <% end %>
       </td>
       <% end %>
-      <% if show_home_link %>
-        <td>
-          <%= link_to 'Home', "/projects/#{object.uuid}" %>
-        </td>
-      <% end %>
       <td>
-        <% if show_delete_btn %>
-          <%= render partial: 'delete_object_button', locals: {object:object} %>
-        <% end %>
+        <%= render partial: 'show_home_button', locals: {object:object} %>
+      </td>
+      <td>
+        <%= render partial: 'delete_object_button', locals: {object:object} %>
       </td>
     </tr>
     <% end %>

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list