[ARVADOS] updated: 9d9f6578ada5768205150757f241c66009347884
git at public.curoverse.com
git at public.curoverse.com
Wed Jun 17 17:36:32 EDT 2015
Summary of changes:
apps/workbench/app/controllers/projects_controller.rb | 18 ++++++++++++++----
.../app/views/application/_show_recent.html.erb | 12 ++++++++++++
apps/workbench/test/integration/users_test.rb | 8 +++++++-
3 files changed, 33 insertions(+), 5 deletions(-)
via 9d9f6578ada5768205150757f241c66009347884 (commit)
from e8db6685b64c6853eb3c5d3ee27ba58168c3c8e8 (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 9d9f6578ada5768205150757f241c66009347884
Author: radhika <radhika at curoverse.com>
Date: Wed Jun 17 17:33:46 2015 -0400
6234: admin user can see other users' home projects; also add link to users' home projects in /users page rows.
diff --git a/apps/workbench/app/controllers/projects_controller.rb b/apps/workbench/app/controllers/projects_controller.rb
index c4600f2..4087b59 100644
--- a/apps/workbench/app/controllers/projects_controller.rb
+++ b/apps/workbench/app/controllers/projects_controller.rb
@@ -10,12 +10,22 @@ class ProjectsController < ApplicationController
end
def find_object_by_uuid
- if current_user and params[:uuid] == current_user.uuid
- @object = current_user.dup
- @object.uuid = current_user.uuid
+ if (current_user and params[:uuid] == current_user.uuid) or
+ (resource_class_for_uuid(params[:uuid]) == User)
+ if params[:uuid] != current_user.uuid
+ @object = User.find(params[:uuid])
+ else
+ @object = current_user.dup
+ @object.uuid = current_user.uuid
+ end
+
class << @object
def name
- 'Home'
+ if current_user.uuid == self.uuid
+ 'Home'
+ else
+ "Home for #{self.email}"
+ end
end
def description
''
diff --git a/apps/workbench/app/views/application/_show_recent.html.erb b/apps/workbench/app/views/application/_show_recent.html.erb
index 57a5b74..dd6876d 100644
--- a/apps/workbench/app/views/application/_show_recent.html.erb
+++ b/apps/workbench/app/views/application/_show_recent.html.erb
@@ -8,6 +8,8 @@
<% 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 %>
+
<%= render partial: "paging", locals: {results: objects, object: @object} %>
<%= form_tag do |f| %>
@@ -25,6 +27,11 @@
<%= 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 delete buttons -->
</th>
@@ -53,6 +60,11 @@
<% end %>
</td>
<% end %>
+ <% if show_home_link %>
+ <td>
+ <%= link_to 'Home', "/projects/#{object.uuid}" %>
+ </td>
+ <% end %>
<td>
<%= render partial: 'delete_object_button', locals: {object:object} %>
</td>
diff --git a/apps/workbench/test/integration/users_test.rb b/apps/workbench/test/integration/users_test.rb
index 4615f84..8de7e9e 100644
--- a/apps/workbench/test/integration/users_test.rb
+++ b/apps/workbench/test/integration/users_test.rb
@@ -218,10 +218,15 @@ class UsersTest < ActionDispatch::IntegrationTest
within('tr', text: user['uuid']) do
assert_text user['email']
+ if username == 'admin'
+ assert_selector 'a', text: 'Home'
+ else
+ assert_no_selector 'a', text: 'Home'
+ end
assert_selector 'a', text: 'Show'
find('a', text: 'Show').click
end
- assert_selector 'a', text:'Attributes'
+ assert_selector 'a', text: 'Attributes'
end
end
@@ -233,6 +238,7 @@ class UsersTest < ActionDispatch::IntegrationTest
active_user = api_fixture('users', 'active')
within('tr', text: active_user['uuid']) do
assert_text active_user['email']
+ assert_selector "a[href=\"/projects/#{active_user['uuid']}\"]", text: 'Home'
assert_selector 'a', text: 'Show'
find('a', text: 'Show').click
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list