2016-02-12 23:52:43 +08:00
|
|
|
<div id="update-canvas"
|
2022-05-09 17:40:31 +08:00
|
|
|
data-can-create-modules="<%= @experiment_managable ? "yes" : "no" %>"
|
|
|
|
data-can-edit-modules="<%= @experiment_managable ? "yes" : "no" %>"
|
|
|
|
data-can-clone-modules="<%= @experiment_managable ? "yes" : "no" %>"
|
|
|
|
data-can-move-modules="<%= @experiment_managable ? "yes" : "no" %>"
|
|
|
|
data-can-delete-modules="<%= @experiment_managable ? "yes" : "no" %>"
|
|
|
|
data-can-reposition-modules="<%= @experiment_managable ? "yes" : "no" %>"
|
|
|
|
data-can-edit-connections="<%= @experiment_managable ? "yes" : "no" %>"
|
2016-07-28 22:41:10 +08:00
|
|
|
data-unsaved-work-text="<%=t "experiments.canvas.edit.unsaved_work" %>"
|
2016-02-12 23:52:43 +08:00
|
|
|
>
|
2019-12-04 18:27:22 +08:00
|
|
|
<%= bootstrap_form_tag url: canvas_experiment_url, method: "post", html: {class: "canvas-header"} do |f| %>
|
2022-05-09 17:40:31 +08:00
|
|
|
<% if @experiment_managable %>
|
2020-04-28 18:30:43 +08:00
|
|
|
<%=link_to "", type: "button", class: "btn btn-primary", id: "canvas-new-module" do %>
|
2018-08-20 19:45:43 +08:00
|
|
|
<span class="hbtn-default">
|
2022-11-22 20:08:56 +08:00
|
|
|
<span class="fas fa-plus"></span>
|
2018-05-15 23:10:31 +08:00
|
|
|
<%= t("experiments.canvas.edit.new_module") %>
|
|
|
|
</span>
|
2018-08-20 19:45:43 +08:00
|
|
|
<span class="hbtn-hover">
|
2018-05-15 23:10:31 +08:00
|
|
|
<em class="hidden-xs"><%= t("experiments.canvas.edit.new_module_hover") %></em>
|
|
|
|
<span class="visible-xs-inline"><%= t("experiments.canvas.edit.new_module") %></span>
|
|
|
|
</span>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
2019-12-04 18:27:22 +08:00
|
|
|
<div class="sci-btn-group pull-right" role="group">
|
2020-01-07 23:13:34 +08:00
|
|
|
<%= link_to canvas_experiment_path(@experiment), type: "button", class: "btn btn-secondary cancel-edit-canvas" do %>
|
2016-07-28 22:41:10 +08:00
|
|
|
<span class="hidden-xs"><%= t("experiments.canvas.edit.cancel") %></span>
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="fas fa-times visible-xs" style="height: 16px;margin-top: 4px;"> </span>
|
2016-02-12 23:52:43 +08:00
|
|
|
<% end %>
|
2020-01-07 23:13:34 +08:00
|
|
|
<%= f.submit class: "btn btn-primary", id: "canvas-save" do %>
|
2018-04-25 19:57:12 +08:00
|
|
|
<span class="visibile-xs"><%= t("experiments.canvas.edit.save_short") %></span>
|
|
|
|
<span class="hidden-xs"><%= t("experiments.canvas.edit.save") %></span>
|
|
|
|
<% end %>
|
2016-02-12 23:52:43 +08:00
|
|
|
</div>
|
|
|
|
<%= hidden_field_tag 'connections', '' %>
|
|
|
|
<%= hidden_field_tag 'positions', '' %>
|
|
|
|
<%= hidden_field_tag 'add', '' %>
|
|
|
|
<%= hidden_field_tag 'add-names', '' %>
|
|
|
|
<%= hidden_field_tag 'rename', '{}' %>
|
2016-08-17 19:48:02 +08:00
|
|
|
<%= hidden_field_tag 'move', '{}' %>
|
2016-02-12 23:52:43 +08:00
|
|
|
<%= hidden_field_tag 'cloned', '' %>
|
|
|
|
<%= hidden_field_tag 'remove', '' %>
|
|
|
|
<%= hidden_field_tag 'module-groups', '{}' %>
|
|
|
|
<% end %>
|
|
|
|
<span style="display: none;" id="dropdown-header-placeholder">
|
2016-07-28 22:41:10 +08:00
|
|
|
<%=t "experiments.canvas.edit.options_header" %>
|
2016-02-12 23:52:43 +08:00
|
|
|
</span>
|
|
|
|
<span style="display: none;" id="edit-link-placeholder">
|
2016-07-28 22:41:10 +08:00
|
|
|
<%=t "experiments.canvas.edit.edit_module" %>
|
2016-02-12 23:52:43 +08:00
|
|
|
</span>
|
|
|
|
<span style="display: none;" id="clone-link-placeholder">
|
2016-07-28 22:41:10 +08:00
|
|
|
<%=t "experiments.canvas.edit.clone_module" %>
|
2016-02-12 23:52:43 +08:00
|
|
|
</span>
|
|
|
|
<span style="display: none;" id="clone-group-link-placeholder">
|
2016-07-28 22:41:10 +08:00
|
|
|
<%=t "experiments.canvas.edit.clone_module_group" %>
|
2016-02-12 23:52:43 +08:00
|
|
|
</span>
|
2016-08-23 16:00:34 +08:00
|
|
|
<span style="display: none;" id="move-link-placeholder">
|
|
|
|
<%=t "experiments.canvas.edit.move_module" %>
|
|
|
|
</span>
|
|
|
|
<span style="display: none;" id="move-group-link-placeholder">
|
|
|
|
<%=t "experiments.canvas.edit.move_module_group" %>
|
|
|
|
</span>
|
2016-02-12 23:52:43 +08:00
|
|
|
<span style="display: none;" id="delete-link-placeholder">
|
2016-07-28 22:41:10 +08:00
|
|
|
<%=t "experiments.canvas.edit.delete_module" %>
|
2016-02-12 23:52:43 +08:00
|
|
|
</span>
|
|
|
|
<span style="display: none;" id="delete-group-link-placeholder">
|
2016-07-28 22:41:10 +08:00
|
|
|
<%=t "experiments.canvas.edit.delete_module_group" %>
|
2016-02-12 23:52:43 +08:00
|
|
|
</span>
|
|
|
|
<span style="display: none;" id="drag-connections-placeholder">
|
2016-07-28 22:41:10 +08:00
|
|
|
<%=t "experiments.canvas.edit.drag_connections" %>
|
2016-02-12 23:52:43 +08:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div id="diagram-container">
|
2022-05-09 17:40:31 +08:00
|
|
|
<% if @experiment_managable %>
|
2018-02-07 18:49:15 +08:00
|
|
|
<div id="diagram" class="diagram">
|
|
|
|
<% my_modules.each do |my_module| %>
|
2021-10-13 16:08:39 +08:00
|
|
|
<% if can_read_my_module?(my_module) %>
|
|
|
|
<%= render partial: "canvas/edit/my_module", locals: { experiment: @experiment, my_module: my_module } %>
|
|
|
|
<% else %>
|
|
|
|
<%= render partial: "canvas/full_zoom/my_module_hidden", locals: { experiment: @experiment, my_module: my_module } %>
|
|
|
|
<% end %>
|
2018-02-07 18:49:15 +08:00
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
2016-02-12 23:52:43 +08:00
|
|
|
</div>
|
|
|
|
|
2018-02-07 18:49:15 +08:00
|
|
|
<%-# Since we need to preload modals, we just check permission for experiment, instead of permissions for every module and module group -%>
|
2022-05-09 17:40:31 +08:00
|
|
|
<% if @experiment_managable %>
|
2016-07-27 17:35:07 +08:00
|
|
|
<%= render partial: "canvas/edit/modal/new_module", locals: {experiment: @experiment} %>
|
|
|
|
<%= render partial: "canvas/edit/modal/edit_module", locals: {experiment: @experiment } %>
|
2016-08-17 19:48:02 +08:00
|
|
|
<%= render partial: "canvas/edit/modal/move_module", locals: {experiment: @experiment } %>
|
2016-08-19 23:11:17 +08:00
|
|
|
<%= render partial: "canvas/edit/modal/move_module_group", locals: {experiment: @experiment } %>
|
2016-07-27 17:35:07 +08:00
|
|
|
<%= render partial: "canvas/edit/modal/delete_module", locals: {experiment: @experiment} %>
|
2018-02-07 18:49:15 +08:00
|
|
|
<%= render partial: "canvas/edit/modal/delete_module_group", locals: {experiment: @experiment} %>
|
2016-02-12 23:52:43 +08:00
|
|
|
<% end %>
|