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
''
<% 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| %>
<%= 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>
<% 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>
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
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