Merge pull request #87 from ZmagoD/zd_SCI_371

hide the dropdown if user has no permissions(technician) [fixes SCI-371]
This commit is contained in:
Zmago Devetak 2016-08-24 11:56:29 +02:00 committed by GitHub
commit afaeab492d
2 changed files with 22 additions and 15 deletions

View file

@ -328,6 +328,13 @@ module PermissionHelper
# ---- EXPERIMENT PERMISSIONS ----
def can_view_experiment_actions(experiment)
can_edit_experiment(experiment) &&
can_clone_experiment(experiment) &&
can_move_experiment(experiment) &&
can_archive_experiment(experiment)
end
def can_create_experiment(project)
is_user_or_higher_of_project(project)
end

View file

@ -2,21 +2,21 @@
<div class="panel panel-default experiment-panel"
data-id="<%= experiment.id %>">
<div class="panel-heading">
<div class="dropdown pull-right">
<button class="btn btn-link dropdown-toggle"
type="button"
id="exActionsMenu-<%= experiment.id %>"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="true">
<span class="visible-xs-inline"><i class="glyphicon glyphicon-sort"></i></span>
<span class="caret"></span>
</button>
<%= render partial: 'experiments/dropdown_actions.html.erb',
locals: { project: @project, experiment: experiment } %>
</div>
<% if can_view_experiment_actions experiment %>
<div class="dropdown pull-right">
<button class="btn btn-link dropdown-toggle"
type="button"
id="exActionsMenu-<%= experiment.id %>"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="true">
<span class="visible-xs-inline"><i class="glyphicon glyphicon-sort"></i></span>
<span class="caret"></span>
</button>
<%= render partial: 'experiments/dropdown_actions.html.erb',
locals: { project: @project, experiment: experiment } %>
</div>
<% end %>
<h3 class="panel-title"><%= link_to experiment.name, canvas_experiment_path(experiment) %></h3>
</div>