gaku_admin 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (233) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/gaku/admin/admin.coffee +6 -6
  3. data/app/assets/javascripts/gaku/admin/base.js.coffee +11 -2
  4. data/app/assets/javascripts/gaku/admin.js.coffee +6 -0
  5. data/app/assets/stylesheets/gaku/admin/bootstrap_and_theme.css.scss +16 -1
  6. data/app/assets/stylesheets/gaku/admin.css +0 -1
  7. data/app/controllers/concerns/admin_picture_controller.rb +28 -0
  8. data/app/controllers/gaku/admin/attendance_types_controller.rb +8 -8
  9. data/app/controllers/gaku/admin/badge_types_controller.rb +9 -16
  10. data/app/controllers/gaku/admin/base_controller.rb +1 -1
  11. data/app/controllers/gaku/admin/{schools/campuses → campuses}/addresses_controller.rb +3 -9
  12. data/app/controllers/gaku/admin/{schools/campuses → campuses}/contacts_controller.rb +6 -10
  13. data/app/controllers/gaku/admin/{schools/campuses_controller.rb → campuses_controller.rb} +7 -11
  14. data/app/controllers/gaku/admin/commute_method_types_controller.rb +8 -7
  15. data/app/controllers/gaku/admin/contact_types_controller.rb +7 -7
  16. data/app/controllers/gaku/admin/departments_controller.rb +7 -7
  17. data/app/controllers/gaku/admin/enrollment_statuses_controller.rb +9 -8
  18. data/app/controllers/gaku/admin/grading_method_sets/grading_method_set_items_controller.rb +1 -1
  19. data/app/controllers/gaku/admin/grading_method_sets_controller.rb +11 -11
  20. data/app/controllers/gaku/admin/grading_methods_controller.rb +10 -9
  21. data/app/controllers/gaku/admin/home_controller.rb +11 -0
  22. data/app/controllers/gaku/admin/presets_controller.rb +4 -6
  23. data/app/controllers/gaku/admin/roles_controller.rb +8 -7
  24. data/app/controllers/gaku/admin/school_years/semesters_controller.rb +0 -1
  25. data/app/controllers/gaku/admin/school_years_controller.rb +3 -7
  26. data/app/controllers/gaku/admin/schools/programs_controller.rb +11 -4
  27. data/app/controllers/gaku/admin/schools_controller.rb +82 -79
  28. data/app/controllers/gaku/admin/{achievements/simple_grade_types_controller.rb → simple_grade_types_controller.rb} +4 -3
  29. data/app/controllers/gaku/admin/specialties_controller.rb +2 -5
  30. data/app/controllers/gaku/admin/states_controller.rb +71 -71
  31. data/app/controllers/gaku/admin/student_review_categories_controller.rb +57 -0
  32. data/app/controllers/gaku/admin/templates_controller.rb +47 -50
  33. data/app/controllers/gaku/admin/users_controller.rb +5 -7
  34. data/app/controllers/gaku/states_controller.rb +2 -0
  35. data/app/helpers/gaku/admin_helper.rb +16 -1
  36. data/app/helpers/gaku/shared_helper.rb +2 -2
  37. data/app/overrides/admin_menu.rb +7 -6
  38. data/app/views/gaku/admin/attendance_types/{index.html.slim → _attendance_types.html.slim} +9 -8
  39. data/app/views/gaku/admin/attendance_types/index.js.erb +1 -0
  40. data/app/views/gaku/admin/attendance_types/index.json.rb +1 -1
  41. data/app/views/gaku/admin/badge_types/{index.html.slim → _badge_types.html.slim} +9 -8
  42. data/app/views/gaku/admin/badge_types/_form.html.slim +1 -1
  43. data/app/views/gaku/admin/badge_types/_modal.html.slim +1 -1
  44. data/app/views/gaku/admin/badge_types/create.js.erb +7 -0
  45. data/app/views/gaku/admin/badge_types/index.js.erb +1 -0
  46. data/app/views/gaku/admin/badge_types/new.js.erb +1 -1
  47. data/app/views/gaku/admin/badge_types/update.js.erb +3 -0
  48. data/app/views/gaku/admin/campuses/_campus.html.slim +4 -0
  49. data/app/views/gaku/admin/{schools/campuses → campuses}/_campuses.html.slim +4 -6
  50. data/app/views/gaku/admin/campuses/_edit_form.html.slim +3 -0
  51. data/app/views/gaku/admin/campuses/addresses/_address.html.slim +6 -0
  52. data/app/views/gaku/admin/{schools/campuses → campuses}/addresses/_address_row_fields.html.slim +1 -1
  53. data/app/views/gaku/admin/{schools/campuses → campuses}/addresses/_addresses.html.slim +3 -4
  54. data/app/views/gaku/admin/campuses/addresses/index.js.erb +1 -0
  55. data/app/views/gaku/admin/{schools/campuses → campuses}/addresses/update.js.erb +1 -1
  56. data/app/views/gaku/admin/campuses/contacts/_contact.html.slim +3 -0
  57. data/app/views/gaku/admin/{schools/campuses → campuses}/contacts/_contacts.html.slim +4 -4
  58. data/app/views/gaku/admin/campuses/contacts/_fields.html.slim +11 -0
  59. data/app/views/gaku/admin/campuses/contacts/_primary_field.html.slim +6 -0
  60. data/app/views/gaku/admin/{schools/campuses → campuses}/contacts/create.js.erb +1 -1
  61. data/app/views/gaku/admin/{schools/campuses → campuses}/contacts/destroy.js.erb +1 -1
  62. data/app/views/gaku/admin/{schools/campuses → campuses}/contacts/edit.js.erb +1 -1
  63. data/app/views/gaku/admin/campuses/contacts/index.js.erb +1 -0
  64. data/app/views/gaku/admin/campuses/edit.html.slim +34 -0
  65. data/app/views/gaku/admin/campuses/edit.js.erb +1 -0
  66. data/app/views/gaku/admin/campuses/index.js.erb +1 -0
  67. data/app/views/gaku/admin/campuses/update.js.erb +2 -0
  68. data/app/views/gaku/admin/commute_method_types/_commute_method_types.html.slim +18 -0
  69. data/app/views/gaku/admin/commute_method_types/index.js.erb +1 -0
  70. data/app/views/gaku/admin/contact_types/_contact_types.html.slim +18 -0
  71. data/app/views/gaku/admin/contact_types/index.js.erb +1 -0
  72. data/app/views/gaku/admin/departments/_departments.html.slim +21 -0
  73. data/app/views/gaku/admin/departments/index.js.erb +1 -0
  74. data/app/views/gaku/admin/enrollment_statuses/{index.html.slim → _enrollment_statuses.html.slim} +9 -10
  75. data/app/views/gaku/admin/enrollment_statuses/index.js.erb +1 -0
  76. data/app/views/gaku/admin/grading_method_sets/_fields.html.slim +1 -1
  77. data/app/views/gaku/admin/grading_method_sets/{index.html.slim → _grading_method_sets.html.slim} +9 -8
  78. data/app/views/gaku/admin/grading_method_sets/_show.html.slim +4 -0
  79. data/app/views/gaku/admin/grading_method_sets/grading_method_set_items/_fields.html.slim +2 -2
  80. data/app/views/gaku/admin/grading_method_sets/grading_method_set_items/_items.html.slim +1 -1
  81. data/app/views/gaku/admin/grading_method_sets/index.js.erb +1 -0
  82. data/app/views/gaku/admin/grading_method_sets/show.js.erb +1 -0
  83. data/app/views/gaku/admin/grading_methods/_criteria_form_fields.html.slim +19 -0
  84. data/app/views/gaku/admin/grading_methods/_criteria_template.html.slim +11 -0
  85. data/app/views/gaku/admin/grading_methods/_fields.html.slim +1 -1
  86. data/app/views/gaku/admin/grading_methods/_form_fields.html.slim +3 -2
  87. data/app/views/gaku/admin/grading_methods/_grading_methods.html.slim +21 -0
  88. data/app/views/gaku/admin/grading_methods/index.js.erb +1 -0
  89. data/app/views/gaku/admin/home/index.html.slim +5 -0
  90. data/app/views/gaku/admin/presets/_address.html.slim +8 -7
  91. data/app/views/gaku/admin/presets/_chooser_fields.html.slim +1 -1
  92. data/app/views/gaku/admin/presets/_export_formats.html.slim +5 -4
  93. data/app/views/gaku/admin/presets/_fields.html.slim +1 -1
  94. data/app/views/gaku/admin/presets/_grading.html.slim +4 -3
  95. data/app/views/gaku/admin/presets/_locale.html.slim +6 -3
  96. data/app/views/gaku/admin/presets/_names_order.html.slim +1 -1
  97. data/app/views/gaku/admin/presets/_pagination.html.slim +10 -9
  98. data/app/views/gaku/admin/presets/_person.html.slim +3 -2
  99. data/app/views/gaku/admin/presets/{index.html.slim → _presets.html.slim} +7 -4
  100. data/app/views/gaku/admin/presets/_student.html.slim +1 -1
  101. data/app/views/gaku/admin/presets/_tabs.html.slim +2 -3
  102. data/app/views/gaku/admin/presets/edit.js.erb +1 -0
  103. data/app/views/gaku/admin/presets/index.js.erb +1 -0
  104. data/app/views/gaku/admin/presets/update.js.erb +1 -0
  105. data/app/views/gaku/admin/roles/_roles.html.slim +21 -0
  106. data/app/views/gaku/admin/roles/index.js.erb +1 -0
  107. data/app/views/gaku/admin/school_years/_edit_form.html.slim +4 -0
  108. data/app/views/gaku/admin/school_years/_fields.html.slim +1 -2
  109. data/app/views/gaku/admin/school_years/_school_years.html.slim +23 -0
  110. data/app/views/gaku/admin/school_years/edit.html.slim +20 -0
  111. data/app/views/gaku/admin/school_years/edit.js.erb +4 -2
  112. data/app/views/gaku/admin/school_years/index.js.erb +1 -0
  113. data/app/views/gaku/admin/school_years/semesters/_semesters.html.slim +1 -1
  114. data/app/views/gaku/admin/school_years/semesters/index.js.erb +1 -0
  115. data/app/views/gaku/admin/schools/_edit_form.html.slim +3 -0
  116. data/app/views/gaku/admin/schools/_edit_master_form.html.slim +10 -0
  117. data/app/views/gaku/admin/schools/_school.html.slim +4 -2
  118. data/app/views/gaku/admin/schools/{index.html.slim → _schools.html.slim} +10 -9
  119. data/app/views/gaku/admin/schools/_tabs.html.slim +1 -1
  120. data/app/views/gaku/admin/schools/edit.html.slim +37 -14
  121. data/app/views/gaku/admin/schools/edit.js.erb +1 -0
  122. data/app/views/gaku/admin/schools/edit_master.html.slim +36 -16
  123. data/app/views/gaku/admin/schools/index.js.erb +1 -0
  124. data/app/views/gaku/admin/schools/programs/_fields.html.slim +3 -4
  125. data/app/views/gaku/admin/schools/programs/_programs.html.slim +2 -2
  126. data/app/views/gaku/admin/schools/programs/create.js.erb +1 -0
  127. data/app/views/gaku/admin/schools/programs/destroy.js.erb +1 -0
  128. data/app/views/gaku/admin/schools/programs/index.js.erb +1 -0
  129. data/app/views/gaku/admin/schools/update.js.erb +1 -0
  130. data/app/views/gaku/admin/shared/_ajax_picture.html.slim +8 -0
  131. data/app/views/gaku/admin/shared/_ajax_upload_picture.html.slim +14 -0
  132. data/app/views/gaku/admin/shared/remove_picture.js.erb +3 -0
  133. data/app/views/gaku/admin/shared/set_picture.js.erb +3 -0
  134. data/app/views/gaku/admin/simple_grade_types/_simple_grade_types.html.slim +24 -0
  135. data/app/views/gaku/admin/simple_grade_types/index.js.erb +1 -0
  136. data/app/views/gaku/admin/specialties/{index.html.slim → _specialties.html.slim} +9 -8
  137. data/app/views/gaku/admin/specialties/index.js.erb +1 -0
  138. data/app/views/gaku/admin/states/_country_select_form.html.slim +1 -2
  139. data/app/views/gaku/admin/states/_form_fields.html.slim +1 -1
  140. data/app/views/gaku/admin/states/_states.html.slim +16 -0
  141. data/app/views/gaku/admin/states/index.js.erb +1 -0
  142. data/app/views/gaku/admin/student_review_categories/_form.html.slim +3 -0
  143. data/app/views/gaku/admin/student_review_categories/_form_fields.html.slim +1 -0
  144. data/app/views/gaku/admin/student_review_categories/_modal.html.slim +4 -0
  145. data/app/views/gaku/admin/student_review_categories/_student_review_categories.html.slim +18 -0
  146. data/app/views/gaku/admin/student_review_categories/_student_review_category.html.slim +2 -0
  147. data/app/views/gaku/admin/student_review_categories/_table_fields.html.slim +4 -0
  148. data/app/views/gaku/admin/student_review_categories/create.js.erb +7 -0
  149. data/app/views/gaku/admin/student_review_categories/destroy.js.erb +2 -0
  150. data/app/views/gaku/admin/student_review_categories/edit.js.erb +3 -0
  151. data/app/views/gaku/admin/student_review_categories/index.js.erb +1 -0
  152. data/app/views/gaku/admin/student_review_categories/new.js.erb +3 -0
  153. data/app/views/gaku/admin/student_review_categories/update.js.erb +3 -0
  154. data/app/views/gaku/admin/templates/_fields.html.slim +2 -2
  155. data/app/views/gaku/admin/templates/_form.html.slim +1 -1
  156. data/app/views/gaku/admin/templates/_modal.html.slim +5 -2
  157. data/app/views/gaku/admin/templates/_templates.html.slim +21 -0
  158. data/app/views/gaku/admin/templates/create.js.erb +7 -0
  159. data/app/views/gaku/admin/templates/edit.js.erb +3 -0
  160. data/app/views/gaku/admin/templates/index.js.erb +1 -0
  161. data/app/views/gaku/admin/templates/new.js.erb +3 -0
  162. data/app/views/gaku/admin/templates/update.js.erb +3 -0
  163. data/app/views/gaku/admin/users/_users.html.slim +22 -0
  164. data/app/views/gaku/admin/users/index.js.erb +1 -0
  165. data/app/views/gaku/layouts/admin/index.html.slim +0 -1
  166. data/app/views/gaku/shared/menu/_admin.html.erb +1 -71
  167. data/app/views/gaku/shared/menu/_admin_menu.html.erb +154 -0
  168. data/config/routes.rb +20 -10
  169. data/lib/gaku/admin/engine.rb +3 -5
  170. data/lib/gaku/admin.rb +2 -1
  171. data/lib/gaku/app_responder.rb +1 -1
  172. data/lib/gaku_admin.rb +1 -1
  173. data/lib/tasks/admin_user.rake +2 -1
  174. metadata +456 -374
  175. data/app/views/gaku/admin/achievements/simple_grade_types/index.html.slim +0 -23
  176. data/app/views/gaku/admin/commute_method_types/index.html.slim +0 -18
  177. data/app/views/gaku/admin/contact_types/index.html.slim +0 -18
  178. data/app/views/gaku/admin/departments/index.html.slim +0 -20
  179. data/app/views/gaku/admin/grading_method_sets/show.html.slim +0 -13
  180. data/app/views/gaku/admin/grading_methods/index.html.slim +0 -20
  181. data/app/views/gaku/admin/roles/index.html.slim +0 -20
  182. data/app/views/gaku/admin/school_years/index.html.slim +0 -21
  183. data/app/views/gaku/admin/school_years/show.html.slim +0 -15
  184. data/app/views/gaku/admin/schools/campuses/_campus.html.slim +0 -6
  185. data/app/views/gaku/admin/schools/campuses/_picture.html.slim +0 -8
  186. data/app/views/gaku/admin/schools/campuses/_show_table.html.slim +0 -10
  187. data/app/views/gaku/admin/schools/campuses/_tabs.html.slim +0 -15
  188. data/app/views/gaku/admin/schools/campuses/_upload_picture.html.slim +0 -7
  189. data/app/views/gaku/admin/schools/campuses/addresses/_address.html.slim +0 -7
  190. data/app/views/gaku/admin/schools/campuses/contacts/_contact.html.slim +0 -3
  191. data/app/views/gaku/admin/schools/campuses/contacts/_fields.html.slim +0 -12
  192. data/app/views/gaku/admin/schools/campuses/contacts/_primary_field.html.slim +0 -13
  193. data/app/views/gaku/admin/schools/campuses/edit.html.slim +0 -19
  194. data/app/views/gaku/admin/schools/campuses/show.html.slim +0 -13
  195. data/app/views/gaku/admin/schools/show.html.slim +0 -13
  196. data/app/views/gaku/admin/schools/show_master.html.slim +0 -14
  197. data/app/views/gaku/admin/states/index.html.slim +0 -15
  198. data/app/views/gaku/admin/templates/edit.html.slim +0 -1
  199. data/app/views/gaku/admin/templates/index.html.slim +0 -20
  200. data/app/views/gaku/admin/templates/new.html.slim +0 -1
  201. data/app/views/gaku/admin/users/index.html.slim +0 -21
  202. data/config/initializers/client_side_validations.rb +0 -9
  203. /data/app/views/gaku/admin/{schools/campuses → campuses}/_form.html.slim +0 -0
  204. /data/app/views/gaku/admin/{schools/campuses → campuses}/_form_fields.html.slim +0 -0
  205. /data/app/views/gaku/admin/{schools/campuses → campuses}/addresses/_fields.html.slim +0 -0
  206. /data/app/views/gaku/admin/{schools/campuses → campuses}/addresses/_form.html.slim +0 -0
  207. /data/app/views/gaku/admin/{schools/campuses → campuses}/addresses/_form_fields.html.slim +0 -0
  208. /data/app/views/gaku/admin/{schools/campuses → campuses}/addresses/_modal.html.slim +0 -0
  209. /data/app/views/gaku/admin/{schools/campuses → campuses}/addresses/create.js.erb +0 -0
  210. /data/app/views/gaku/admin/{schools/campuses → campuses}/addresses/destroy.js.erb +0 -0
  211. /data/app/views/gaku/admin/{schools/campuses → campuses}/addresses/edit.js.erb +0 -0
  212. /data/app/views/gaku/admin/{schools/campuses → campuses}/addresses/new.js.erb +0 -0
  213. /data/app/views/gaku/admin/{schools/campuses → campuses}/contacts/_delete_link.html.slim +0 -0
  214. /data/app/views/gaku/admin/{schools/campuses → campuses}/contacts/_form.html.slim +0 -0
  215. /data/app/views/gaku/admin/{schools/campuses → campuses}/contacts/_form_fields.html.slim +0 -0
  216. /data/app/views/gaku/admin/{schools/campuses → campuses}/contacts/_modal.html.slim +0 -0
  217. /data/app/views/gaku/admin/{schools/campuses → campuses}/contacts/make_primary.js.erb +0 -0
  218. /data/app/views/gaku/admin/{schools/campuses → campuses}/contacts/new.js.erb +0 -0
  219. /data/app/views/gaku/admin/{schools/campuses → campuses}/contacts/soft_delete.js.erb +0 -0
  220. /data/app/views/gaku/admin/{schools/campuses → campuses}/contacts/update.js.erb +0 -0
  221. /data/app/views/gaku/admin/{schools/campuses → campuses}/create.js.erb +0 -0
  222. /data/app/views/gaku/admin/{schools/campuses → campuses}/destroy.js.erb +0 -0
  223. /data/app/views/gaku/admin/{schools/campuses → campuses}/new.js.erb +0 -0
  224. /data/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/_fields.html.slim +0 -0
  225. /data/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/_form.html.slim +0 -0
  226. /data/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/_form_fields.html.slim +0 -0
  227. /data/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/_modal.html.slim +0 -0
  228. /data/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/_simple_grade_type.html.slim +0 -0
  229. /data/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/create.js.erb +0 -0
  230. /data/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/destroy.js.erb +0 -0
  231. /data/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/edit.js.erb +0 -0
  232. /data/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/new.js.erb +0 -0
  233. /data/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/update.js.erb +0 -0
