[ARVADOS] updated: 35c50eb231e3ea0f469db136c92ce9bb9d853ac1

git at public.curoverse.com git at public.curoverse.com
Wed Feb 4 12:41:04 EST 2015


Summary of changes:
 apps/workbench/app/models/arvados_base.rb           |  2 +-
 apps/workbench/app/models/authorized_key.rb         |  4 ++++
 .../application/_create_new_object_button.html.erb  |  7 +++++++
 apps/workbench/app/views/application/index.html.erb | 21 ++-------------------
 .../collections/_create_new_object_button.html.erb  |  1 +
 .../views/jobs/_create_new_object_button.html.erb   |  1 +
 .../views/users/_create_new_object_button.html.erb  |  6 ++++++
 7 files changed, 22 insertions(+), 20 deletions(-)
 create mode 100644 apps/workbench/app/views/application/_create_new_object_button.html.erb
 create mode 100644 apps/workbench/app/views/collections/_create_new_object_button.html.erb
 create mode 100644 apps/workbench/app/views/jobs/_create_new_object_button.html.erb
 create mode 100644 apps/workbench/app/views/users/_create_new_object_button.html.erb

       via  35c50eb231e3ea0f469db136c92ce9bb9d853ac1 (commit)
      from  08b3d5b95216643081c7749bc84a09659d554b7d (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 35c50eb231e3ea0f469db136c92ce9bb9d853ac1
Author: Tom Clegg <tom at curoverse.com>
Date:   Wed Feb 4 12:36:32 2015 -0500

    2659: Use a partial instead of a switch block for the not-so-generic "create object" button. Don't show one at /jobs or /collections.

diff --git a/apps/workbench/app/models/arvados_base.rb b/apps/workbench/app/models/arvados_base.rb
index bc5a9a3..f19d474 100644
--- a/apps/workbench/app/models/arvados_base.rb
+++ b/apps/workbench/app/models/arvados_base.rb
@@ -311,7 +311,7 @@ class ArvadosBase < ActiveRecord::Base
   end
 
   def self.creatable?
-    current_user
+    current_user.andand.is_active
   end
 
   def self.goes_in_projects?
diff --git a/apps/workbench/app/models/authorized_key.rb b/apps/workbench/app/models/authorized_key.rb
index 2d804e1..d84adea 100644
--- a/apps/workbench/app/models/authorized_key.rb
+++ b/apps/workbench/app/models/authorized_key.rb
@@ -6,4 +6,8 @@ class AuthorizedKey < ArvadosBase
       super
     end
   end
+
+  def self.creatable?
+    current_user
+  end
 end
diff --git a/apps/workbench/app/views/application/_create_new_object_button.html.erb b/apps/workbench/app/views/application/_create_new_object_button.html.erb
new file mode 100644
index 0000000..7e01f57
--- /dev/null
+++ b/apps/workbench/app/views/application/_create_new_object_button.html.erb
@@ -0,0 +1,7 @@
+<div style="display:inline-block">
+  <%= button_to({action: 'create'}, {class: 'btn btn-sm btn-primary'}) do %>
+    <i class="fa fa-fw fa-plus"></i>
+    Add a new
+    <%= controller.controller_name.singularize.humanize.downcase %>
+  <% end %>
+</div>
diff --git a/apps/workbench/app/views/application/index.html.erb b/apps/workbench/app/views/application/index.html.erb
index bb27338..4c7896f 100644
--- a/apps/workbench/app/views/application/index.html.erb
+++ b/apps/workbench/app/views/application/index.html.erb
@@ -4,25 +4,8 @@
 
 <% content_for :tab_line_buttons do %>
 
-  <% if controller.model_class.creatable? and current_user.is_active %>
-
-    <% if controller.model_class.name == 'User' %>
-      <%= link_to setup_user_popup_path,
-        {class: 'btn btn-sm btn-primary', :remote => true, 'data-toggle' =>  "modal",
-          'data-target' => '#user-setup-modal-window', return_to: request.url} do %>
-        <i class="fa fa-fw fa-plus"></i> Add a new user
-      <% end %>
-      <div id="user-setup-modal-window" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
-    <% elsif controller.controller_name == 'manage_account' %>
-      <%# No add button is needed %>
-    <% else %>
-      <%= button_to({action: 'create'}, {class: 'btn btn-sm btn-primary'}) do %>
-        <i class="fa fa-fw fa-plus"></i>
-        Add a new
-        <%= controller.controller_name.singularize.humanize.downcase %>
-      <% end %>
-    <% end %>
-
+  <% if controller.model_class.creatable? %>
+    <%= render partial: 'create_new_object_button' %>
   <% end %>
 
 <% end %>
diff --git a/apps/workbench/app/views/collections/_create_new_object_button.html.erb b/apps/workbench/app/views/collections/_create_new_object_button.html.erb
new file mode 100644
index 0000000..1d8f1c4
--- /dev/null
+++ b/apps/workbench/app/views/collections/_create_new_object_button.html.erb
@@ -0,0 +1 @@
+<%# "Create a new collection" would work, but the search filter on collections#index breaks the tab_line_buttons layout. %>
diff --git a/apps/workbench/app/views/jobs/_create_new_object_button.html.erb b/apps/workbench/app/views/jobs/_create_new_object_button.html.erb
new file mode 100644
index 0000000..c77451e
--- /dev/null
+++ b/apps/workbench/app/views/jobs/_create_new_object_button.html.erb
@@ -0,0 +1 @@
+<%# There is no UI for context-free "create a new job" %>
diff --git a/apps/workbench/app/views/users/_create_new_object_button.html.erb b/apps/workbench/app/views/users/_create_new_object_button.html.erb
new file mode 100644
index 0000000..5458b44
--- /dev/null
+++ b/apps/workbench/app/views/users/_create_new_object_button.html.erb
@@ -0,0 +1,6 @@
+<%= link_to setup_user_popup_path,
+  {class: 'btn btn-sm btn-primary', :remote => true, 'data-toggle' =>  "modal",
+    'data-target' => '#user-setup-modal-window', return_to: request.url} do %>
+  <i class="fa fa-fw fa-plus"></i> Add a new user
+<% end %>
+<div id="user-setup-modal-window" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list