<div id="update-canvas"
  data-can-create-modules="<%= can_create_modules(@project) ? "yes" : "no" %>"
  data-can-edit-modules="<%= can_edit_modules(@project) ? "yes" : "no" %>"
  data-can-edit-module-groups="<%= can_edit_module_groups(@project) ? "yes" : "no" %>"
  data-can-clone-modules="<%= can_clone_modules(@project) ? "yes" : "no" %>"
  data-can-delete-modules="<%= can_archive_modules(@project) ? "yes" : "no" %>"
  data-can-reposition-modules="<%= can_reposition_modules(@project) ? "yes" : "no" %>"
  data-can-edit-connections="<%= can_edit_connections(@project) ? "yes" : "no" %>"
  data-unsaved-work-text="<%=t "projects.canvas.edit.unsaved_work" %>"
>
  <%= bootstrap_form_tag url: canvas_project_url, method: "post" do |f| %>
    <div class="btn-group" role="group">
      <%= f.submit class: "btn btn-primary", id: "canvas-save" do %>
        <span class="visibile-xs"><%= t("projects.canvas.edit.save_short") %></span>
        <span class="hidden-xs"><%= t("projects.canvas.edit.save") %></span>
      <% end %>
      <%= link_to canvas_project_path(@project), type: "button", class: "btn btn-default cancel-edit-canvas" do %>
        <span class="hidden-xs"><%= t("projects.canvas.edit.cancel") %></span>
        <span class="glyphicon glyphicon-remove visible-xs" style="height: 16px;margin-top: 4px;">&nbsp;</span>
      <% end %>
    </div>
    <% if can_create_modules(@project) %>
        <%=link_to "", type: "button", class: "btn btn-default", id: "canvas-new-module" do %>
          <span class="hbtn-default">
            <span class="glyphicon glyphicon-credit-card"></span>
            <%= t("projects.canvas.edit.new_module") %>
          </span>
          <span class="hbtn-hover">
            <span class="glyphicon glyphicon-credit-card"></span>
            <em class="hidden-xs"><%= t("projects.canvas.edit.new_module_hover") %></em>
            <span class="visible-xs-inline"><%= t("projects.canvas.edit.new_module") %></span>
          </span>
        <% end %>
    <% end %>
    <%= hidden_field_tag 'connections', '' %>
    <%= hidden_field_tag 'positions', '' %>
    <%= hidden_field_tag 'add', '' %>
    <%= hidden_field_tag 'add-names', '' %>
    <%= hidden_field_tag 'rename', '{}' %>
    <%= hidden_field_tag 'cloned', '' %>
    <%= hidden_field_tag 'remove', '' %>
    <%= hidden_field_tag 'module-groups', '{}' %>
  <% end %>
  <span style="display: none;" id="dropdown-header-placeholder">
    <%=t "projects.canvas.edit.options_header" %>
  </span>
  <span style="display: none;" id="edit-link-placeholder">
    <%=t "projects.canvas.edit.edit_module" %>
  </span>
  <span style="display: none;" id="edit-group-link-placeholder">
    <%=t "projects.canvas.edit.edit_module_group" %>
  </span>
  <span style="display: none;" id="clone-link-placeholder">
    <%=t "projects.canvas.edit.clone_module" %>
  </span>
  <span style="display: none;" id="clone-group-link-placeholder">
    <%=t "projects.canvas.edit.clone_module_group" %>
  </span>
  <span style="display: none;" id="delete-link-placeholder">
    <%=t "projects.canvas.edit.delete_module" %>
  </span>
  <span style="display: none;" id="delete-group-link-placeholder">
    <%=t "projects.canvas.edit.delete_module_group" %>
  </span>
  <span style="display: none;" id="drag-connections-placeholder">
    <%=t "projects.canvas.edit.drag_connections" %>
  </span>
</div>
<div id="diagram-container">
  <div id="diagram" class="diagram">
    <% my_modules.each do |my_module| %>
      <%= render partial: "canvas/edit/my_module", locals: {project: @project, my_module: my_module} %>
    <% end %>
</div>

<% if can_create_modules(@project) %>
  <%= render partial: "canvas/edit/modal/new_module", locals: {project: @project} %>
<% end %>
<% if can_edit_modules(@project) %>
  <%= render partial: "canvas/edit/modal/edit_module", locals: {project: @project } %>
<% end %>
<% if can_edit_module_groups(@project) %>
  <%= render partial: "canvas/edit/modal/edit_module_group", locals: {project: @project } %>
<% end %>
<% if can_archive_modules(@project) %>
  <%= render partial: "canvas/edit/modal/delete_module", locals: {project: @project} %>
  <%=  render partial: "canvas/edit/modal/delete_module_group", locals: {project: @project} %>
<% end %>