@@ -1,71 +1,68 @@
1
1
  module Gaku
2
- module Admin
3
- class TemplatesController < Admin::BaseController
2
+ class Admin::TemplatesController < Admin::BaseController
4
3
 
5
- responders :collection
4
+ responders :collection
6
5
 
7
- respond_to :js, only: %i( destroy )
8
- respond_to :html, only: %i( new edit index update create )
6
+ respond_to :js, only: %i( new create edit update destroy index )
7
+ respond_to :html, only: :download
9
8
 
10
- before_action :set_template, only: %i( download edit update destroy )
9
+ before_action :set_template, only: %i( download edit update destroy )
11
10
 
12
- def new
13
- @template = Template.new
14
- end
15
-
16
- def create
17
- @template = Template.new(template_params)
18
- if @template.save
19
- set_count
20
- respond_with @template, location: admin_templates_path
21
- else
22
- render :new
23
- end
24
- end
11
+ def new
12
+ @template = Template.new
13
+ end
25
14
 
26
- def edit
15
+ def create
16
+ @template = Template.new(template_params)
17
+ if @template.save
18
+ set_count
27
19
  respond_with @template
20
+ else
21
+ render :new
28
22
  end
23
+ end
29
24
 
30
- def update
31
- @template.update(template_params)
32
- respond_with @template, location: admin_templates_path
33
- end
25
+ def edit
26
+ respond_with @template
27
+ end
34
28
 
