scinote-web/app/views/experiments/canvas.html.erb
2023-06-02 13:52:22 +02:00

76 lines
3.9 KiB
Text

<% provide(:head_title, t("experiments.canvas.head_title", project: h(@project.name)).html_safe) %>
<% provide(:sidebar_title, t("sidebar.my_modules.sidebar_title")) %>
<% provide(:sidebar_url, sidebar_experiment_path(@experiment)) %>
<% provide(:container_class, 'no-second-nav-container') %>
<%= content_for :sidebar do %>
<%= render partial: 'shared/sidebar/my_modules.html.erb', locals: { experiment: @experiment, my_modules: @active_modules } %>
<% end %>
<div class="content-pane flexible experiment-new-my_module" id="experiment-canvas">
<%= render partial: 'experiments/show_header' %>
<div class="toolbar-row" id="diagram-buttons" data-width-breakpoint="750">
<span class="left" id="toolbar-left-block">
<% if can_manage_experiment?(@experiment) %>
<%= link_to modules_new_experiment_path(@experiment, view_mode: 'canvas'),
class: 'btn btn-primary new-my-module-button',
data: { view_mode: 'active' },
remote: true do %>
<span class="fas fa-plus"></span>
<span class="hidden-sm hidden-xs"><%= t('experiments.canvas.new_my_module') %></span>
<% end %>
<%=link_to canvas_edit_experiment_url(@experiment),
remote: true,
type: 'button',
id: 'edit-canvas-button',
data: { action: 'edit' },
class: 'ajax btn btn-light' do %>
<span class="fas fa-pencil-alt"></span>
<span class="hidden-sm hidden-xs"><%= t('experiments.canvas.canvas_edit') %></span>
<% end %>
<% end %>
</span>
<%= render partial: 'task_view_dropdowns.html.erb' %>
<span class="right">
<div id="zoom-level-buttons" class="sci-toggles-group change-canvas-view" data-toggle="buttons">
<span class="hidden-sm hidden-xs zoom-text"><%=t 'experiments.canvas.zoom' %></span>
<input type="radio" name="canvas-format" class="sci-toggle-item" checked>
<%=link_to canvas_full_zoom_experiment_path(@experiment), remote: true, type: "button", class: "ajax sci-toggle-item-label", "data-action" => "full_zoom", "data-toggle" => "button", "aria-pressed" => true do %>
<%= render partial: 'experiments/canvas_svg_icons', locals: { type: 'full' } %>
<% end %>
<input type="radio" name="canvas-format" class="sci-toggle-item" >
<%=link_to canvas_medium_zoom_experiment_path(@experiment), remote: true, type: "button", class: "ajax sci-toggle-item-label", "data-action" => "medium_zoom" do %>
<%= render partial: 'experiments/canvas_svg_icons', locals: { type: 'medium' } %>
<% end %>
<input type="radio" name="canvas-format" class="sci-toggle-item" >
<%=link_to canvas_small_zoom_experiment_path(@experiment), remote: true, type: "button", class: "ajax sci-toggle-item-label", "data-action" => "small_zoom" do %>
<%= render partial: 'experiments/canvas_svg_icons', locals: { type: 'small' } %>
<% end %>
</div>
</span>
</div>
<% if @active_modules %>
<div id="canvas-container" data-project-id="<%= @project.id %>" data-module-tags-url="<%= my_module_tags_experiment_path(@experiment, format: :json) %>">
<%= render partial: 'canvas/full_zoom', locals: { experiment: @experiment, my_modules: @active_modules } %>
</div>
<% else %>
<div class="pt-10">
<em><%= t('experiments.empty_state.no_active_modules_archived_branch') %></em>
</div>
<% end %>
</div>
<!-- Manage tags modal -->
<%= render partial: "my_modules/modals/manage_module_tags_modal", locals: { my_module: nil } %>
<!-- Initialize dropdown actions -->
<%= javascript_include_tag("experiments/dropdown_actions") %>
<%= javascript_include_tag("experiments/show") %>
<!-- Include all the neccesary JS libraries -->
<%= javascript_include_tag("eventPause-min", nonce: true) %>
<%= javascript_include_tag("projects/canvas") %>