diff --git a/app/controllers/admin/education/program/role/people_controller.rb b/app/controllers/admin/education/program/role/people_controller.rb index 88a4ac3c3bb6d9f5b6ccf9b6a59ae974249d82c3..6202bf3e80f4bf070433fb13bcb5163d4688596b 100644 --- a/app/controllers/admin/education/program/role/people_controller.rb +++ b/app/controllers/admin/education/program/role/people_controller.rb @@ -2,6 +2,8 @@ class Admin::Education::Program::Role::PeopleController < Admin::Education::Prog load_and_authorize_resource :role, class: Education::Program::Role, through: :program load_and_authorize_resource class: Education::Program::Role::Person, through: :role + include Admin::Reorderable + def new breadcrumb end diff --git a/app/controllers/admin/education/program/roles_controller.rb b/app/controllers/admin/education/program/roles_controller.rb index b3488e4ad86c359ce2404b33cffcc1b10c3a5450..94d3598b32e5e3ee016155862000a0b19c5e4897 100644 --- a/app/controllers/admin/education/program/roles_controller.rb +++ b/app/controllers/admin/education/program/roles_controller.rb @@ -1,6 +1,8 @@ class Admin::Education::Program::RolesController < Admin::Education::Program::ApplicationController load_and_authorize_resource class: Education::Program::Role, through: :program + include Admin::Reorderable + def show breadcrumb end diff --git a/app/views/admin/education/program/role/people/_list.html.erb b/app/views/admin/education/program/role/people/_list.html.erb index cee21001aa8360fbeb22d0a0bc2245531ea94d5d..fc31ddd11a709929630337c2f87dde710821fc42 100644 --- a/app/views/admin/education/program/role/people/_list.html.erb +++ b/app/views/admin/education/program/role/people/_list.html.erb @@ -1,14 +1,14 @@ <% if people.any? %> - <table class="table"> + <table class="table table-sortable"> <thead> <tr> <th><%= Education::Program::Role::Person.model_name.human %></th> <th></th> </tr> </thead> - <tbody> + <tbody data-reorder-url="<%= reorder_admin_education_program_role_people_path(program_id: @program.id, role_id: @role.id) %>"> <% people.each do |person| %> - <tr> + <tr class="handle" data-id="<%= person.id %>"> <td> <%= link_to_if can?(:read, person.person), person.person, diff --git a/app/views/admin/education/program/roles/_list.html.erb b/app/views/admin/education/program/roles/_list.html.erb index 7b92d9d1f1c58dd28719254c5fcbf72225f99cca..9fbda8e94303c28ea6539804cf6efe4186e3961f 100644 --- a/app/views/admin/education/program/roles/_list.html.erb +++ b/app/views/admin/education/program/roles/_list.html.erb @@ -1,4 +1,4 @@ -<table class="table"> +<table class="table table-sortable"> <thead> <tr> <th><%= Education::Program::Role.model_name.human %></th> @@ -6,9 +6,9 @@ <th></th> </tr> </thead> - <tbody> + <tbody data-reorder-url="<%= reorder_admin_education_program_roles_path(program_id: @program.id) %>"> <% roles.each do |role| %> - <tr> + <tr class="handle" data-id="<%= role.id %>"> <td> <%= link_to_if can?(:read, role), role, diff --git a/config/routes/admin/education.rb b/config/routes/admin/education.rb index fa80995273aadbf42ce8130f44682e17cff8c1ca..79e0e2555fda0126e8550d8739cf36ea24c06e6e 100644 --- a/config/routes/admin/education.rb +++ b/config/routes/admin/education.rb @@ -3,7 +3,15 @@ namespace :education do resources :schools resources :programs do resources :roles, controller: 'program/roles', except: :index do - resources :people, controller: 'program/role/people', except: [:index, :show, :edit, :update] + resources :people, controller: 'program/role/people', except: [:index, :show, :edit, :update] do + collection do + post :reorder + end + end + + collection do + post :reorder + end end resources :teachers, controller: 'program/teachers', except: [:index, :show] collection do