35
- def download
36
- send_file @template.file.path
37
- end
29
+ def update
30
+ @template.update(template_params)
31
+ respond_with @template
32
+ end
38
33
 
39
- def index
40
- @templates = Template.all
41
- set_count
42
- respond_with @templates
43
- end
34
+ def download
35
+ send_file @template.file.path
36
+ end
44
37
 
45
- def destroy
46
- @template.destroy
47
- set_count
48
- respond_with @template
49
- end
38
+ def index
39
+ @templates = Template.all
40
+ set_count
41
+ respond_with @templates
42
+ end
50
43
 
51
- private
44
+ def destroy
45
+ @template.destroy
46
+ set_count
47
+ respond_with @template
48
+ end
52
49
 
53
- def set_count
54
- @count = Template.count
55
- end
50
+ private
56
51
 
57
- def set_template
58
- @template = Template.find(params[:id])
59
- end
52
+ def set_count
53
+ @count = Template.count
54
+ end
60
55
 
61
- def template_params
62
- params.require(:template).permit(attributes)
63
- end
56
+ def set_template
57
+ @template = Template.find(params[:id])
58
+ end
64
59
 
65
- def attributes
66
- %i( name context locked file )
67
- end
60
+ def template_params
61
+ params.require(:template).permit(attributes)
62
+ end
68
63
 
