education/classroom

View on GitHub
app/views/organizations/new.html.erb

Summary

Maintainability
Test Coverage
<div class="container-lg p-responsive">
  <div class="Subhead Subhead--spacious">
    <div class="Subhead-heading"><%= t('views.organizations.select_organization') %></div>
  </div>

  <% if @users_github_organizations.empty? %>
    <div class="blankslate large-format spacious clean-background">
      <h3><%= t('views.organizations.no_organizations') %></h3>

      <p><%= t('views.organizations.please_create_or_authorize_new_organization', authorize_href: link_to(t('views.organizations.authorize_organization_access_link'), github_access_management_url, target: '_blank')).html_safe %></p>
    </div>
  <% else %>
    <%= form_for @organization do |f| %>
      <%= render 'shared/error_messages', object: f.object %>

      <div class="d-flex flex-wrap gutter-condensed">
        <% @users_github_organizations.each do |org| %>
          <div class="col-6 col-md-4 mb-6">
            <% if org[:role] == 'admin' %>
              <%= render partial: 'organization_select', locals: { org: org } %>
            <% else %>
              <%= render partial: 'disabled_organization_select', locals: { org: org } %>
            <% end %>
          </div>
        <% end %>
        <div class="col-6 col-md-4 mb-6">
          <a href="<%= github_access_management_url %>" target="_blank" class="d-flex flex-column flex-justify-center height-full border text-center text-bold p-5">
            <span class="organization-grant-access-text"><%= t('views.organizations.grant_organization_access').html_safe %></span>
          </a>
        </div>
      </div>
    <% end %>
  <% end %>

  <%= render partial: 'shared/pagination', locals: { collection: @users_github_organizations } %>
</div>

<div class="protip">
  <%= octicon 'light-bulb' %> <%= t('views.organizations.grant_organization_access_protip', href: link_to(t('views.organizations.grant_organization_access_link'), github_access_management_url, target: '_blank')).html_safe %>
</div>