education/classroom

View on GitHub
app/views/stafftools/groupings/show.html.erb

Summary

Maintainability
Test Coverage
<div class="site-content">
  <div class="d-flex flex-md-row flex-items-center stafftools-page-header">
    <div class="col-1 d-flex">
      <span class="assignment-icon assignment-icon-group">
        <%= octicon 'organization', height: 22 %>
      </span>
    </div>

    <div class="col-10 col-md-10 d-flex flex-column">
      <h2 class="stafftools-heading">
        <%= @grouping.title %>
      </h2>

      <p class="assignment-type text-gray">Grouping</p>
    </div>
  </div>

  <div class="boxed-group">
    <h3>Grouping information</h3>

    <div class="boxed-group-inner">
      <% organization = @grouping.organization %>

      <table>
        <tr>
          <td class="text-emphasized">ID</td>
          <td><%= @grouping.id %></td>
        </tr>
        <tr>
          <td class="text-emphasized">Owned by</td>
          <td><%= link_to organization.title, stafftools_organization_path(organization.id) %></td>
        </tr>
        <tr>
          <td class="text-emphasized">Created on</td>
          <td><%= local_time(@grouping.created_at) %></td>
        </tr>
      </table>
    </div>
  </div>

  <% if @grouping.groups.present? %>
    <div class="boxed-group">
      <h3>Groups</h3>

      <div class="boxed-group-inner">
        <ul class="boxed-group-list standalone">
          <%= render partial: 'stafftools/groupings/group', collection: @grouping.groups %>
        </ul>
      </div>
    </div>
  <% end %>

  <div class="boxed-group dangerzone">
    <h3>Dangerzone</h3>

    <div class="boxed-group-inner">
      <p>
        <a data-remodal-target="delete-grouping" class="btn btn-danger">Delete this grouping</a>
      </p>

      <div class="remodal text-left" data-remodal-id="delete-grouping">
        <button data-remodal-action="close" class="remodal-close"><%= octicon 'x' %></button>
        <h2 class="remodal-header">Are you ABSOLUTELY sure?</h2>

        <div class="remodal-warning">
          Unexpected things will happen if you don't read this!
        </div>

        <div class="remodal-description">
          <p>
            This action <strong>CANNOT</strong> be undone.<br>
            Please note this will delete the grouping as well as all groups and group-assignments belonging to the grouping.
          </p>
        </div>

        <%= form_for @grouping, url: stafftools_grouping_path(@grouping.id), html: { "data-name" => @grouping.id, method: 'delete' } do |f| %>
          <dl class="form js-normalize-submit">
            <dt>Please type the ID (<%= @grouping.id %>) of the grouping to confirm</dt>
            <dd><input type="text" class="js-input-block" autofocus></dd>
          </dl>

          <%= f.submit 'Delete this Grouping', class: 'btn btn-danger btn-block js-submit', disabled: true %>
        <% end %>
      </div>
    </div>
  </div>
</div>