64
+ def attributes
65
+ %i( name context locked file )
69
66
  end
70
67
 
71
68
  end
@@ -1,10 +1,7 @@
1
1
  module Gaku
2
2
  class Admin::UsersController < Admin::BaseController
3
3
 
4
- #load_and_authorize_resource class: User
5
-
6
- respond_to :js, only: %i( new create edit update destroy )
7
- respond_to :html, only: :index
4
+ respond_to :js, only: %i( new create edit update destroy index )
8
5
 
9
6
  before_action :set_user, only: %i( edit update destroy )
10
7
  before_action :set_roles
@@ -21,8 +18,9 @@ module Gaku
21
18
  end
22
19
 
23
20
  def create
24
- @user = User.new(user_params)
25
- @user.save
21
+ user_creator = UserCreator.new(user_params)
22
+ user_creator.save
23
+ @user = user_creator.get_user
26
24
  save_user_roles
27
25
  @count = User.count
28
26
  respond_with @user
@@ -55,7 +53,7 @@ module Gaku
55
53
  end
56
54
 
57
55
  def attributes
58
- [:login, :username, :email, :password, :password_confirmation, :remember_me, :locale, { role_ids: [] } ]
56
+ [:login, :username, :email, :password, :password_confirmation, :remember_me, :locale, { role_ids: [] }]
59
57
  end
