Skip to content

Commit

Permalink
Migrate group show from configuration to Bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoj committed Nov 29, 2018
1 parent 73d6036 commit 0e757df
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/api/app/controllers/webui/groups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ def index
@groups = Group.all.includes(:groups_users, :users)
end

def show; end
def show
switch_to_webui2
end

def new
authorize Group, :create?
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
= render partial: 'webui/main/breadcrumb_items'
%li.breadcrumb-item
= link_to 'Groups', groups_path
%li.breadcrumb-item.active{ 'aria-current' => 'page' }
= @group
56 changes: 56 additions & 0 deletions src/api/app/views/webui2/webui/groups/show.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
- @pagetitle = "Group #{@group.title}"

.card
%div
%ul.nav.nav-tabs.pt-2.px-3.flex-nowrap.collapsible{ 'role': 'tablist' }
%li.nav-item
%a.active.nav-link.text-nowrap{ aria: { controls: 'reviews-in', selected: 'true' },
data: { toggle: 'tab' }, href: '#reviews-in', role: 'tab' }
Incoming Reviews
%li.nav-item
%a.nav-link.text-nowrap{ aria: { controls: 'requests-in' }, data: { toggle: 'tab' }, href: '#requests-in', role: 'tab' }
Incoming Requests
%li.nav-item
%a.nav-link.text-nowrap{ aria: { controls: 'all-requests' }, data: { toggle: 'tab' }, href: '#all-requests', role: 'tab' }
All Requests
%li.nav-item
%a.nav-link.text-nowrap{ aria: { controls: 'group-members' }, data: { toggle: 'tab' }, href: '#group-members', role: 'tab' }
Group Members

.card-body.tab-content
.tab-pane.show.active#reviews-in{ aria: { controls: 'reviews-in' }, role: 'tabpanel' }
%h3 Incoming Reviews
= render(partial: 'webui2/shared/requests_table', locals: { id: 'reviews_in_table', source_url: group_requests_path(@group) })

.tab-pane#requests-in{ aria: { controls: 'requests-in' }, role: 'tabpanel' }
%h3 Incoming Requests
= render(partial: 'webui2/shared/requests_table', locals: { id: 'requests_in_table', source_url: group_requests_path(@group) })

.tab-pane#all-requests{ aria: { controls: 'all-requests' }, role: 'tabpanel' }
%h3 All Requests
= render(partial: 'webui2/shared/requests_table', locals: { id: 'all_requests_table', source_url: group_requests_path(@group) })

.tab-pane#group-members{ aria: { controls: 'group-members' }, role: 'tabpanel' }
%h3 Group Members
%table.responsive.table.table-striped.table-bordered#group-members-table{ width: '100%' }
%thead
%tr
%th Login Name
%tbody
- if @group.users.any?
- @group.users.each do |user|
%tr
%td= link_to(user.login, user_show_path(user))
- else
%tr
%td This group does not contain users.
- if User.current.is_admin? || @group.group_maintainers.where(user: User.current).exists?
= link_to group_edit_title_path(title: @group) do
%i.fas.fa-edit
Edit group members

= content_for :ready_function do
:plain
$('#group-members-table').DataTable({
responsive: true
});

0 comments on commit 0e757df

Please sign in to comment.