mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-27 18:21:50 +08:00
small permissions interface updates [SCI-6145] (#3620)
Co-authored-by: Anton <anton@scinote.net>
This commit is contained in:
parent
fc866640be
commit
992d3bffa3
7 changed files with 28 additions and 37 deletions
|
@ -3,7 +3,7 @@
|
|||
module UserRolesHelper
|
||||
def user_roles_collection
|
||||
Rails.cache.fetch([current_user, 'available_user_roles']) do
|
||||
@user_roles_collection ||= UserRole.all.pluck(:name, :id)
|
||||
@user_roles_collection ||= UserRole.order(id: :asc).pluck(:name, :id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,9 +22,6 @@
|
|||
} %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type='button' class='btn btn-default' data-dismiss='modal'><%= t('general.cancel')%></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -13,9 +13,6 @@
|
|||
<%= render partial: 'access_permissions/partials/user_assignment', locals: { user_assignment: user_assignment, user: user, resource: experiment } %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type='button' class='btn btn-default' data-dismiss='modal'><%= t('general.cancel')%></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -23,9 +23,6 @@
|
|||
} %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type='button' class='btn btn-default' data-dismiss='modal'><%= t('general.cancel')%></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -13,9 +13,6 @@
|
|||
<%= render partial: 'access_permissions/partials/user_assignment', locals: { user_assignment: user_assignment, user: user, resource: my_module } %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type='button' class='btn btn-default' data-dismiss='modal'><%= t('general.cancel')%></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -26,9 +26,6 @@
|
|||
<li>
|
||||
<a class ="clone-module" href="" data-module-id="<%= my_module.id %>"><%= t('experiments.canvas.edit.clone_module') %></a>
|
||||
</li>
|
||||
<li <%= 'style=display:none;' if my_module.my_module_group.blank? %>>
|
||||
<a class ="clone-module-group" href="" data-module-id="<%= my_module.id %>"><%= t('experiments.canvas.edit.clone_module_group') %></a>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if can_manage_my_module?(my_module) %>
|
||||
<li>
|
||||
|
@ -40,16 +37,22 @@
|
|||
can_manage_my_module_users?(my_module) ? edit_access_permissions_project_experiment_my_module_path(my_module.experiment.project, my_module.experiment, my_module) : access_permissions_project_experiment_my_module_path(my_module.experiment.project, my_module.experiment, my_module),
|
||||
data: { action: 'remote-modal'} %>
|
||||
</li>
|
||||
<% if module_group&.my_modules&.all? { |my_module| can_manage_my_module?(my_module) } %>
|
||||
<li>
|
||||
<a class="move-module-group" href="" data-module-id="<%= my_module.id %>"><%= t('experiments.canvas.edit.move_module_group') %></a>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if can_archive_my_module?(my_module) %>
|
||||
<li>
|
||||
<a class="delete-module" href="" data-module-id="<%= my_module.id %>"><%= t('experiments.canvas.edit.delete_module') %></a>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if can_manage_experiment?(my_module.experiment) %>
|
||||
<li <%= 'style=display:none;' if my_module.my_module_group.blank? %>>
|
||||
<a class ="clone-module-group" href="" data-module-id="<%= my_module.id %>"><%= t('experiments.canvas.edit.clone_module_group') %></a>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if module_group&.my_modules&.all? { |my_module| can_manage_my_module?(my_module) } %>
|
||||
<li>
|
||||
<a class="move-module-group" href="" data-module-id="<%= my_module.id %>"><%= t('experiments.canvas.edit.move_module_group') %></a>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<% if module_group&.my_modules&.all? { |my_module| can_archive_my_module?(my_module) } %>
|
||||
<li data-hook="archive-module-group">
|
||||
<a class ="delete-module-group" href="" data-module-id="<%= my_module.id %>"><%= t('experiments.canvas.edit.delete_module_group') %></a>
|
||||
|
|
|
@ -37,6 +37,22 @@
|
|||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
<!-- Set or view user experiment assignments -->
|
||||
<% if can_manage_experiment_users?(experiment) %>
|
||||
<li class="form-dropdown-item">
|
||||
<%= 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>
|
||||
<% end %>
|
||||
</li>
|
||||
<% else %>
|
||||
<li class="form-dropdown-item">
|
||||
<%= 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>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
<!-- Archive/restore experiment -->
|
||||
<% if experiment.active? && can_archive_experiment?(experiment) %>
|
||||
<li class="form-dropdown-item">
|
||||
|
@ -63,22 +79,6 @@
|
|||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
<!-- Set or view user experiment assignments -->
|
||||
<% if can_manage_experiment_users?(experiment) %>
|
||||
<li class="form-dropdown-item">
|
||||
<%= 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>
|
||||
<% end %>
|
||||
</li>
|
||||
<% else %>
|
||||
<li class="form-dropdown-item">
|
||||
<%= 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>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="form-dropdown-break">
|
||||
<hr>
|
||||
</li>
|
||||
|
|
Loading…
Reference in a new issue