60
58
 
61
59
  def set_roles
@@ -1,5 +1,6 @@
1
1
  module Gaku
2
2
  class StatesController < CoreController
3
+
3
4
  respond_to :js, :json
4
5
 
5
6
  def index
@@ -13,5 +14,6 @@ module Gaku
13
14
 
14
15
  respond_with @states
15
16
  end
17
+
16
18
  end
17
19
  end
@@ -8,5 +8,20 @@ module Gaku
8
8
  content_tag :h4, text
9
9
  end
10
10
 
11
+ def grading_methods_with_i18n
12
+ Hash[*Gaku::GradingMethod::Types.map do |k|
13
+ [I18n.t("grading_method.#{k}"), k.to_s]
14
+ end.flatten]
15
+
16
+ end
17
+
18
+ def badge_count(count, text, css_class)
19
+ if count != 0
20
+ "#{text}<span class='badge pull-right #{css_class}'>#{count}</span>".html_safe
21
+ else
22
+ "#{text}<span class='badge pull-right #{css_class}'></span>".html_safe
23
+ end
24
+ end
25
+
11
26
  end
12
- end
27
+ end
@@ -2,7 +2,7 @@ module Gaku
2
2
  module SharedHelper
3
3
 
4
4
  def can_edit?
5
- %w( edit create update ).include? controller.action_name
5
+ %w( edit create update ).include? action_name
6
6
  end
7
7
 
8
8
  def genders
@@ -22,4 +22,4 @@ module Gaku
22
22
  end
23
23
 
24
24
  end
25
- end
25
+ end
@@ -1,6 +1,7 @@
1
- Deface::Override.new(:virtual_path => "gaku/shared/menu/_global",
2
- :name => "admin_menu",
3
- :insert_bottom => "[data-hook='menu']",
4
- :partial => "gaku/shared/menu/admin",
5
- :disabled => false
6
- )
1
+ Deface::Override.new(
2
+ virtual_path: 'gaku/shared/menu/_global',
3
+ name: 'admin_menu',
4
+ insert_bottom: "[data-hook='menu']",
5
+ partial: 'gaku/shared/menu/admin',
6
+ disabled: false
7
+ )
@@ -1,12 +1,13 @@
1
- = content_for :index_header do
2
- .pull-left
3
- = count_div 'admin-attendance-types-count' do
4
- = print_count @count, t(:'attendance_type.list')
5
- .pull-right
6
- = ajax_link_to_new t(:'attendance_type.add'), [:new, :admin, :attendance_type], id: 'new-admin-attendance-type-link'
1
+ .row
2
+ .col-md-12
3
+ #new-admin-attendance-type.d-none
4
+ .pull-left
5
+ = count_div 'admin-attendance-types-count' do
6
+ = print_count @count, t(:'attendance_type.list')
7
+ .pull-right
8
+ = ajax_link_to_new t(:'attendance_type.add'), [:new, :admin, :attendance_type], id: 'new-admin-attendance-type-link'
7
9
 
8
- = content_for :new_form do
9
- #new-admin-attendance-type.d-none
10
+ hr
10
11
 
11
12
  #admin-attendance-types
12
13
  = table_for 'admin-attendance-types-index' do
