diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index dd6d3cb..a84ddbb 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -1,26 +1,30 @@ /* * This is a manifest file that'll be compiled into application.css, which will include all the files * listed below. * * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. * * You're free to add application-wide styles to this file and they'll appear at the bottom of the * compiled file so the styles you add here take precedence over styles defined in any styles * defined in the other CSS/SCSS files in this directory. It is generally better to create a new * file per style scope. * *= require bootstrap.min *= require_tree . *= require_self */ /* Make sure navbar does not overlay body */ body { padding-top: 70px; } /* Reset bootstrap's help cursor on control links */ table a abbr[title] { cursor: pointer; } + +.tab-pane table { + margin-top: 20px; +} diff --git a/app/views/groups/show.html.erb b/app/views/groups/show.html.erb index e3950e3..76610dc 100644 --- a/app/views/groups/show.html.erb +++ b/app/views/groups/show.html.erb @@ -1,31 +1,74 @@ <% content_for :more_breadcrumbs do %> <li> <%= link_to_edit edit_admin_group_path(@group) %> <%= link_to_destroy admin_group_path(@group), method: :delete, data: { confirm: 'Are you sure?' } %> </li> <% end if admin? %> -<table class="table table-striped table-hover"> - <thead> - <tr> - <th>Members</th> - <th>Controls</th> - </tr> - </thead> +<ul class="nav nav-tabs"> + <li role="presentation" class="active"><a data-toggle="tab" href="#domains">Domains</a></li> + <li role="presentation"><a data-toggle="tab" href="#members">Members</a></li> +</ul> - <tbody> - <% @group.memberships.includes(:user).each do |membership| %> - <tr> - <td><%= membership.user.email %><%= " (you)" if current_user == membership.user %></td> - <td> - <%= link_to_destroy destroy_member_group_path(@group, membership.user_id), method: :delete %> - </td> - </tr> - <% end %> - </tbody> -</table> +<div class="tab-content"> + <div role="tabpanel" class="tab-pane active" id="domains"> + <table class="table table-striped table-hover"> + <thead> + <tr> + <th colspan="2">Domain</th> + <th colspan="2">Controls</th> + </tr> + </thead> -<%= bootstrap_form_tag(url: create_member_group_path(@group), layout: :inline) do |f| %> - <%= f.text_field :email, prepend: 'Member', hide_label: true, id: 'js-search-member', data: { group: @group.id } %> - <%= f.submit 'Add', class: 'btn btn-primary' %> -<% end %> + <tbody> + <% @group.domains.each do |domain| %> + <tr> + <td><%= link_to domain.name, domain %></td> + <td> + <% if domain.reverse? %> + <%= abbr_glyph('chevron-left', 'Reverse') %> + <% else %> + <%= abbr_glyph('chevron-right', 'Forward') %> + <% end %> + <% if domain.slave? %> + <%= abbr_glyph('link', 'Slave') %> + <% end %> + </td> + <td><%= link_to_edit edit_domain_path(domain) %></td> + <td><%= link_to_destroy domain, method: :delete, data: { confirm: 'Are you sure?' } %></td> + </tr> + <% end %> + </tbody> + </table> + + </div> + + <div role="tabpanel" class="tab-pane" id="members"> + <table class="table table-striped table-hover"> + <thead> + <tr> + <th>Member</th> + <th>Controls</th> + </tr> + </thead> + + <tbody> + <% @group.memberships.includes(:user).each do |membership| %> + <tr> + <td><%= membership.user.email %><%= " (you)" if current_user == membership.user %></td> + <td> + <%= link_to_destroy destroy_member_group_path(@group, membership.user_id), method: :delete %> + </td> + </tr> + <% end %> + </tbody> + </table> + + <p> + <%= bootstrap_form_tag(url: create_member_group_path(@group), layout: :inline) do |f| %> + <%= f.text_field :email, prepend: 'Add Member', hide_label: true, id: 'js-search-member', data: { group: @group.id } %> + <%= f.submit 'Add', class: 'btn btn-primary' %> + <% end %> + </p> + </div> +</div>