scinote-web/app/views/experiments/_move_modal.html.erb

46 lines
2.2 KiB
Text
Raw Normal View History

2021-02-11 19:36:39 +08:00
<div class="modal move-experiment-modal"
id="move-experiment-modal-<%= params[:ids] %>"
tabindex="-1"
role="dialog"
aria-labelledby="move-experiment-modal-label">
2023-07-03 17:11:51 +08:00
<%= form_with model: @experiment,
url: move_experiments_path(ids: params[:ids]),
method: :post,
data: { remote: true },
html: { class: 'experiment-action-form' } do |f| %>
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
2023-08-17 19:55:17 +08:00
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="sn-icon sn-icon-close"></i></button>
<h4 class="modal-title" id="move-experiment-modal-label"><%= t("experiments.move.modal_title") %></h5>
</div>
<div class="modal-body">
<p><small><%= t("experiments.move.notice") %></small></p>
<% if @projects.any? && @experiments.all? { |experiment| can_move_experiment?(experiment) } %>
<%= f.select :project_id, options_for_select(@projects.collect { |p| [ p.name, p.id ] }),
{ label: t("experiments.move.target_project") }, { class: "form-control selectpicker", "data-role" => "clear" } %>
<% else %>
<div class="warning-message">
<i class="fas fa-exclamation-triangle"></i>
<% if @projects.blank? %>
<%= t("experiments.move.no_projects") %>
<% elsif !@experiments.all? { |experiment| can_move_experiment?(experiment) } %>
<%= t("experiments.move.task_permission") %>
<% end %>
</div>
<% end %>
</div>
<% params[:ids].each do |id| %>
<%= f.hidden_field :ids, multiple: true, value: id %>
<% end %>
<div class="modal-footer">
2020-01-07 23:13:34 +08:00
<button type="button" class="btn btn-secondary" data-dismiss="modal"><%=t "general.cancel" %></button>
<% if @projects.any? && @experiments.all? { |experiment| can_manage_all_experiment_my_modules?(experiment) } %>
2020-01-07 23:13:34 +08:00
<%= f.submit t("experiments.move.modal_submit"), class: "btn btn-primary" %>
<% end %>
</div>
</div>
</div>
<% end %>
</div>