@@ -0,0 +1 @@
1
+ $('#ajax-load').html('<%=j render "attendance_types" %>')
@@ -1 +1 @@
1
- @attendance_types.to_json(root: false)
1
+ @attendance_types.to_json(root: false)
@@ -1,12 +1,13 @@
1
- = content_for :index_header do
2
- .pull-left
3
- = count_div 'admin-badge-types-count' do
4
- = print_count @count, t(:'badge_type.list')
5
- .pull-right
6
- = ajax_link_to_new t(:'badge_type.add'), [:new, :admin, :badge_type], id: 'new-admin-badge-type-link'
1
+ .row
2
+ .col-md-12
3
+ #new-admin-badge-type.d-none
4
+ .pull-left
5
+ = count_div 'admin-badge-types-count' do
6
+ = print_count @count, t(:'badge_type.list')
7
+ .pull-right
8
+ = ajax_link_to_new t(:'badge_type.add'), [:new, :admin, :badge_type], id: 'new-admin-badge-type-link'
7
9
 
8
- = content_for :new_form do
9
- #new-admin-badge-type.d-none
10
+ hr
10
11
 
11
12
  #admin-badge-types
12
13
  = table_for 'admin-badge-types-index' do
@@ -1,3 +1,3 @@
1
- = normal_form_for [:admin, @badge_type], resource: 'admin-badge-type' do |f|
1
+ = remote_form_for [:admin, @badge_type], resource: 'admin-badge-type' do |f|
2
2
  = render 'form_fields', f: f
3
3
  = buttons_for @badge_type, resource: 'admin-badge-type'
@@ -1,4 +1,4 @@
1
1
  = modal_for 'edit-badge-type-modal' do
2
- = normal_modal_form_for [:admin, @badge_type], resource: 'admin-badge-type' do |f|
2
+ = modal_form_for [:admin, @badge_type], resource: 'admin-badge-type' do |f|
3
3
  = render 'form_fields', f: f
4
4
  = buttons_for @badge_type, resource: 'admin-badge-type'
@@ -0,0 +1,7 @@
1
+ $('#admin-badge-types-index tbody').append('<%= j render("badge_type", {badge_type: @badge_type}) %>');
2
+
3
+ $('#new-admin-badge-type').slide();
4
+ $('#new-admin-badge-type-link').show();
5
+
6
+ showNotice("<%= render_flash %>");
7
+ $('.admin-badge-types-count').html("<%= print_count(@count, t(:'badge_type.list')) %>");
@@ -0,0 +1 @@
1
+ $('#ajax-load').html('<%=j render "badge_types" %>')
@@ -1,3 +1,3 @@
1
1
  $('#new-admin-badge-type').html('<%= j render("form") %>').slide();
2
2
  $('#new-admin-badge-type-link').hide();
3
- $('.normal-form').enableValidations();
3
+ $('.remote-form').enableValidations();
@@ -0,0 +1,3 @@
1
+ $('tr#badge-type-<%= @badge_type.id %>').html('<%= j render("fields", {badge_type: @badge_type}) %>');
2
+ $("#edit-badge-type-modal").modal("hide");
3
+ showNotice("<%= render_flash %>");
@@ -0,0 +1,4 @@
1
+ tr id="campus-#{campus.id}"
2
+ td
3
+ td = campus.name
4
+ td = link_to_edit [:edit, :admin, @school, campus]
@@ -6,7 +6,7 @@
6
6
  = count_div 'admin-school-campuses-count' do
7
7
  = print_count @school.campuses.count, t(:'campus.list')
8
8
  .pull-right
9
- = ajax_link_to_new t(:'campus.add'), [:new, :admin, @school, :campus], id: 'new-admin-school-campus-link' if can_edit?
9
+ = ajax_link_to_new t(:'campus.add'), [:new, :admin, @school, :campus], id: 'new-admin-school-campus-link'
10
10
  = hr
11
11
 
12
12
  = index_body do
@@ -15,9 +15,7 @@
15
15
  tr
16
16
  = th_icon 'home'
17
17
  = th t(:'campus.name')
18
- - if can_edit?
19
- = th_actions 2
20
- - else
21
- = th_actions 1
18
+ = th_actions 1
19
+
22
20
  tbody
23
- = render partial: 'gaku/admin/schools/campuses/campus', collection: @school.campuses, as: 'campus'
21
+ = render partial: 'gaku/admin/campuses/campus', collection: @school.campuses, as: 'campus'
@@ -0,0 +1,3 @@
1
+ = remote_form_for [:admin, @school, @campus], label: t(:'campus.singular') do |f|
2
+ = render 'form_fields', f: f, school: @school
3
+ = buttons_for @campus, resource: 'admin-school-campus'
@@ -0,0 +1,6 @@
1
+ - unless address.nil?
2
+ tr id="address-#{address.id}"
3
+ = render 'gaku/admin/campuses/addresses/fields', address: address
4
+ td
5
+ = ajax_link_to_edit [:edit, :admin, @school, @campus, address]
6
+ = ajax_link_to_delete [:admin, @school, @campus, address]
@@ -1,4 +1,4 @@
1
- = render 'gaku/admin/schools/campuses/addresses/fields', address: address
1
+ = render 'gaku/admin/campuses/addresses/fields', address: address
2
2
  td
3
3
  = ajax_link_to_edit [:edit, :admin, @school, @campus, address]
4
4
  = ajax_link_to_delete [:admin, @school, @campus, address]
@@ -5,8 +5,7 @@
5
5
  = count_div '' do
6
6
  = t(:'address.singular')
7
7
  .pull-right
8
- = ajax_link_to_new t(:'address.add'), [:new, :admin, @school, @campus, :address], id: 'new-admin-school-campus-address-link', class: @campus.address.nil? ? "btn btn-primary" : 'btn btn-primary d-none' if can_edit?
9
- = hr
8
+ = ajax_link_to_new t(:'address.add'), [:new, :admin, @school, @campus, :address], id: 'new-admin-school-campus-address-link', class: @campus.address.nil? ? "btn btn-primary" : 'btn btn-primary d-none'
10
9
 
