Remove Move button on empty experiments

SCI-328 #close.
This commit is contained in:
Jure Grabnar 2016-08-30 08:26:59 +02:00
parent 25928bfa0b
commit 0c184dcdcf
2 changed files with 12 additions and 6 deletions

View file

@ -6,9 +6,10 @@
<h4 class="modal-title" id="modal-move-module-label"><%=t "experiments.canvas.edit.modal_move_module.title" %></h4>
</div>
<div class="modal-body">
<% if @experiment.project.experiments.is_archived(false).count > 1 %>
<% experiments = @experiment.project.experiments.is_archived(false) %>
<% if experiments.count > 1 %>
<%= bootstrap_form_tag do |f| %>
<%= f.select :experiment_id, @experiment.project.experiments.is_archived(false)
<%= f.select :experiment_id, experiments
.select { |e| e != @experiment }
.collect { |e| [ e.name, e.id ] }, {},
{class: "form-control selectpicker", "data-role" => "clear"} %>
@ -23,7 +24,9 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><%=t "general.cancel" %></button>
<button type="button" class="btn btn-primary" data-action="confirm"><%=t "experiments.canvas.edit.modal_move_module.confirm" %></button>
<% if experiments.count > 1 %>
<button type="button" class="btn btn-primary" data-action="confirm"><%=t "experiments.canvas.edit.modal_move_module.confirm" %></button>
<% end %>
</div>
</div>
</div>

View file

@ -6,9 +6,10 @@
<h4 class="modal-title" id="modal-move-module-group-label"><%=t "experiments.canvas.edit.modal_move_module_group.title" %></h4>
</div>
<div class="modal-body">
<% if @experiment.project.experiments.is_archived(false).count > 1 %>
<% experiments = @experiment.project.experiments.is_archived(false) %>
<% if experiments.count > 1 %>
<%= bootstrap_form_tag do |f| %>
<%= f.select :experiment_id, @experiment.project.experiments.is_archived(false)
<%= f.select :experiment_id, experiments
.select { |e| e != @experiment }
.collect { |e| [ e.name, e.id ] }, {},
{class: "form-control selectpicker", "data-role" => "clear"} %>
@ -23,7 +24,9 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><%=t "general.cancel" %></button>
<button type="button" class="btn btn-primary" data-action="confirm"><%=t "experiments.canvas.edit.modal_move_module_group.confirm" %></button>
<% if experiments.count > 1 %>
<button type="button" class="btn btn-primary" data-action="confirm"><%=t "experiments.canvas.edit.modal_move_module_group.confirm" %></button>
<% end %>
</div>
</div>
</div>