Skip to content

Commit

Permalink
Merge pull request #1706 from datadryad/user-profile
Browse files Browse the repository at this point in the history
Use admin dashboard functions in user dataset list
  • Loading branch information
ryscher authored Jun 18, 2024
2 parents c3e1a24 + e823f4a commit afcb8a9
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions app/views/stash_engine/user_admin/_user_datasets.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@
<td>
<div class="c-lined-table__with-actions">
<div class="c-lined-table__data">
<span title="<%= p.title %>"><%= link_to truncate(p.title), stash_url_helpers.edit_histories_path(resource_id: p.resource.id) %></span>
</div>
<% if (p.resource.submitted? && current_user.min_curator?) || p.resource.dataset_in_progress_editor&.id == current_user.id %>
<div class="c-lined-table__actions">
<%= form_with(url: stash_url_helpers.metadata_entry_pages_new_version_path, method: :post) do -%>
<button class="c-admin-edit-icon" title="Edit dataset"><i class="fa fa-pencil" aria-hidden="true"></i></button>
<%= hidden_field_tag :resource_id, p.resource.id %>
<% end %>
<span title="<%= p.title %>"><%= link_to truncate(p.title), stash_url_helpers.show_path(id: p.resource.identifier_str), target: '_blank' %></span>
</div>
<% if policy([:stash_engine, :admin_datasets]).curation_actions? && ((p.resource.permission_to_edit?(user: current_user) && p.resource.last_curation_activity.status == 'submitted') || (p.resource.last_curation_activity.status == 'in_progress' && p.resource.current_editor_id == current_user.id)) %>
<div class="c-lined-table__actions">
<%= form_with(url: stash_url_helpers.metadata_entry_pages_new_version_path, method: :post) do %>
<%= hidden_field_tag :resource_id, p.resource.id, id: "resource_id_#{p.resource.id}" %>
<%= hidden_field_tag :return_url, '/stash/dashboard' %>
<button class="c-admin-edit-icon js-trap-curator-url" title="Edit dataset" aria-label="Edit dataset"><i class="fa fa-pencil" aria-hidden="true"></i></button>
<% end %>
</div>
<% end %>
</div>
</td>
Expand All @@ -58,12 +59,13 @@
<td>
<div class="c-lined-table__with-actions">
<div class="c-lined-table__data"><%= p.edited_by_name_w_role %></div>
<div class="c-lined-table__actions">
<%= form_with(url: stash_url_helpers.edit_histories_path, method: :get) do -%>
<%= hidden_field_tag :resource_id, p.resource.id %>
<button class="c-admin-edit-icon" title="See History"><i class="fa fa-history" aria-hidden="true"></i></button>
<% if policy([:stash_engine, :admin_datasets]).activity_log? %>
<div class="c-lined-table__actions">
<a title="Activity log" aria-label="Activity log" href="<%= stash_url_helpers.activity_log_path(id: p.resource.identifier_id) %>">
<i class="fa fa-clock-o" aria-hidden="true"></i>
</a>
</div>
<% end %>
</div>
</div>
</td>
</tr>
Expand Down

0 comments on commit afcb8a9

Please sign in to comment.