11
10
  = index_body do
12
11
  = table_for 'admin-school-campus-addresses-index' do
@@ -19,6 +18,6 @@
19
18
  = th t(:'address.city')
20
19
  = th t(:'address.address1')
21
20
  = th t(:'address.address2')
22
- = th_actions 2 if can_edit?
21
+ = th_actions 2
23
22
  tbody
24
- = render partial: 'gaku/admin/schools/campuses/addresses/address', locals: {address: @campus.address}
23
+ = render partial: 'gaku/admin/campuses/addresses/address', locals: {address: @campus.address}
@@ -0,0 +1 @@
1
+ $('#ajax-load').html('<%=j render "addresses" %>')
@@ -1,4 +1,4 @@
1
1
  //edit from index
2
- $('tr#address-<%= @address.id %>').html('<%= j render("gaku/admin/schools/campuses/addresses/address_row_fields", {address: @address, target: [@student, @guardian, @address]}) %>');
2
+ $('tr#address-<%= @address.id %>').html('<%= j render("gaku/admin/campuses/addresses/address_row_fields", {address: @address, target: [@student, @guardian, @address]}) %>');
3
3
  $("#edit-address-modal").modal("hide");
4
4
  showNotice("<%= render_flash %>");
@@ -0,0 +1,3 @@
1
+ tr id="contact-#{contact.id}"
2
+ = render 'gaku/admin/campuses/contacts/fields', contact: contact
3
+
@@ -4,9 +4,9 @@
4
4
  #new-admin-school-campus-contact.d-none
5
5
  .pull-left
6
6
  = count_div "admin-school-campus-contacts-count" do
7
- = print_count campus.contacts_count, t(:'contact.list')
7
+ = print_count @campus.contacts_count, t(:'contact.list')
8
8
  .pull-right
9
- = ajax_link_to_new t(:'contact.add'), [:new, :admin, @school, campus, :contact], id: 'new-admin-school-campus-contact-link' if can_edit?
9
+ = ajax_link_to_new t(:'contact.add'), [:new, :admin, @school, @campus, :contact], id: 'new-admin-school-campus-contact-link'
10
10
 
11
11
  = index_body do
12
12
  = table_for "admin-school-campus-contacts-index" do
@@ -17,6 +17,6 @@
17
17
  = th t(:'contact.data')
18
18
  = th t(:'contact.details')
19
19
  = th t(:'contact.emergency')
20
- = th_actions 2 if can_edit?
20
+ = th_actions 2
21
21
  tbody
22
- = render partial: 'gaku/admin/schools/campuses/contacts/contact', collection: campus.contacts, as: :contact
22
+ = render partial: 'gaku/admin/campuses/contacts/contact', collection: @campus.contacts, as: :contact
@@ -0,0 +1,11 @@
1
+ = render 'gaku/admin/campuses/contacts/primary_field', contact: contact
2
+
3
+ td = contact.name
4
+ td = contact.data
5
+ td = contact.details
6
+ td
7
+ = t(:'contact.emergency') if contact.emergency?
8
+
9
+ td
10
+ = ajax_link_to_edit [:edit, :admin, @school, @campus, contact]
11
+ = render 'gaku/admin/campuses/contacts/delete_link', contact: contact
@@ -0,0 +1,6 @@
1
+ td class="primary-contact" width="28px"
2
+ - if contact.primary?
3
+ = ajax_link_to_make_primary [:make_primary, :admin, @school, @campus, contact], method: :patch, id: 'set-primary-link', class: 'btn btn-xs btn-primary make-primary'
4
+ - else
5
+ = ajax_link_to_make_primary [:make_primary, :admin, @school, @campus, contact], method: :patch, id: 'set-primary-link', class: 'btn btn-xs btn-default'
6
+
@@ -5,7 +5,7 @@ $("#new-admin-school-campus-contact-link").show();
5
5
  $('#new-admin-school-campus-contact').slide();
6
6
 
7
7
  $('.admin-school-campus-contacts-count').html("<%= print_count(@count, t(:'contact.list')) %>");
8
- $('#admin-school-campus-contacts-tab-link').html("<%= print_count(@count, t(:'contact.plural')) %>");
8
+ $('.contacts-count').html("<%= @count %>");
9
9
 
10
10
  <% if @contact.primary? %>
