Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use admin dashboard functions in user dataset list #1706

Merged
merged 2 commits into from
Jun 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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