mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-09 21:36:44 +08:00
Changed clone permissions and UI changes for experiment actions [SCI-6756] (#4074)
This commit is contained in:
parent
a23eea7523
commit
bacb1547f2
5 changed files with 57 additions and 25 deletions
|
@ -27,6 +27,14 @@ $color-module-hover: $brand-primary;
|
||||||
|
|
||||||
.actions-button {
|
.actions-button {
|
||||||
margin-right: 15px;
|
margin-right: 15px;
|
||||||
|
|
||||||
|
.fas {
|
||||||
|
margin-right: .4em;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
padding: .5em 1em;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.toolbarButtons {
|
.toolbarButtons {
|
||||||
|
|
|
@ -72,7 +72,7 @@ Canaid::Permissions.register_for(Experiment) do
|
||||||
end
|
end
|
||||||
|
|
||||||
can :clone_experiment do |user, experiment|
|
can :clone_experiment do |user, experiment|
|
||||||
experiment.permission_granted?(user, ExperimentPermissions::MANAGE)
|
experiment.permission_granted?(user, ExperimentPermissions::READ)
|
||||||
end
|
end
|
||||||
|
|
||||||
can :move_experiment do |user, experiment|
|
can :move_experiment do |user, experiment|
|
||||||
|
|
|
@ -3,48 +3,64 @@
|
||||||
data-id="<%= experiment.id %>">
|
data-id="<%= experiment.id %>">
|
||||||
|
|
||||||
<% if can_manage_experiment?(experiment) %>
|
<% if can_manage_experiment?(experiment) %>
|
||||||
<li><%= link_to t('experiments.edit.label_title'),
|
<li>
|
||||||
edit_experiment_url(experiment),
|
<%= link_to edit_experiment_url(experiment),
|
||||||
remote: true,
|
remote: true,
|
||||||
type: 'button',
|
type: 'button',
|
||||||
data: { id: experiment.id },
|
data: { id: experiment.id },
|
||||||
class: 'edit-experiment' %></li>
|
class: 'edit-experiment' do %>
|
||||||
|
<i class="fas fa-pen"></i>
|
||||||
|
<span><%= t('experiments.edit.label_title') %></span>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<li data-hook="experiment-actions-second-child"></li>
|
<li data-hook="experiment-actions-second-child"></li>
|
||||||
<% if can_clone_experiment?(experiment) %>
|
<% if can_clone_experiment?(experiment) %>
|
||||||
<li><%= link_to t('experiments.clone.label_title'),
|
<li>
|
||||||
clone_modal_experiment_url(experiment),
|
<%= link_to clone_modal_experiment_url(experiment),
|
||||||
remote: true, type: 'button',
|
remote: true, type: 'button',
|
||||||
class: 'clone-experiment' %>
|
class: 'clone-experiment' do %>
|
||||||
|
<i class="fas fa-copy"></i>
|
||||||
|
<span><%= t('experiments.clone.label_title') %></span>
|
||||||
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if can_move_experiment?(experiment) %>
|
<% if can_move_experiment?(experiment) %>
|
||||||
<li><%= link_to t('experiments.move.label_title'),
|
<li>
|
||||||
move_modal_experiment_url(experiment),
|
<%= link_to move_modal_experiment_url(experiment),
|
||||||
remote: true, type: 'button',
|
remote: true, type: 'button',
|
||||||
class: 'move-experiment'%>
|
class: 'move-experiment' do %>
|
||||||
|
<i class="fas fa-arrow-right"></i>
|
||||||
|
<span><%= t('experiments.move.label_title') %></span>
|
||||||
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<!-- Set or view user experiment assignments -->
|
<!-- Set or view user experiment assignments -->
|
||||||
<% if can_manage_experiment_users?(experiment) %>
|
<% if can_manage_experiment_users?(experiment) %>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to edit_access_permissions_project_experiment_path(project, experiment), data: { action: 'remote-modal'} do %>
|
<%= link_to edit_access_permissions_project_experiment_path(project, experiment), data: { action: 'remote-modal'} do %>
|
||||||
|
<i class="fas fa-door-open"></i>
|
||||||
<span><%= t('experiments.index.experiment_access') %></span>
|
<span><%= t('experiments.index.experiment_access') %></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
<% else %>
|
<% else %>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to access_permissions_project_experiment_path(project, experiment), data: { action: 'remote-modal'} do %>
|
<%= link_to access_permissions_project_experiment_path(project, experiment), data: { action: 'remote-modal'} do %>
|
||||||
|
<i class="fas fa-door-open"></i>
|
||||||
<span><%= t('experiments.index.experiment_access') %></span>
|
<span><%= t('experiments.index.experiment_access') %></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if can_archive_experiment?(experiment) %>
|
<% if can_archive_experiment?(experiment) %>
|
||||||
<li><%= link_to t('experiments.archive.label_title'),
|
<li>
|
||||||
archive_experiment_url(experiment),
|
<%= link_to archive_experiment_url(experiment),
|
||||||
type: 'button',
|
type: 'button',
|
||||||
method: :post,
|
method: :post,
|
||||||
data: { confirm: t('experiments.canvas.archive_confirm') } %></li>
|
data: { confirm: t('experiments.canvas.archive_confirm') } do %>
|
||||||
|
<i class="fas fa-archive"></i>
|
||||||
|
<span><%= t('experiments.archive.label_title') %></span>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if can_restore_experiment?(experiment) %>
|
<% if can_restore_experiment?(experiment) %>
|
||||||
<% experiment_form = nil %>
|
<% experiment_form = nil %>
|
||||||
|
@ -52,6 +68,12 @@
|
||||||
<% experiment_form = f %>
|
<% experiment_form = f %>
|
||||||
<%= f.hidden_field :archived, value: false %>
|
<%= f.hidden_field :archived, value: false %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<li><a href="#" class="form-submit-link" data-turbolinks="false" data-submit-form="<%= experiment_form.options[:html][:id] %>"><%= t "projects.experiment_archive.restore_option" %></a></li>
|
<li><a href="#" class="form-submit-link" data-turbolinks="false" data-submit-form="<%= experiment_form.options[:html][:id] %>">
|
||||||
|
<i class="fas fa-undo"></i><%= t "projects.experiment_archive.restore_option" %></a></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<li class="form-dropdown-item">
|
||||||
|
<div class="form-dropdown-item-info">
|
||||||
|
<small><%= t('experiments.experiment_id') %>: <strong><%= experiment.code %></strong></small>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
<span class="fas fa-pencil-alt"></span>
|
<span class="fas fa-pencil-alt"></span>
|
||||||
<span class="hidden-xs"><%=t 'experiments.canvas.canvas_edit' %></span>
|
<span class="hidden-xs"><%=t 'experiments.canvas.canvas_edit' %></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% if can_manage_experiment?(@experiment) || can_clone_experiment?(@experiment) %>
|
||||||
<!-- experiment actions -->
|
<!-- experiment actions -->
|
||||||
<span class="dropdown actions-button">
|
<span class="dropdown actions-button">
|
||||||
<button class="btn btn-secondary dropdown-toggle" type="button" id="exActionsMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
<button class="btn btn-secondary dropdown-toggle" type="button" id="exActionsMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||||||
|
|
|
@ -1092,7 +1092,7 @@ en:
|
||||||
more: "more"
|
more: "more"
|
||||||
index:
|
index:
|
||||||
edit_option: "Edit details"
|
edit_option: "Edit details"
|
||||||
clone_option: "Duplicate (as template)"
|
clone_option: "Duplicate as template"
|
||||||
move_option: "Move"
|
move_option: "Move"
|
||||||
archive_option: "Archive"
|
archive_option: "Archive"
|
||||||
archive_confirm: "Are you sure you want to archive this project?"
|
archive_confirm: "Are you sure you want to archive this project?"
|
||||||
|
@ -1134,11 +1134,11 @@ en:
|
||||||
success_flash: "<strong>%{number}</strong> experiment(s) successfully restored."
|
success_flash: "<strong>%{number}</strong> experiment(s) successfully restored."
|
||||||
error_flash: "Failed to restore experiment(s)."
|
error_flash: "Failed to restore experiment(s)."
|
||||||
clone:
|
clone:
|
||||||
modal_title: 'Copy experiment %{experiment} as template'
|
modal_title: 'Duplicate experiment %{experiment} as template'
|
||||||
label_title: 'Copy as template'
|
label_title: 'Duplicate as template'
|
||||||
modal_submit: 'Copy'
|
modal_submit: 'Duplicate'
|
||||||
success_flash: 'Successfully copied experiment %{experiment} as template.'
|
success_flash: 'Successfully duplicated experiment %{experiment} as template.'
|
||||||
error_flash: 'Could not copy the experiment as template.'
|
error_flash: 'Could not duplicate the experiment as template.'
|
||||||
current_project: '(current project)'
|
current_project: '(current project)'
|
||||||
move:
|
move:
|
||||||
modal_title: 'Move experiment %{experiment}'
|
modal_title: 'Move experiment %{experiment}'
|
||||||
|
|
Loading…
Add table
Reference in a new issue