11
11
  $('#admin-school-campus-contacts-index tbody tr').each(function(){
@@ -5,4 +5,4 @@ showNotice("<%= render_flash %>");
5
5
  <% end %>
6
6
 
7
7
  $('.admin-school-campus-contacts-count').html("<%= print_count(@count, t(:'contact.list')) %>");
8
- $('#admin-school-campus-contacts-tab-link').html("<%= print_count(@count, t(:'contact.plural')) %>");
8
+ $('.contacts-count').html("<%= @count %>");
@@ -1,4 +1,4 @@
1
- $('#modal-dialogs').html('<%== j render("modal", {contact: @contact})%>');
1
+ $('#modal-dialogs').html('<%= j render("modal", {contact: @contact})%>');
2
2
  $('#edit-contact-modal').modal('show');
3
3
  $('.remote-form').enableValidations();
4
4
 
@@ -0,0 +1 @@
1
+ $('#ajax-load').html('<%=j render "contacts" %>')
@@ -0,0 +1,34 @@
1
+ .row
2
+ .col-md-2
3
+ .panel-group#accordion
4
+ .panel
5
+ .picture-upload
6
+ = render 'gaku/admin/shared/ajax_picture', resource: @campus
7
+
8
+
9
+ .panel.panel-default
10
+ .panel-heading
11
+ h4#campus-name.panel-title
12
+ = @campus.name
13
+ .panel-body
14
+ ul.list-unstyled
15
+ li = link_to t(:'edit'), [:edit, :admin, @school, @campus], remote: true
16
+ li#addresses-menu
17
+ = link_to badge_count(@campus.addresses_count, t(:'address.plural'), 'addresses-count'), [:admin, @campus, :addresses], remote: true
18
+ li#contacts-menu
19
+ = link_to badge_count(@campus.contacts_count, t(:'contact.plural'), 'contacts-count'), [:admin, @campus, :contacts], remote: true
20
+
21
+ .panel.panel-default
22
+ .panel-heading
23
+ h4.panel-title
24
+ = link_to t(:'admin.back_to_school'), [:edit, :admin, @school]
25
+
26
+
27
+ .panel.panel-default
28
+ .panel-heading
29
+ h4.panel-title
30
+ = link_to t(:'admin.back'), [:admin, :root]
31
+
32
+ .col-md-10#ajax-load
33
+
34
+ = render 'edit_form'
@@ -0,0 +1 @@
1
+ $('#ajax-load').html('<%=j render "edit_form" %>')
@@ -0,0 +1 @@
1
+ $('#ajax-load').html('<%=j render "campuses" %>')
@@ -0,0 +1,2 @@
1
+ $('#campus-name').html('<%= @campus.name %>');
2
+ showNotice("<%= render_flash %>");
@@ -0,0 +1,18 @@
1
+ .row
2
+ .col-md-12
3
+ #new-admin-commute-method-type.d-none
4
+ .pull-left
5
+ = count_div 'admin-commute-method-types-count' do
6
+ = print_count @count, t(:'commute_method_type.list')
7
+ .pull-right
8
+ = ajax_link_to_new t(:'commute_method_type.new'), [:new, :admin, :commute_method_type], id: 'new-admin-commute-method-type-link'
9
+ hr
10
+
11
+ #admin-commute-method-types
12
+ = table_for 'admin-commute-method-types-index' do
13
+ thead
14
+ tr
15
+ = th t(:'commute_method_type.plural')
16
+ = th_actions 2
17
+ tbody
18
+ = render partial: 'commute_method_type', collection: @commute_method_types, as: :commute_method_type
@@ -0,0 +1 @@
1
+ $('#ajax-load').html('<%=j render "commute_method_types" %>')
@@ -0,0 +1,18 @@
1
+ .row
2
+ .col-md-12
3
+ #new-admin-contact-type.d-none
4
+ .pull-left
5
+ = count_div 'admin-contact-types-count' do
6
+ = print_count @count, t(:'contact_type.list')
7
+ .pull-right
8
+ = ajax_link_to_new t(:'contact_type.add'), [:new, :admin, :contact_type], id: 'new-admin-contact-type-link'
9
+ hr
10
+
11
+ #admin-contact-types
12
+ = table_for 'admin-contact-types-index' do
13
+ thead
14
+ tr
15
+ = th t(:'contact_type.singular')
16
+ = th_actions 2
17
+ tbody
18
+ = render partial: 'contact_type', collection: @contact_types, as: 'contact_type'
@@ -0,0 +1 @@
1
+ $('#ajax-load').html('<%=j render "contact_types" %>')
@@ -0,0 +1,21 @@
1
+ .row
2
+ .col-md-12
3
+ #new-admin-department.d-none
4
+ .pull-left
5
+ = count_div 'admin-departments-count' do
6
+ = print_count @count, t(:'department.list')
7
+ .pull-right
8
+ = ajax_link_to_new t(:'department.add'), [:new, :admin, :department], id: 'new-admin-department-link'
9
+
10
+ hr
11
+
12
+ #admin-departments
13
+ = table_for 'admin-departments-index' do
14
+ thead
15
+ tr
16
+ = th t(:'department.name')
17
+
18
+ = th_actions 2
19
+ tbody
20
+ = render partial: 'gaku/admin/departments/department', collection: @departments, as: :department
21
+
@@ -0,0 +1 @@
1
+ $('#ajax-load').html('<%=j render "departments" %>')
@@ -1,13 +1,12 @@
1
- = content_for :index_header do
2
- .pull-left
3
- = count_div 'admin-enrollment-statuses-count' do
4
- = print_count @count, t(:'enrollment_status.list')
5
- .pull-right
6
- = ajax_link_to_new t(:'enrollment_status.add'), [:new, :admin, :enrollment_status], id: 'new-admin-enrollment-status-link'
7
-
8
- = content_for :new_form do
9
- #new-admin-enrollment-status.d-none
10
-
1
+ .row
2
+ .col-md-12
3
+ #new-admin-enrollment-status.d-none
4
+ .pull-left
5
+ = count_div 'admin-enrollment-statuses-count' do
6
+ = print_count @count, t(:'enrollment_status.list')
7
+ .pull-right
8
+ = ajax_link_to_new t(:'enrollment_status.add'), [:new, :admin, :enrollment_status], id: 'new-admin-enrollment-status-link'
9
+ hr
11
10
  #admin-enrollment-statuses
12
11
  = table_for 'admin-enrollment-statuses-index' do
13
12
  thead
@@ -0,0 +1 @@
1
+ $('#ajax-load').html('<%=j render "enrollment_statuses" %>')
@@ -4,6 +4,6 @@ td = boolean_image grading_method_set.display_deviation
4
4
  td = boolean_image grading_method_set.display_rank
5
5
  td = boolean_image grading_method_set.rank_order
6
6
  td
7
- = link_to_show [:admin, grading_method_set]
7
+ = ajax_link_to_show [:admin, grading_method_set]
8
8
  = ajax_link_to_edit [:edit, :admin, grading_method_set]
9
9
  = ajax_link_to_delete [:admin, grading_method_set]