gaku 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 (1357) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +10 -1
  3. data/.hound.yml +36 -0
  4. data/.rubocop.yml +36 -0
  5. data/.travis.yml +20 -13
  6. data/Gemfile +3 -1
  7. data/LICENSE.md +4 -0
  8. data/README.md +32 -55
  9. data/Rakefile +44 -47
  10. data/VERSION +1 -1
  11. data/admin/Gemfile +3 -3
  12. data/admin/Rakefile +1 -15
  13. data/admin/app/assets/javascripts/gaku/admin.js.coffee +6 -0
  14. data/admin/app/assets/javascripts/gaku/admin/admin.coffee +6 -6
  15. data/admin/app/assets/javascripts/gaku/admin/base.js.coffee +11 -2
  16. data/admin/app/assets/stylesheets/gaku/admin.css +0 -1
  17. data/admin/app/assets/stylesheets/gaku/admin/bootstrap_and_theme.css.scss +16 -1
  18. data/admin/app/controllers/concerns/admin_picture_controller.rb +28 -0
  19. data/admin/app/controllers/gaku/admin/attendance_types_controller.rb +8 -8
  20. data/admin/app/controllers/gaku/admin/badge_types_controller.rb +9 -16
  21. data/admin/app/controllers/gaku/admin/base_controller.rb +1 -1
  22. data/admin/app/controllers/gaku/admin/campuses/addresses_controller.rb +58 -0
  23. data/admin/app/controllers/gaku/admin/campuses/contacts_controller.rb +73 -0
  24. data/admin/app/controllers/gaku/admin/campuses_controller.rb +68 -0
  25. data/admin/app/controllers/gaku/admin/commute_method_types_controller.rb +8 -7
  26. data/admin/app/controllers/gaku/admin/contact_types_controller.rb +7 -7
  27. data/admin/app/controllers/gaku/admin/departments_controller.rb +7 -7
  28. data/admin/app/controllers/gaku/admin/enrollment_statuses_controller.rb +9 -8
  29. data/admin/app/controllers/gaku/admin/grading_method_sets/grading_method_set_items_controller.rb +1 -1
  30. data/admin/app/controllers/gaku/admin/grading_method_sets_controller.rb +11 -11
  31. data/admin/app/controllers/gaku/admin/grading_methods_controller.rb +10 -9
  32. data/admin/app/controllers/gaku/admin/home_controller.rb +11 -0
  33. data/admin/app/controllers/gaku/admin/presets_controller.rb +4 -6
  34. data/admin/app/controllers/gaku/admin/roles_controller.rb +8 -7
  35. data/admin/app/controllers/gaku/admin/school_years/semesters_controller.rb +0 -1
  36. data/admin/app/controllers/gaku/admin/school_years_controller.rb +3 -7
  37. data/admin/app/controllers/gaku/admin/schools/programs_controller.rb +11 -4
  38. data/admin/app/controllers/gaku/admin/schools_controller.rb +82 -79
  39. data/admin/app/controllers/gaku/admin/simple_grade_types_controller.rb +71 -0
  40. data/admin/app/controllers/gaku/admin/specialties_controller.rb +2 -5
  41. data/admin/app/controllers/gaku/admin/states_controller.rb +71 -71
  42. data/admin/app/controllers/gaku/admin/student_review_categories_controller.rb +57 -0
  43. data/admin/app/controllers/gaku/admin/templates_controller.rb +47 -50
  44. data/admin/app/controllers/gaku/admin/users_controller.rb +5 -7
  45. data/admin/app/controllers/gaku/states_controller.rb +2 -0
  46. data/admin/app/helpers/gaku/admin_helper.rb +16 -1
  47. data/admin/app/helpers/gaku/shared_helper.rb +2 -2
  48. data/admin/app/overrides/admin_menu.rb +7 -6
  49. data/admin/app/views/gaku/admin/attendance_types/_attendance_types.html.slim +25 -0
  50. data/admin/app/views/gaku/admin/attendance_types/index.js.erb +1 -0
  51. data/admin/app/views/gaku/admin/attendance_types/index.json.rb +1 -1
  52. data/admin/app/views/gaku/admin/badge_types/_badge_types.html.slim +23 -0
  53. data/admin/app/views/gaku/admin/badge_types/_form.html.slim +1 -1
  54. data/admin/app/views/gaku/admin/badge_types/_modal.html.slim +1 -1
  55. data/admin/app/views/gaku/admin/badge_types/create.js.erb +7 -0
  56. data/admin/app/views/gaku/admin/badge_types/index.js.erb +1 -0
  57. data/admin/app/views/gaku/admin/badge_types/new.js.erb +1 -1
  58. data/admin/app/views/gaku/admin/badge_types/update.js.erb +3 -0
  59. data/admin/app/views/gaku/admin/campuses/_campus.html.slim +4 -0
  60. data/admin/app/views/gaku/admin/campuses/_campuses.html.slim +21 -0
  61. data/admin/app/views/gaku/admin/campuses/_edit_form.html.slim +3 -0
  62. data/admin/app/views/gaku/admin/{schools/campuses → campuses}/_form.html.slim +0 -0
  63. data/admin/app/views/gaku/admin/{schools/campuses → campuses}/_form_fields.html.slim +0 -0
  64. data/admin/app/views/gaku/admin/campuses/addresses/_address.html.slim +6 -0
  65. data/admin/app/views/gaku/admin/campuses/addresses/_address_row_fields.html.slim +4 -0
  66. data/admin/app/views/gaku/admin/campuses/addresses/_addresses.html.slim +23 -0
  67. data/admin/app/views/gaku/admin/{schools/campuses → campuses}/addresses/_fields.html.slim +0 -0
  68. data/admin/app/views/gaku/admin/{schools/campuses → campuses}/addresses/_form.html.slim +0 -0
  69. data/admin/app/views/gaku/admin/{schools/campuses → campuses}/addresses/_form_fields.html.slim +0 -0
  70. data/admin/app/views/gaku/admin/{schools/campuses → campuses}/addresses/_modal.html.slim +0 -0
  71. data/admin/app/views/gaku/admin/{schools/campuses → campuses}/addresses/create.js.erb +0 -0
  72. data/admin/app/views/gaku/admin/{schools/campuses → campuses}/addresses/destroy.js.erb +0 -0
  73. data/admin/app/views/gaku/admin/{schools/campuses → campuses}/addresses/edit.js.erb +0 -0
  74. data/admin/app/views/gaku/admin/campuses/addresses/index.js.erb +1 -0
  75. data/admin/app/views/gaku/admin/{schools/campuses → campuses}/addresses/new.js.erb +0 -0
  76. data/admin/app/views/gaku/admin/campuses/addresses/update.js.erb +4 -0
  77. data/admin/app/views/gaku/admin/campuses/contacts/_contact.html.slim +3 -0
  78. data/admin/app/views/gaku/admin/campuses/contacts/_contacts.html.slim +22 -0
  79. data/admin/app/views/gaku/admin/{schools/campuses → campuses}/contacts/_delete_link.html.slim +0 -0
  80. data/admin/app/views/gaku/admin/campuses/contacts/_fields.html.slim +11 -0
  81. data/admin/app/views/gaku/admin/{schools/campuses → campuses}/contacts/_form.html.slim +0 -0
  82. data/admin/app/views/gaku/admin/{schools/campuses → campuses}/contacts/_form_fields.html.slim +0 -0
  83. data/admin/app/views/gaku/admin/{schools/campuses → campuses}/contacts/_modal.html.slim +0 -0
  84. data/admin/app/views/gaku/admin/campuses/contacts/_primary_field.html.slim +6 -0
  85. data/admin/app/views/gaku/admin/campuses/contacts/create.js.erb +20 -0
  86. data/admin/app/views/gaku/admin/campuses/contacts/destroy.js.erb +8 -0
  87. data/admin/app/views/gaku/admin/campuses/contacts/edit.js.erb +4 -0
  88. data/admin/app/views/gaku/admin/campuses/contacts/index.js.erb +1 -0
  89. data/admin/app/views/gaku/admin/{schools/campuses → campuses}/contacts/make_primary.js.erb +0 -0
  90. data/admin/app/views/gaku/admin/{schools/campuses → campuses}/contacts/new.js.erb +0 -0
  91. data/admin/app/views/gaku/admin/{schools/campuses → campuses}/contacts/soft_delete.js.erb +0 -0
  92. data/admin/app/views/gaku/admin/{schools/campuses → campuses}/contacts/update.js.erb +0 -0
  93. data/admin/app/views/gaku/admin/{schools/campuses → campuses}/create.js.erb +0 -0
  94. data/admin/app/views/gaku/admin/{schools/campuses → campuses}/destroy.js.erb +0 -0
  95. data/admin/app/views/gaku/admin/campuses/edit.html.slim +34 -0
  96. data/admin/app/views/gaku/admin/campuses/edit.js.erb +1 -0
  97. data/admin/app/views/gaku/admin/campuses/index.js.erb +1 -0
  98. data/admin/app/views/gaku/admin/{schools/campuses → campuses}/new.js.erb +0 -0
  99. data/admin/app/views/gaku/admin/campuses/update.js.erb +2 -0
  100. data/admin/app/views/gaku/admin/commute_method_types/_commute_method_types.html.slim +18 -0
  101. data/admin/app/views/gaku/admin/commute_method_types/index.js.erb +1 -0
  102. data/admin/app/views/gaku/admin/contact_types/_contact_types.html.slim +18 -0
  103. data/admin/app/views/gaku/admin/contact_types/index.js.erb +1 -0
  104. data/admin/app/views/gaku/admin/departments/_departments.html.slim +21 -0
  105. data/admin/app/views/gaku/admin/departments/index.js.erb +1 -0
  106. data/admin/app/views/gaku/admin/enrollment_statuses/_enrollment_statuses.html.slim +20 -0
  107. data/admin/app/views/gaku/admin/enrollment_statuses/index.js.erb +1 -0
  108. data/admin/app/views/gaku/admin/grading_method_sets/_fields.html.slim +1 -1
  109. data/admin/app/views/gaku/admin/grading_method_sets/_grading_method_sets.html.slim +24 -0
  110. data/admin/app/views/gaku/admin/grading_method_sets/_show.html.slim +4 -0
  111. data/admin/app/views/gaku/admin/grading_method_sets/grading_method_set_items/_fields.html.slim +2 -2
  112. data/admin/app/views/gaku/admin/grading_method_sets/grading_method_set_items/_items.html.slim +1 -1
  113. data/admin/app/views/gaku/admin/grading_method_sets/index.js.erb +1 -0
  114. data/admin/app/views/gaku/admin/grading_method_sets/show.js.erb +1 -0
  115. data/admin/app/views/gaku/admin/grading_methods/_criteria_form_fields.html.slim +19 -0
  116. data/admin/app/views/gaku/admin/grading_methods/_criteria_template.html.slim +11 -0
  117. data/admin/app/views/gaku/admin/grading_methods/_fields.html.slim +1 -1
  118. data/admin/app/views/gaku/admin/grading_methods/_form_fields.html.slim +3 -2
  119. data/admin/app/views/gaku/admin/grading_methods/_grading_methods.html.slim +21 -0
  120. data/admin/app/views/gaku/admin/grading_methods/index.js.erb +1 -0
  121. data/admin/app/views/gaku/admin/home/index.html.slim +5 -0
  122. data/admin/app/views/gaku/admin/presets/_address.html.slim +8 -7
  123. data/admin/app/views/gaku/admin/presets/_chooser_fields.html.slim +1 -1
  124. data/admin/app/views/gaku/admin/presets/_export_formats.html.slim +5 -4
  125. data/admin/app/views/gaku/admin/presets/_fields.html.slim +1 -1
  126. data/admin/app/views/gaku/admin/presets/_grading.html.slim +4 -3
  127. data/admin/app/views/gaku/admin/presets/_locale.html.slim +6 -3
  128. data/admin/app/views/gaku/admin/presets/_names_order.html.slim +1 -1
  129. data/admin/app/views/gaku/admin/presets/_pagination.html.slim +10 -9
  130. data/admin/app/views/gaku/admin/presets/_person.html.slim +3 -2
  131. data/admin/app/views/gaku/admin/presets/_presets.html.slim +19 -0
  132. data/admin/app/views/gaku/admin/presets/_student.html.slim +1 -1
  133. data/admin/app/views/gaku/admin/presets/_tabs.html.slim +2 -3
  134. data/admin/app/views/gaku/admin/presets/edit.js.erb +1 -0
  135. data/admin/app/views/gaku/admin/presets/index.js.erb +1 -0
  136. data/{archive/app/views/gaku/course_groups/recovery.js.erb → admin/app/views/gaku/admin/presets/update.js.erb} +0 -0
  137. data/admin/app/views/gaku/admin/roles/_roles.html.slim +21 -0
  138. data/admin/app/views/gaku/admin/roles/index.js.erb +1 -0
  139. data/admin/app/views/gaku/admin/school_years/_edit_form.html.slim +4 -0
  140. data/admin/app/views/gaku/admin/school_years/_fields.html.slim +1 -2
  141. data/admin/app/views/gaku/admin/school_years/_school_years.html.slim +23 -0
  142. data/admin/app/views/gaku/admin/school_years/edit.html.slim +20 -0
  143. data/admin/app/views/gaku/admin/school_years/edit.js.erb +4 -2
  144. data/admin/app/views/gaku/admin/school_years/index.js.erb +1 -0
  145. data/admin/app/views/gaku/admin/school_years/semesters/_semesters.html.slim +1 -1
  146. data/admin/app/views/gaku/admin/school_years/semesters/index.js.erb +1 -0
  147. data/admin/app/views/gaku/admin/schools/_edit_form.html.slim +3 -0
  148. data/admin/app/views/gaku/admin/schools/_edit_master_form.html.slim +10 -0
  149. data/admin/app/views/gaku/admin/schools/_school.html.slim +4 -2
  150. data/admin/app/views/gaku/admin/schools/_schools.html.slim +26 -0
  151. data/admin/app/views/gaku/admin/schools/_tabs.html.slim +1 -1
  152. data/admin/app/views/gaku/admin/schools/edit.html.slim +37 -14
  153. data/admin/app/views/gaku/admin/schools/edit.js.erb +1 -0
  154. data/admin/app/views/gaku/admin/schools/edit_master.html.slim +36 -16
  155. data/admin/app/views/gaku/admin/schools/index.js.erb +1 -0
  156. data/admin/app/views/gaku/admin/schools/programs/_fields.html.slim +3 -4
  157. data/admin/app/views/gaku/admin/schools/programs/_programs.html.slim +2 -2
  158. data/admin/app/views/gaku/admin/schools/programs/create.js.erb +1 -0
  159. data/admin/app/views/gaku/admin/schools/programs/destroy.js.erb +1 -0
  160. data/admin/app/views/gaku/admin/schools/programs/index.js.erb +1 -0
  161. data/{archive/app/views/gaku/syllabuses/recovery.js.erb → admin/app/views/gaku/admin/schools/update.js.erb} +0 -0
  162. data/admin/app/views/gaku/admin/shared/_ajax_picture.html.slim +8 -0
  163. data/admin/app/views/gaku/admin/shared/_ajax_upload_picture.html.slim +14 -0
  164. data/admin/app/views/gaku/admin/shared/remove_picture.js.erb +3 -0
  165. data/admin/app/views/gaku/admin/shared/set_picture.js.erb +3 -0
  166. data/admin/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/_fields.html.slim +0 -0
  167. data/admin/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/_form.html.slim +0 -0
  168. data/admin/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/_form_fields.html.slim +0 -0
  169. data/admin/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/_modal.html.slim +0 -0
  170. data/admin/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/_simple_grade_type.html.slim +0 -0
  171. data/admin/app/views/gaku/admin/simple_grade_types/_simple_grade_types.html.slim +24 -0
  172. data/admin/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/create.js.erb +0 -0
  173. data/admin/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/destroy.js.erb +0 -0
  174. data/admin/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/edit.js.erb +0 -0
  175. data/admin/app/views/gaku/admin/simple_grade_types/index.js.erb +1 -0
  176. data/admin/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/new.js.erb +0 -0
  177. data/admin/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/update.js.erb +0 -0
  178. data/admin/app/views/gaku/admin/specialties/_specialties.html.slim +22 -0
  179. data/admin/app/views/gaku/admin/specialties/index.js.erb +1 -0
  180. data/admin/app/views/gaku/admin/states/_country_select_form.html.slim +1 -2
  181. data/admin/app/views/gaku/admin/states/_form_fields.html.slim +1 -1
  182. data/admin/app/views/gaku/admin/states/_states.html.slim +16 -0
  183. data/admin/app/views/gaku/admin/states/index.js.erb +1 -0
  184. data/admin/app/views/gaku/admin/student_review_categories/_form.html.slim +3 -0
  185. data/admin/app/views/gaku/admin/student_review_categories/_form_fields.html.slim +1 -0
  186. data/admin/app/views/gaku/admin/student_review_categories/_modal.html.slim +4 -0
  187. data/admin/app/views/gaku/admin/student_review_categories/_student_review_categories.html.slim +18 -0
  188. data/admin/app/views/gaku/admin/student_review_categories/_student_review_category.html.slim +2 -0
  189. data/admin/app/views/gaku/admin/student_review_categories/_table_fields.html.slim +4 -0
  190. data/admin/app/views/gaku/admin/student_review_categories/create.js.erb +7 -0
  191. data/admin/app/views/gaku/admin/student_review_categories/destroy.js.erb +2 -0
  192. data/admin/app/views/gaku/admin/student_review_categories/edit.js.erb +3 -0
  193. data/admin/app/views/gaku/admin/student_review_categories/index.js.erb +1 -0
  194. data/admin/app/views/gaku/admin/student_review_categories/new.js.erb +3 -0
  195. data/admin/app/views/gaku/admin/student_review_categories/update.js.erb +3 -0
  196. data/admin/app/views/gaku/admin/templates/_fields.html.slim +2 -2
  197. data/admin/app/views/gaku/admin/templates/_form.html.slim +1 -1
  198. data/admin/app/views/gaku/admin/templates/_modal.html.slim +5 -2
  199. data/admin/app/views/gaku/admin/templates/_templates.html.slim +21 -0
  200. data/admin/app/views/gaku/admin/templates/create.js.erb +7 -0
  201. data/admin/app/views/gaku/admin/templates/edit.js.erb +3 -0
  202. data/admin/app/views/gaku/admin/templates/index.js.erb +1 -0
  203. data/admin/app/views/gaku/admin/templates/new.js.erb +3 -0
  204. data/admin/app/views/gaku/admin/templates/update.js.erb +3 -0
  205. data/admin/app/views/gaku/admin/users/_users.html.slim +22 -0
  206. data/admin/app/views/gaku/admin/users/index.js.erb +1 -0
  207. data/admin/app/views/gaku/layouts/admin/index.html.slim +0 -1
  208. data/admin/app/views/gaku/shared/menu/_admin.html.erb +1 -71
  209. data/admin/app/views/gaku/shared/menu/_admin_menu.html.erb +154 -0
  210. data/admin/config/routes.rb +20 -10
  211. data/admin/gaku_admin.gemspec +19 -22
  212. data/admin/lib/gaku/admin.rb +2 -1
  213. data/admin/lib/gaku/admin/engine.rb +3 -5
  214. data/admin/lib/gaku/app_responder.rb +1 -1
  215. data/admin/lib/gaku_admin.rb +1 -1
  216. data/admin/lib/tasks/admin_user.rake +2 -1
  217. data/admin/spec/controllers/gaku/admin/badge_types_controller_spec.rb +32 -33
  218. data/admin/spec/controllers/gaku/admin/departments_controller_spec.rb +6 -9
  219. data/admin/spec/controllers/gaku/admin/grading/grading_method_set_items_controller_spec.rb +35 -23
  220. data/admin/spec/controllers/gaku/admin/grading/grading_method_sets_controller_spec.rb +10 -11
  221. data/admin/spec/controllers/gaku/admin/grading/grading_methods_controller_spec.rb +10 -11
  222. data/admin/spec/controllers/gaku/admin/presets_controller_spec.rb +9 -12
  223. data/admin/spec/controllers/gaku/admin/roles_controller_spec.rb +6 -9
  224. data/admin/spec/controllers/gaku/admin/school_years/school_years_controller_spec.rb +10 -10
  225. data/admin/spec/controllers/gaku/admin/school_years/semesters_controller_spec.rb +11 -3
  226. data/admin/spec/controllers/gaku/admin/schools/campuses/addresses_controller_spec.rb +14 -5
  227. data/admin/spec/controllers/gaku/admin/schools/campuses/campuses_controller_spec.rb +41 -41
  228. data/admin/spec/controllers/gaku/admin/schools/schools_controller_spec.rb +29 -30
  229. data/admin/spec/controllers/gaku/admin/simple_grade_types_controller_spec.rb +168 -0
  230. data/admin/spec/controllers/gaku/admin/specialties_controller_spec.rb +6 -9
  231. data/admin/spec/controllers/gaku/admin/templates_controller_spec.rb +15 -22
  232. data/admin/spec/controllers/gaku/admin/types_and_methods/attendance_types_controller_spec.rb +11 -12
  233. data/admin/spec/controllers/gaku/admin/types_and_methods/commute_method_types_controller_spec.rb +15 -12
  234. data/admin/spec/controllers/gaku/admin/types_and_methods/contact_types_controller_spec.rb +6 -9
  235. data/admin/spec/controllers/gaku/admin/types_and_methods/enrollment_statuses_controller_spec.rb +10 -11
  236. data/admin/spec/controllers/gaku/admin/users_controller_spec.rb +6 -9
  237. data/admin/spec/features/achievements/badge_types_spec.rb +76 -0
  238. data/admin/spec/features/achievements/simple_grade_types_spec.rb +12 -6
  239. data/admin/spec/features/departments_spec.rb +4 -3
  240. data/admin/spec/features/grading/grading_method_set_items_spec.rb +8 -4
  241. data/admin/spec/features/grading/grading_method_sets_spec.rb +9 -4
  242. data/admin/spec/features/grading/grading_methods_spec.rb +17 -13
  243. data/admin/spec/features/presets/address_preset_spec.rb +3 -2
  244. data/admin/spec/features/presets/chooser_fields_preset_spec.rb +3 -2
  245. data/admin/spec/features/presets/export_formats_spec.rb +4 -3
  246. data/admin/spec/features/presets/grading_preset_spec.rb +3 -2
  247. data/admin/spec/features/presets/locale_preset_spec.rb +4 -3
  248. data/admin/spec/features/presets/names_order_preset_spec.rb +3 -3
  249. data/admin/spec/features/presets/pagination_preset_spec.rb +3 -2
  250. data/admin/spec/features/presets/person_preset_spec.rb +3 -2
  251. data/admin/spec/features/presets/time_format_spec.rb +29 -0
  252. data/admin/spec/features/roles_spec.rb +7 -3
  253. data/admin/spec/features/school_years/school_years_spec.rb +22 -25
  254. data/admin/spec/features/school_years/semesters_spec.rb +20 -15
  255. data/admin/spec/features/schools/campuses/addresses_spec.rb +6 -3
  256. data/admin/spec/features/schools/campuses/campuses_spec.rb +13 -18
  257. data/admin/spec/features/schools/campuses/contacts_spec.rb +3 -4
  258. data/admin/spec/features/schools/campuses/picture_spec.rb +30 -12
  259. data/admin/spec/features/schools/picture_spec.rb +36 -12
  260. data/admin/spec/features/schools/programs_spec.rb +19 -15
  261. data/admin/spec/features/schools/school_details_spec.rb +35 -13
  262. data/admin/spec/features/schools/school_levels_spec.rb +14 -31
  263. data/admin/spec/features/schools/schools_spec.rb +7 -10
  264. data/admin/spec/features/specialties_spec.rb +5 -3
  265. data/admin/spec/features/templates_spec.rb +7 -20
  266. data/admin/spec/features/types_and_methods/attendance_types_spec.rb +14 -10
  267. data/admin/spec/features/types_and_methods/commute_method_types_spec.rb +14 -10
  268. data/admin/spec/features/types_and_methods/contact_types_spec.rb +6 -2
  269. data/admin/spec/features/types_and_methods/enrollment_statuses_spec.rb +15 -12
  270. data/admin/spec/features/types_and_methods/states_spec.rb +16 -11
  271. data/admin/spec/features/types_and_methods/student_review_categories_spec.rb +77 -0
  272. data/admin/spec/features/users_spec.rb +6 -4
  273. data/admin/spec/routing/admin/campuses/addresses_routes_spec.rb +56 -0
  274. data/admin/spec/routing/admin/campuses/campuses_routing_spec.rb +80 -0
  275. data/admin/spec/routing/admin/campuses/contacts_routing_spec.rb +56 -0
  276. data/admin/spec/routing/admin/school_years/school_years_routing_spec.rb +1 -3
  277. data/admin/spec/routing/admin/school_years/semesters_routing_spec.rb +1 -2
  278. data/admin/spec/routing/admin/schools/schools_routes_spec.rb +79 -0
  279. data/admin/spec/routing/admin/simple_grade_types_routing_spec.rb +6 -7
  280. data/admin/spec/routing/admin/templates_routing_spec.rb +1 -3
  281. data/admin/spec/support/controllers/shared_examples/allow.rb +1 -1
  282. data/admin/spec/support/features/shared_examples/addresses_spec.rb +9 -20
  283. data/admin/spec/support/features/shared_examples/avatarable_spec.rb +2 -7
  284. data/admin/spec/support/features/shared_examples/contacts_spec.rb +9 -11
  285. data/admin/spec/support/features/uploaded_file.rb +6 -0
  286. data/admin/spec/support/test.txt +1 -0
  287. data/common_gaku_dependencies.rb +10 -0
  288. data/common_gaku_gemspec_mixin.rb +11 -0
  289. data/core/Gemfile +1 -1
  290. data/core/Rakefile +1 -15
  291. data/core/app/controllers/gaku/core_controller.rb +3 -8
  292. data/core/app/decorators/gaku/course_decorator.rb +1 -2
  293. data/core/app/decorators/gaku/guardian_decorator.rb +1 -1
  294. data/core/app/decorators/gaku/person_decorator.rb +8 -12
  295. data/core/app/decorators/gaku/student_decorator.rb +0 -2
  296. data/core/app/decorators/gaku/teacher_decorator.rb +1 -1
  297. data/core/app/models/concerns/addresses.rb +6 -6
  298. data/core/app/models/concerns/contacts.rb +6 -6
  299. data/core/app/models/concerns/enrollmentable.rb +9 -0
  300. data/core/app/models/concerns/gradable.rb +14 -0
  301. data/core/app/models/concerns/notes.rb +1 -2
  302. data/core/app/models/concerns/pagination.rb +1 -2
  303. data/core/app/models/concerns/person.rb +0 -2
  304. data/core/app/models/concerns/picture.rb +1 -3
  305. data/core/app/models/concerns/semesterable.rb +12 -0
  306. data/core/app/models/concerns/student_reviewable.rb +7 -0
  307. data/core/app/models/gaku/ability.rb +2 -4
  308. data/core/app/models/gaku/address.rb +11 -10
  309. data/core/app/models/gaku/admin_ability.rb +0 -1
  310. data/core/app/models/gaku/assignment.rb +0 -2
  311. data/core/app/models/gaku/assignment_score.rb +0 -1
  312. data/core/app/models/gaku/attachment.rb +1 -4
  313. data/core/app/models/gaku/attendance.rb +0 -2
  314. data/core/app/models/gaku/attendance_type.rb +0 -2
  315. data/core/app/models/gaku/badge.rb +0 -2
  316. data/core/app/models/gaku/badge_type.rb +0 -1
  317. data/core/app/models/gaku/class_group.rb +13 -13
  318. data/core/app/models/gaku/commute_method_type.rb +0 -2
  319. data/core/app/models/gaku/contact.rb +6 -36
  320. data/core/app/models/gaku/contact_type.rb +0 -2
  321. data/core/app/models/gaku/country.rb +0 -3
  322. data/core/app/models/gaku/course.rb +11 -25
  323. data/core/app/models/gaku/course_group.rb +0 -2
  324. data/core/app/models/gaku/course_group_enrollment.rb +3 -4
  325. data/core/app/models/gaku/department.rb +0 -2
  326. data/core/app/models/gaku/enrollment.rb +85 -0
  327. data/core/app/models/gaku/enrollment_status.rb +0 -2
  328. data/core/app/models/gaku/exam.rb +17 -22
  329. data/core/app/models/gaku/exam_portion.rb +2 -6
  330. data/core/app/models/gaku/exam_portion_score.rb +0 -2
  331. data/core/app/models/gaku/exam_schedule.rb +0 -1
  332. data/core/app/models/gaku/exam_session.rb +14 -0
  333. data/core/app/models/gaku/exam_syllabus.rb +2 -6
  334. data/core/app/models/gaku/external_school_record.rb +1 -9
  335. data/core/app/models/gaku/extracurricular_activity.rb +1 -2
  336. data/core/app/models/gaku/faculty.rb +0 -2
  337. data/core/app/models/gaku/grading_method.rb +14 -2
  338. data/core/app/models/gaku/grading_method_connector.rb +35 -0
  339. data/core/app/models/gaku/grading_method_set.rb +6 -4
  340. data/core/app/models/gaku/grading_method_set_item.rb +4 -5
  341. data/core/app/models/gaku/guardian.rb +1 -3
  342. data/core/app/models/gaku/install.rb +0 -2
  343. data/core/app/models/gaku/lesson.rb +0 -1
  344. data/core/app/models/gaku/lesson_plan.rb +0 -2
  345. data/core/app/models/gaku/level.rb +0 -2
  346. data/core/app/models/gaku/preset.rb +18 -18
  347. data/core/app/models/gaku/program.rb +0 -2
  348. data/core/app/models/gaku/program_level.rb +0 -2
  349. data/core/app/models/gaku/program_specialty.rb +0 -2
  350. data/core/app/models/gaku/program_syllabus.rb +0 -2
  351. data/core/app/models/gaku/role.rb +0 -2
  352. data/core/app/models/gaku/schedule.rb +0 -1
  353. data/core/app/models/gaku/scholarship_status.rb +0 -2
  354. data/core/app/models/gaku/school.rb +0 -2
  355. data/core/app/models/gaku/school_role.rb +0 -2
  356. data/core/app/models/gaku/school_year.rb +4 -2
  357. data/core/app/models/gaku/semester.rb +21 -6
  358. data/core/app/models/gaku/semester_attendance.rb +14 -0
  359. data/core/app/models/gaku/semester_connector.rb +27 -0
  360. data/core/app/models/gaku/simple_grade.rb +0 -2
  361. data/core/app/models/gaku/simple_grade_type.rb +0 -1
  362. data/core/app/models/gaku/specialty.rb +0 -2
  363. data/core/app/models/gaku/state.rb +0 -3
  364. data/core/app/models/gaku/student.rb +47 -45
  365. data/core/app/models/gaku/student_exam_session.rb +11 -0
  366. data/core/app/models/gaku/student_guardian.rb +0 -2
  367. data/core/app/models/gaku/student_review.rb +11 -0
  368. data/core/app/models/gaku/student_review_category.rb +13 -0
  369. data/core/app/models/gaku/student_specialty.rb +2 -5
  370. data/core/app/models/gaku/syllabus.rb +0 -4
  371. data/core/app/models/gaku/teacher.rb +0 -2
  372. data/core/app/models/gaku/template.rb +7 -9
  373. data/core/app/models/gaku/user.rb +10 -22
  374. data/core/app/models/gaku/user_role.rb +0 -2
  375. data/core/app/services/gaku/contact_creation.rb +49 -0
  376. data/core/app/services/gaku/contact_updation.rb +41 -0
  377. data/core/app/services/gaku/student_selection.rb +57 -0
  378. data/core/app/services/gaku/user_creator.rb +31 -0
  379. data/core/config/initializers/devise.rb +1 -1
  380. data/core/config/initializers/redis.rb +5 -0
  381. data/core/config/routes.rb +5 -10
  382. data/core/core_dependencies.rb +24 -0
  383. data/core/db/default/gaku/attendance_types.rb +14 -16
  384. data/core/db/default/gaku/commute_method_types.rb +2 -4
  385. data/core/db/default/gaku/enrollment_status.rb +3 -3
  386. data/core/db/default/gaku/master_school.rb +7 -6
  387. data/core/db/default/gaku/presets.rb +6 -9
  388. data/core/db/default/gaku/scholarship_statuses.rb +1 -1
  389. data/core/db/migrate/20140128141752_change_grading_methods_arguments_field.rb +5 -0
  390. data/core/db/migrate/20140213113405_create_grading_method_connectors_table.rb +9 -0
  391. data/core/db/migrate/20140304094422_create_gaku_exam_sessions_table.rb +10 -0
  392. data/core/db/migrate/20140304101025_create_gaku_student_exam_session_table.rb +8 -0
  393. data/core/db/migrate/20140325073941_add_time_format_24_to_presets_table.rb +5 -0
  394. data/core/db/migrate/20140408111314_remove_semester_join_tables.rb +6 -0
  395. data/core/db/migrate/20140408111358_create_semester_connectors_table.rb +8 -0
  396. data/core/db/migrate/20140423093155_create_enrollments_table.rb +11 -0
  397. data/core/db/migrate/20140423100114_clean_enrollments_join_models.rb +8 -0
  398. data/core/db/migrate/20140429112725_add_counters_to_enrollmentable.rb +11 -0
  399. data/core/db/migrate/20140604104210_rename_method_to_grading_method.rb +5 -0
  400. data/core/db/migrate/20140604113045_add_default_value_to_curved.rb +5 -0
  401. data/core/db/migrate/20140610091053_add_seat_number_to_enrollments.rb +5 -0
  402. data/core/db/migrate/20140701104700_change_hstore_to_string_criteria.rb +5 -0
  403. data/core/db/migrate/20140715135152_create_semester_attendance_table.rb +16 -0
  404. data/core/db/migrate/20140718105226_create_student_review_categories_table.rb +13 -0
  405. data/core/db/migrate/20140728121353_create_student_review_table.rb +12 -0
  406. data/core/db/seeds.rb +1 -1
  407. data/core/gaku_core.gemspec +12 -16
  408. data/core/lib/gaku/core.rb +2 -1
  409. data/core/lib/gaku/core/engine.rb +7 -5
  410. data/core/lib/gaku/core/url_helpers.rb +1 -1
  411. data/core/lib/gaku/grading/collection/base_method.rb +30 -0
  412. data/core/lib/gaku/grading/collection/calculations.rb +36 -0
  413. data/core/lib/gaku/grading/collection/interval.rb +55 -0
  414. data/core/lib/gaku/grading/collection/ordinal.rb +10 -0
  415. data/core/lib/gaku/grading/collection/percentage.rb +10 -0
  416. data/core/lib/gaku/grading/collection/result.rb +18 -0
  417. data/core/lib/gaku/grading/collection/score.rb +10 -0
  418. data/core/lib/gaku/grading/single/base_method.rb +30 -0
  419. data/core/lib/gaku/grading/single/calculations.rb +42 -0
  420. data/core/lib/gaku/grading/single/interval.rb +7 -0
  421. data/core/lib/gaku/grading/single/ordinal.rb +30 -0
  422. data/core/lib/gaku/grading/single/pass_fail.rb +2 -0
  423. data/core/lib/gaku/grading/single/percentage.rb +26 -0
  424. data/core/lib/gaku/grading/single/ratio.rb +2 -0
  425. data/core/lib/gaku/grading/single/result.rb +18 -0
  426. data/core/lib/gaku/grading/single/score.rb +15 -0
  427. data/core/lib/gaku/migrations.rb +1 -1
  428. data/core/lib/gaku/streamer/sse.rb +5 -5
  429. data/core/lib/gaku/testing/auth_helpers.rb +6 -2
  430. data/core/lib/gaku/testing/common_rake.rb +9 -3
  431. data/core/lib/gaku/testing/controller_helpers.rb +17 -12
  432. data/core/lib/gaku/testing/coverage.rb +1 -1
  433. data/core/lib/gaku/testing/deferred_garbage_collection.rb +3 -3
  434. data/core/lib/gaku/testing/factories/attachment_factory.rb +0 -1
  435. data/core/lib/gaku/testing/factories/attendance_type_factory.rb +1 -1
  436. data/core/lib/gaku/testing/factories/class_group_factory.rb +12 -1
  437. data/core/lib/gaku/testing/factories/contact_creation_factory.rb +18 -0
  438. data/core/lib/gaku/testing/factories/course_enrollment_factory.rb +9 -9
  439. data/core/lib/gaku/testing/factories/course_factory.rb +2 -4
  440. data/core/lib/gaku/testing/factories/course_group_factory.rb +2 -4
  441. data/core/lib/gaku/testing/factories/enrollment_factory.rb +10 -0
  442. data/core/lib/gaku/testing/factories/exam_factory.rb +1 -1
  443. data/core/lib/gaku/testing/factories/exam_portion_factory.rb +2 -4
  444. data/core/lib/gaku/testing/factories/exam_score_factory.rb +1 -1
  445. data/core/lib/gaku/testing/factories/exam_session_factory.rb +14 -0
  446. data/core/lib/gaku/testing/factories/extracurricular_activity_factory.rb +1 -1
  447. data/core/lib/gaku/testing/factories/grading_method_connector_factory.rb +11 -0
  448. data/core/lib/gaku/testing/factories/grading_method_factory.rb +3 -2
  449. data/core/lib/gaku/testing/factories/guardian_factory.rb +2 -4
  450. data/core/lib/gaku/testing/factories/lesson_plan_factory.rb +2 -2
  451. data/core/lib/gaku/testing/factories/preset_factory.rb +7 -7
  452. data/core/lib/gaku/testing/factories/program_factory.rb +0 -1
  453. data/core/lib/gaku/testing/factories/school_factory.rb +3 -3
  454. data/core/lib/gaku/testing/factories/semester_attendance_factory.rb +8 -0
  455. data/core/lib/gaku/testing/factories/semester_connectors_factory.rb +11 -0
  456. data/core/lib/gaku/testing/factories/semester_factory.rb +16 -0
  457. data/core/lib/gaku/testing/factories/simple_grade_type_factory.rb +1 -1
  458. data/core/lib/gaku/testing/factories/state_factory.rb +2 -1
  459. data/core/lib/gaku/testing/factories/student_exam_session_factory.rb +8 -0
  460. data/core/lib/gaku/testing/factories/student_factory.rb +15 -5
  461. data/core/lib/gaku/testing/factories/student_review_category_factory.rb +7 -0
  462. data/core/lib/gaku/testing/factories/student_review_factory.rb +13 -0
  463. data/core/lib/gaku/testing/factories/teacher_factory.rb +1 -1
  464. data/core/lib/gaku/testing/factories/template_factory.rb +5 -7
  465. data/core/lib/gaku/testing/factories/traits.rb +32 -4
  466. data/core/lib/gaku/testing/factories/user_factory.rb +0 -1
  467. data/core/lib/gaku_core.rb +1 -1
  468. data/core/lib/generators/gaku/dummy/dummy_generator.rb +5 -4
  469. data/core/lib/generators/gaku/install/install_generator.rb +16 -14
  470. data/core/lib/tasks/admin_user.rake +2 -1
  471. data/core/spec/lib/gaku/grading/collection/calculations_spec.rb +52 -0
  472. data/core/spec/lib/gaku/grading/collection/interval_spec.rb +56 -0
  473. data/core/spec/lib/gaku/grading/collection/ordinal_spec.rb +36 -0
  474. data/core/spec/lib/gaku/grading/collection/percentage_spec.rb +31 -0
  475. data/core/spec/lib/gaku/grading/collection/result_spec.rb +13 -0
  476. data/core/spec/lib/gaku/grading/collection/score_spec.rb +31 -0
  477. data/core/spec/lib/gaku/grading/single/calculations_spec.rb +88 -0
  478. data/core/spec/lib/gaku/grading/single/ordinal_spec.rb +95 -0
  479. data/core/spec/lib/gaku/grading/single/percentage_spec.rb +52 -0
  480. data/core/spec/lib/gaku/grading/single/result_spec.rb +12 -0
  481. data/core/spec/lib/gaku/grading/single/score_spec.rb +54 -0
  482. data/core/spec/models/address_spec.rb +1 -3
  483. data/core/spec/models/attendance_spec.rb +2 -2
  484. data/core/spec/models/campus_spec.rb +6 -3
  485. data/core/spec/models/class_group_spec.rb +52 -11
  486. data/core/spec/models/contact_spec.rb +10 -3
  487. data/core/spec/models/course_group_enrollment_spec.rb +4 -1
  488. data/core/spec/models/course_spec.rb +28 -30
  489. data/core/spec/models/enrollment_spec.rb +44 -0
  490. data/core/spec/models/exam_portion_score_spec.rb +1 -1
  491. data/core/spec/models/exam_portion_spec.rb +1 -1
  492. data/core/spec/models/exam_session_spec.rb +20 -0
  493. data/core/spec/models/exam_spec.rb +7 -5
  494. data/core/spec/models/external_school_record_spec.rb +4 -5
  495. data/core/spec/models/extracurricular_activity_spec.rb +27 -2
  496. data/core/spec/models/factories_spec.rb +2 -1
  497. data/core/spec/models/grading_method_connector_spec.rb +19 -0
  498. data/core/spec/models/grading_method_set_item_spec.rb +3 -2
  499. data/core/spec/models/grading_method_spec.rb +7 -3
  500. data/core/spec/models/guardian_spec.rb +12 -10
  501. data/core/spec/models/lesson_plan_spec.rb +5 -5
  502. data/core/spec/models/preset_spec.rb +14 -3
  503. data/core/spec/models/school_spec.rb +13 -13
  504. data/core/spec/models/school_year_spec.rb +1 -1
  505. data/core/spec/models/semester_attendance_spec.rb +15 -0
  506. data/core/spec/models/semester_connector_spec.rb +23 -0
  507. data/core/spec/models/semester_spec.rb +37 -7
  508. data/core/spec/models/student_exam_session_spec.rb +16 -0
  509. data/core/spec/models/student_review_category_spec.rb +18 -0
  510. data/core/spec/models/student_review_spec.rb +23 -0
  511. data/core/spec/models/student_spec.rb +94 -65
  512. data/core/spec/models/syllabus_spec.rb +4 -4
  513. data/core/spec/models/teacher_spec.rb +14 -8
  514. data/core/spec/models/user_spec.rb +52 -0
  515. data/core/spec/services/contact_creation_spec.rb +90 -0
  516. data/core/spec/services/contact_updation_spec.rb +78 -0
  517. data/core/spec/services/student_selection_spec.rb +65 -0
  518. data/core/spec/services/user_creator_spec.rb +58 -0
  519. data/core/spec/spec_helper_base.rb +5 -1
  520. data/core/spec/spec_helper_models.rb +3 -2
  521. data/core/spec/support/models/matchers/accept_nested_attributes_for_matcher.rb +14 -10
  522. data/core/spec/support/models/shared_examples/addressable.rb +1 -1
  523. data/core/spec/support/models/shared_examples/enrollmentable.rb +4 -0
  524. data/core/spec/support/models/shared_examples/gradable.rb +4 -0
  525. data/core/spec/support/models/shared_examples/notable.rb +1 -1
  526. data/core/spec/support/models/shared_examples/person.rb +1 -1
  527. data/core/spec/support/models/shared_examples/semesterable.rb +4 -0
  528. data/core/spec/support/models/shared_examples/student_reviewable.rb +3 -0
  529. data/frontend/Gemfile +5 -3
  530. data/frontend/Rakefile +1 -15
  531. data/frontend/app/assets/javascripts/gaku/frontend.js.coffee +8 -1
  532. data/frontend/app/assets/javascripts/gaku/frontend/base.js.coffee +95 -22
  533. data/frontend/app/assets/javascripts/gaku/frontend/class_groups.js.coffee +2 -0
  534. data/frontend/app/assets/javascripts/gaku/frontend/courses.js.coffee +20 -7
  535. data/frontend/app/assets/javascripts/gaku/frontend/exams.js.coffee +3 -1
  536. data/frontend/app/assets/javascripts/gaku/frontend/guardians.js.coffee +14 -0
  537. data/frontend/app/assets/javascripts/gaku/frontend/students.js.coffee +7 -0
  538. data/frontend/app/assets/javascripts/gaku/frontend/syllabuses.js.coffee +0 -14
  539. data/frontend/app/assets/javascripts/gaku/frontend/teachers.js.coffee +2 -0
  540. data/frontend/app/assets/stylesheets/gaku/bootstrap_and_theme.css.scss +10 -1
  541. data/frontend/app/assets/stylesheets/gaku/frontend.css +1 -1
  542. data/frontend/app/controllers/concerns/picture_controller.rb +29 -0
  543. data/frontend/app/controllers/concerns/poly_controller.rb +49 -0
  544. data/frontend/app/controllers/concerns/polymorphic_resource_concern.rb +5 -5
  545. data/frontend/app/controllers/concerns/student_chooser_controller.rb +1 -1
  546. data/frontend/app/controllers/gaku/addresses_controller.rb +12 -4
  547. data/frontend/app/controllers/gaku/attachments_controller.rb +17 -25
  548. data/frontend/app/controllers/gaku/class_groups/enrollments_controller.rb +30 -0
  549. data/frontend/app/controllers/gaku/class_groups/semester_attendances_controller.rb +53 -0
  550. data/frontend/app/controllers/gaku/class_groups/student_reviews_controller.rb +60 -0
  551. data/frontend/app/controllers/gaku/class_groups_controller.rb +20 -12
  552. data/frontend/app/controllers/gaku/contacts_controller.rb +10 -5
  553. data/frontend/app/controllers/gaku/course_groups/course_group_enrollments_controller.rb +10 -1
  554. data/frontend/app/controllers/gaku/course_groups_controller.rb +1 -2
  555. data/frontend/app/controllers/gaku/courses/exams_controller.rb +18 -10
  556. data/frontend/app/controllers/gaku/courses_controller.rb +25 -10
  557. data/frontend/app/controllers/gaku/devise/passwords_controller.rb +1 -1
  558. data/frontend/app/controllers/gaku/devise/registrations_controller.rb +1 -1
  559. data/frontend/app/controllers/gaku/devise/sessions_controller.rb +4 -2
  560. data/frontend/app/controllers/gaku/enrollments_controller.rb +130 -0
  561. data/frontend/app/controllers/gaku/exam_portion_scores_controller.rb +29 -6
  562. data/frontend/app/controllers/gaku/exams/exam_portions_controller.rb +11 -3
  563. data/frontend/app/controllers/gaku/exams/exam_sessions_controller.rb +58 -0
  564. data/frontend/app/controllers/gaku/exams_controller.rb +19 -45
  565. data/frontend/app/controllers/gaku/extracurricular_activities_controller.rb +6 -2
  566. data/frontend/app/controllers/gaku/gaku_controller.rb +11 -0
  567. data/frontend/app/controllers/gaku/grading_method_connectors_controller.rb +109 -0
  568. data/frontend/app/controllers/gaku/guardians_controller.rb +66 -0
  569. data/frontend/app/controllers/gaku/notes_controller.rb +6 -1
  570. data/frontend/app/controllers/gaku/realtime_controller.rb +6 -7
  571. data/frontend/app/controllers/gaku/semester_connectors_controller.rb +66 -0
  572. data/frontend/app/controllers/gaku/student_selection_controller.rb +58 -0
  573. data/frontend/app/controllers/gaku/students/badges_controller.rb +2 -2
  574. data/frontend/app/controllers/gaku/students/class_group_enrollments_controller.rb +24 -16
  575. data/frontend/app/controllers/gaku/students/course_enrollments_controller.rb +21 -19
  576. data/frontend/app/controllers/gaku/students/external_school_records_controller.rb +5 -12
  577. data/frontend/app/controllers/gaku/students/extracurricular_activity_enrollments_controller.rb +53 -0
  578. data/frontend/app/controllers/gaku/students/simple_grades_controller.rb +1 -1
  579. data/frontend/app/controllers/gaku/students_controller.rb +31 -47
  580. data/frontend/app/controllers/gaku/syllabuses/exam_syllabuses_controller.rb +6 -1
  581. data/frontend/app/controllers/gaku/syllabuses/exams_controller.rb +3 -2
  582. data/frontend/app/controllers/gaku/syllabuses_controller.rb +2 -4
  583. data/frontend/app/controllers/gaku/teachers_controller.rb +7 -4
  584. data/frontend/app/helpers/gaku/autocomplete_helper.rb +1 -1
  585. data/frontend/app/helpers/gaku/exam_helper.rb +1 -1
  586. data/frontend/app/helpers/gaku/frontend_helper.rb +23 -7
  587. data/frontend/app/helpers/gaku/person_helper.rb +7 -8
  588. data/frontend/app/helpers/gaku/shared_helper.rb +2 -6
  589. data/frontend/app/helpers/gaku/students_helper.rb +4 -6
  590. data/frontend/app/overrides/frontend_menu.rb +6 -6
  591. data/frontend/app/views/gaku/addresses/_addresses.html.slim +3 -2
  592. data/frontend/app/views/gaku/addresses/_fields.html.slim +3 -4
  593. data/frontend/app/views/gaku/addresses/_form_fields.html.slim +5 -7
  594. data/frontend/app/views/gaku/addresses/_primary_field.html.slim +3 -10
  595. data/frontend/app/views/gaku/addresses/create.js.erb +2 -1
  596. data/frontend/app/views/gaku/addresses/destroy.js.erb +2 -1
  597. data/frontend/app/views/gaku/addresses/index.js.erb +1 -0
  598. data/frontend/app/views/gaku/addresses/show/_address.html.slim +9 -0
  599. data/frontend/app/views/gaku/addresses/show/_addresses.html.slim +19 -0
  600. data/frontend/app/views/gaku/addresses/soft_delete.js.erb +2 -1
  601. data/frontend/app/views/gaku/attachments/_attachment.html.slim +2 -0
  602. data/frontend/app/views/gaku/attachments/_attachments.html.slim +20 -0
  603. data/frontend/app/views/gaku/attachments/_form.html.slim +3 -0
  604. data/frontend/app/views/gaku/{exams/exam_portions/attachments → attachments}/_form_fields.html.slim +0 -0
  605. data/frontend/app/views/gaku/attachments/_modal.html.slim +4 -0
  606. data/frontend/app/views/gaku/attachments/_table_fields.html.slim +9 -0
  607. data/frontend/app/views/gaku/attachments/create.js.erb +8 -0
  608. data/frontend/app/views/gaku/attachments/edit.js.erb +3 -3
  609. data/frontend/app/views/gaku/attachments/new.js.erb +3 -1
  610. data/frontend/app/views/gaku/attachments/update.js.erb +5 -0
  611. data/frontend/app/views/gaku/class_groups/_edit_form.html.slim +9 -0
  612. data/frontend/app/views/gaku/class_groups/edit.html.slim +14 -12
  613. data/frontend/app/views/gaku/class_groups/edit.js.erb +1 -0
  614. data/frontend/app/views/gaku/class_groups/enrollments/_enrollment.html.slim +2 -0
  615. data/frontend/app/views/gaku/class_groups/enrollments/_enrollments.html.slim +21 -0
  616. data/frontend/app/views/gaku/class_groups/enrollments/_form.html.slim +4 -0
  617. data/frontend/app/views/gaku/class_groups/enrollments/_form_fields.html.slim +3 -0
  618. data/frontend/app/views/gaku/class_groups/enrollments/_table_fields.html.slim +5 -0
  619. data/frontend/app/views/gaku/class_groups/enrollments/create.js.erb +11 -0
  620. data/frontend/app/views/gaku/class_groups/enrollments/create_from_selection.js.erb +7 -0
  621. data/frontend/app/views/gaku/class_groups/enrollments/destroy.js.erb +9 -0
  622. data/frontend/app/views/gaku/class_groups/enrollments/index.js.erb +2 -0
  623. data/frontend/app/views/gaku/class_groups/enrollments/new.js.erb +3 -0
  624. data/frontend/app/views/gaku/class_groups/enrollments/sort.js.erb +3 -0
  625. data/frontend/app/views/gaku/class_groups/enrollments/student_selection.js.erb +2 -0
  626. data/frontend/app/views/gaku/class_groups/semester_attendances/_semester_attendances.html.slim +27 -0
  627. data/frontend/app/views/gaku/class_groups/semester_attendances/index.js.erb +1 -0
  628. data/frontend/app/views/gaku/class_groups/student_reviews/_edit_modal.html.slim +4 -0
  629. data/frontend/app/views/gaku/class_groups/student_reviews/_form_fields.html.slim +3 -0
  630. data/frontend/app/views/gaku/class_groups/student_reviews/_new_modal.html.slim +4 -0
  631. data/frontend/app/views/gaku/class_groups/student_reviews/_show_modal.html.slim +11 -0
  632. data/frontend/app/views/gaku/class_groups/student_reviews/create.js.erb +2 -0
  633. data/frontend/app/views/gaku/class_groups/student_reviews/destroy.js.erb +2 -0
  634. data/frontend/app/views/gaku/class_groups/student_reviews/edit.js.erb +5 -0
  635. data/frontend/app/views/gaku/class_groups/student_reviews/index.js.erb +8 -0
  636. data/frontend/app/views/gaku/class_groups/student_reviews/update.js.erb +2 -0
  637. data/{archive/app/views/gaku/class_groups/recovery.js.erb → frontend/app/views/gaku/class_groups/update.js.erb} +0 -0
  638. data/frontend/app/views/gaku/contacts/_contacts.html.slim +2 -2
  639. data/frontend/app/views/gaku/contacts/_fields.html.slim +3 -5
  640. data/frontend/app/views/gaku/contacts/_primary_field.html.slim +3 -11
  641. data/frontend/app/views/gaku/contacts/create.js.erb +2 -1
  642. data/frontend/app/views/gaku/contacts/destroy.js.erb +1 -0
  643. data/frontend/app/views/gaku/contacts/index.js.erb +2 -0
  644. data/frontend/app/views/gaku/contacts/show/_contact.html.slim +7 -0
  645. data/frontend/app/views/gaku/contacts/show/_contacts.html.slim +15 -0
  646. data/frontend/app/views/gaku/contacts/soft_delete.js.erb +1 -1
  647. data/frontend/app/views/gaku/course_groups/_edit_form.html.slim +9 -0
  648. data/frontend/app/views/gaku/course_groups/course_group_enrollments/_courses.html.slim +21 -20
  649. data/frontend/app/views/gaku/course_groups/course_group_enrollments/create.js.erb +1 -0
  650. data/frontend/app/views/gaku/course_groups/course_group_enrollments/destroy.js.erb +1 -0
  651. data/frontend/app/views/gaku/course_groups/course_group_enrollments/index.js.erb +1 -0
  652. data/frontend/app/views/gaku/course_groups/course_group_enrollments/new.js.erb +1 -1
  653. data/frontend/app/views/gaku/course_groups/edit.html.slim +13 -17
  654. data/frontend/app/views/gaku/course_groups/edit.js.erb +1 -0
  655. data/{archive/app/views/gaku/courses/recovery.js.erb → frontend/app/views/gaku/course_groups/update.js.erb} +0 -0
  656. data/frontend/app/views/gaku/courses/_courses.html.slim +1 -1
  657. data/frontend/app/views/gaku/courses/_edit_form.html.slim +9 -0
  658. data/frontend/app/views/gaku/courses/edit.html.slim +23 -12
  659. data/frontend/app/views/gaku/courses/edit.js.erb +1 -0
  660. data/frontend/app/views/gaku/courses/exams/_grading_table_head.html.slim +5 -2
  661. data/frontend/app/views/gaku/courses/exams/_grading_table_student_field.html.slim +5 -1
  662. data/frontend/app/views/gaku/courses/exams/index.js.erb +1 -0
  663. data/{archive/app/views/gaku/exams/recovery.js.erb → frontend/app/views/gaku/courses/update.js.erb} +0 -0
  664. data/frontend/app/views/gaku/enrollments/_enrollment.html.slim +2 -0
  665. data/frontend/app/views/gaku/enrollments/_enrollments.html.slim +19 -0
  666. data/frontend/app/views/gaku/enrollments/_form.html.slim +3 -0
  667. data/frontend/app/views/gaku/enrollments/_form_fields.html.slim +3 -0
  668. data/frontend/app/views/gaku/enrollments/_table_fields.html.slim +3 -0
  669. data/frontend/app/views/gaku/enrollments/create.js.erb +6 -0
  670. data/frontend/app/views/gaku/enrollments/create_from_selection.js.erb +7 -0
  671. data/frontend/app/views/gaku/enrollments/destroy.js.erb +4 -0
  672. data/frontend/app/views/gaku/enrollments/index.js.erb +1 -0
  673. data/frontend/app/views/gaku/enrollments/new.js.erb +3 -0
  674. data/frontend/app/views/gaku/enrollments/student_selection.js.erb +2 -0
  675. data/frontend/app/views/gaku/exams/_edit_form.html.slim +9 -0
  676. data/frontend/app/views/gaku/exams/_exams.html.slim +21 -0
  677. data/frontend/app/views/gaku/exams/_tabs.html.slim +5 -0
  678. data/frontend/app/views/gaku/exams/create.js.erb +1 -0
  679. data/frontend/app/views/gaku/exams/edit.html.slim +22 -12
  680. data/frontend/app/views/gaku/exams/edit.js.erb +1 -0
  681. data/frontend/app/views/gaku/exams/exam_portions/_edit_form.html.slim +14 -0
  682. data/frontend/app/views/gaku/exams/exam_portions/_exam_portion_menu_link.html.slim +1 -0
  683. data/frontend/app/views/gaku/exams/exam_portions/_exam_portions.html.slim +2 -5
  684. data/frontend/app/views/gaku/exams/exam_portions/_table_fields.slim +3 -7
  685. data/frontend/app/views/gaku/exams/exam_portions/_tabs.html.slim +1 -1
  686. data/frontend/app/views/gaku/exams/exam_portions/create.js.erb +4 -0
  687. data/frontend/app/views/gaku/exams/exam_portions/destroy.js.erb +2 -0
  688. data/frontend/app/views/gaku/exams/exam_portions/edit.html.slim +1 -16
  689. data/frontend/app/views/gaku/exams/exam_portions/edit.js.erb +1 -0
  690. data/frontend/app/views/gaku/exams/exam_portions/index.js.erb +1 -0
  691. data/frontend/app/views/gaku/exams/exam_portions/update.js.erb +2 -0
  692. data/frontend/app/views/gaku/exams/exam_sessions/_exam_session.html.slim +2 -0
  693. data/frontend/app/views/gaku/exams/exam_sessions/_exam_sessions.html.slim +20 -0
  694. data/frontend/app/views/gaku/exams/exam_sessions/_form.html.slim +3 -0
  695. data/frontend/app/views/gaku/exams/exam_sessions/_form_fields.html.slim +10 -0
  696. data/frontend/app/views/gaku/exams/exam_sessions/_students.html.slim +1 -0
  697. data/frontend/app/views/gaku/exams/exam_sessions/_table_fields.html.slim +6 -0
  698. data/frontend/app/views/gaku/exams/exam_sessions/_tabs.html.slim +10 -0
  699. data/frontend/app/views/gaku/exams/exam_sessions/create.js.erb +7 -0
  700. data/frontend/app/views/gaku/exams/{exam_portions/attachments/create.js.erb → exam_sessions/destroy.js.erb} +0 -0
  701. data/frontend/app/views/gaku/exams/exam_sessions/edit.html.slim +16 -0
  702. data/frontend/app/views/gaku/exams/exam_sessions/new.js.erb +4 -0
  703. data/frontend/app/views/gaku/exams/exam_sessions/update.js.erb +0 -0
  704. data/frontend/app/views/gaku/exams/export.xls.rb +9 -10
  705. data/frontend/app/views/gaku/exams/index.html.slim +18 -21
  706. data/frontend/app/views/gaku/extracurricular_activities/_edit_form.html.slim +9 -0
  707. data/frontend/app/views/gaku/extracurricular_activities/edit.html.slim +12 -12
  708. data/frontend/app/views/gaku/extracurricular_activities/edit.js.erb +1 -0
  709. data/{archive/app/views/gaku/extracurricular_activities/recovery.js.erb → frontend/app/views/gaku/extracurricular_activities/update.js.erb} +0 -0
  710. data/frontend/app/views/gaku/grading_method_connectors/_form.html.slim +3 -0
  711. data/frontend/app/views/gaku/grading_method_connectors/_form_fields.html.slim +1 -0
  712. data/frontend/app/views/gaku/grading_method_connectors/_grading_method_connector.html.slim +2 -0
  713. data/frontend/app/views/gaku/grading_method_connectors/_grading_method_connectors.html.slim +23 -0
  714. data/frontend/app/views/gaku/grading_method_connectors/_set_form.html.slim +6 -0
  715. data/frontend/app/views/gaku/grading_method_connectors/_table_fields.html.slim +4 -0
  716. data/frontend/app/views/gaku/grading_method_connectors/add_set.js.erb +12 -0
  717. data/frontend/app/views/gaku/grading_method_connectors/create.js.erb +10 -0
  718. data/frontend/app/views/gaku/grading_method_connectors/destroy.js.erb +5 -0
  719. data/frontend/app/views/gaku/grading_method_connectors/index.js.erb +1 -0
  720. data/frontend/app/views/gaku/grading_method_connectors/new.js.erb +7 -0
  721. data/frontend/app/views/gaku/grading_method_connectors/new_set.js.erb +6 -0
  722. data/frontend/app/views/gaku/guardians/_delete_modal.html.slim +11 -0
  723. data/frontend/app/views/gaku/guardians/_edit_form.html.slim +10 -0
  724. data/frontend/app/views/gaku/guardians/_form.html.slim +3 -0
  725. data/frontend/app/views/gaku/{students/guardians → guardians}/_form_fields.html.slim +0 -0
  726. data/frontend/app/views/gaku/guardians/_guardian.html.slim +6 -0
  727. data/frontend/app/views/gaku/guardians/_guardians.html.slim +21 -0
  728. data/frontend/app/views/gaku/guardians/create.js.erb +7 -0
  729. data/frontend/app/views/gaku/guardians/destroy.js.erb +2 -0
  730. data/frontend/app/views/gaku/guardians/edit.html.slim +32 -0
  731. data/frontend/app/views/gaku/guardians/edit.js.erb +1 -0
  732. data/frontend/app/views/gaku/guardians/index.js.erb +1 -0
  733. data/frontend/app/views/gaku/{students/guardians → guardians}/new.js.erb +0 -0
  734. data/{archive/app/views/gaku/students → frontend/app/views/gaku/guardians}/recovery.js.erb +0 -0
  735. data/frontend/app/views/gaku/notes/_buttons.html.slim +4 -8
  736. data/frontend/app/views/gaku/notes/_notes.html.slim +3 -5
  737. data/frontend/app/views/gaku/notes/create.js.erb +3 -1
  738. data/frontend/app/views/gaku/notes/destroy.js.erb +2 -1
  739. data/frontend/app/views/gaku/notes/index.js.erb +1 -0
  740. data/frontend/app/views/gaku/notes/show/_notes.html.slim +17 -0
  741. data/frontend/app/views/gaku/semester_connectors/_form.html.slim +4 -0
  742. data/frontend/app/views/gaku/semester_connectors/_form_fields.html.slim +3 -0
  743. data/frontend/app/views/gaku/semester_connectors/_modal.html.slim +4 -0
  744. data/frontend/app/views/gaku/semester_connectors/_semester_connector.html.slim +2 -0
  745. data/frontend/app/views/gaku/semester_connectors/_semester_connectors.html.slim +17 -0
  746. data/frontend/app/views/gaku/semester_connectors/_table_fields.html.slim +4 -0
  747. data/frontend/app/views/gaku/semester_connectors/create.js.erb +8 -0
  748. data/frontend/app/views/gaku/semester_connectors/destroy.js.erb +4 -0
  749. data/frontend/app/views/gaku/semester_connectors/edit.js.erb +3 -0
  750. data/frontend/app/views/gaku/semester_connectors/index.js.erb +1 -0
  751. data/frontend/app/views/gaku/semester_connectors/new.js.erb +4 -0
  752. data/frontend/app/views/gaku/semester_connectors/update.js.erb +3 -0
  753. data/frontend/app/views/gaku/shared/_ajax_picture.html.slim +8 -0
  754. data/frontend/app/views/gaku/shared/_ajax_upload_picture.html.slim +14 -0
  755. data/frontend/app/views/gaku/shared/_delete_modal_without_soft.html.slim +11 -0
  756. data/frontend/app/views/gaku/shared/fields/_attachment_fields.html.slim +4 -5
  757. data/frontend/app/views/gaku/shared/fields/_exam_portion_fields.html.slim +1 -1
  758. data/frontend/app/views/gaku/shared/js/remove_picture.js.erb +3 -0
  759. data/frontend/app/views/gaku/shared/js/set_picture.js.erb +3 -0
  760. data/frontend/app/views/gaku/shared/student_selection/_chooser.html.slim +16 -0
  761. data/frontend/app/views/gaku/shared/student_selection/_modal.html.slim +3 -0
  762. data/frontend/app/views/gaku/states/_no_states_select.html.slim +1 -1
  763. data/frontend/app/views/gaku/states/_states_select.html.slim +1 -1
  764. data/frontend/app/views/gaku/student_selection/_selected_student.html.slim +4 -0
  765. data/frontend/app/views/gaku/student_selection/add.js.erb +3 -0
  766. data/frontend/app/views/gaku/student_selection/clear.js.erb +2 -0
  767. data/frontend/app/views/gaku/student_selection/collection.js.erb +0 -0
  768. data/frontend/app/views/gaku/student_selection/index.js.erb +10 -0
  769. data/frontend/app/views/gaku/student_selection/remove.js.erb +8 -0
  770. data/frontend/app/views/gaku/students/_chooser_widget.html.slim +6 -2
  771. data/frontend/app/views/gaku/students/_edit_form.html.slim +9 -0
  772. data/frontend/app/views/gaku/students/_form_fields.html.slim +4 -7
  773. data/frontend/app/views/gaku/students/_student.html.slim +1 -2
  774. data/frontend/app/views/gaku/students/_student_unit.html.slim +0 -1
  775. data/frontend/app/views/gaku/students/_students.html.slim +5 -3
  776. data/frontend/app/views/gaku/students/_table_fields.html.slim +1 -1
  777. data/frontend/app/views/gaku/students/badges/_badges.html.slim +20 -2
  778. data/frontend/app/views/gaku/students/badges/_edit.html.slim +9 -8
  779. data/frontend/app/views/gaku/students/badges/create.js.erb +2 -7
  780. data/frontend/app/views/gaku/students/badges/destroy.js.erb +2 -4
  781. data/frontend/app/views/gaku/students/badges/edit.js.erb +2 -1
  782. data/frontend/app/views/gaku/students/badges/index.js.erb +1 -3
  783. data/frontend/app/views/gaku/students/badges/new.js.erb +1 -1
  784. data/frontend/app/views/gaku/students/badges/update.js.erb +3 -5
  785. data/frontend/app/views/gaku/students/chosen.js.erb +1 -3
  786. data/frontend/app/views/gaku/students/class_group_enrollments/_class_group_enrollment.html.slim +5 -0
  787. data/frontend/app/views/gaku/students/class_group_enrollments/_class_group_enrollments.html.slim +19 -0
  788. data/frontend/app/views/gaku/students/class_group_enrollments/_form.html.slim +4 -0
  789. data/frontend/app/views/gaku/students/class_group_enrollments/create.js.erb +10 -8
  790. data/frontend/app/views/gaku/students/class_group_enrollments/destroy.js.erb +3 -0
  791. data/frontend/app/views/gaku/students/class_group_enrollments/index.js.erb +1 -0
  792. data/frontend/app/views/gaku/students/class_group_enrollments/new.js.erb +3 -2
  793. data/frontend/app/views/gaku/students/course_enrollments/_course_enrollment.html.slim +3 -4
  794. data/frontend/app/views/gaku/students/course_enrollments/_course_enrollments.html.slim +3 -3
  795. data/frontend/app/views/gaku/students/course_enrollments/_form.html.slim +3 -4
  796. data/frontend/app/views/gaku/students/course_enrollments/create.js.erb +5 -5
  797. data/frontend/app/views/gaku/students/course_enrollments/destroy.js.erb +1 -1
  798. data/frontend/app/views/gaku/students/course_enrollments/index.js.erb +1 -0
  799. data/frontend/app/views/gaku/students/edit.html.slim +65 -35
  800. data/frontend/app/views/gaku/students/edit.js.erb +1 -0
  801. data/frontend/app/views/gaku/students/external_school_records/_external_school_record.html.slim +1 -1
  802. data/frontend/app/views/gaku/students/external_school_records/_external_school_records.html.slim +2 -2
  803. data/frontend/app/views/gaku/students/external_school_records/_fields.html.slim +3 -4
  804. data/frontend/app/views/gaku/students/external_school_records/_form_fields.html.slim +1 -1
  805. data/frontend/app/views/gaku/students/external_school_records/create.js.erb +3 -2
  806. data/frontend/app/views/gaku/students/external_school_records/destroy.js.erb +2 -1
  807. data/frontend/app/views/gaku/students/external_school_records/index.js.erb +1 -0
  808. data/frontend/app/views/gaku/students/external_school_records/update.js.erb +1 -1
  809. data/frontend/app/views/gaku/students/extracurricular_activity_enrollments/_extracurricular_activity_enrollment.html.slim +3 -0
  810. data/frontend/app/views/gaku/students/extracurricular_activity_enrollments/_extracurricular_activity_enrollments.html.slim +17 -0
  811. data/frontend/app/views/gaku/students/extracurricular_activity_enrollments/_form.html.slim +3 -0
  812. data/frontend/app/views/gaku/students/extracurricular_activity_enrollments/create.js.erb +9 -0
  813. data/frontend/app/views/gaku/students/extracurricular_activity_enrollments/destroy.js.erb +3 -0
  814. data/frontend/app/views/gaku/students/extracurricular_activity_enrollments/index.js.erb +1 -0
  815. data/frontend/app/views/gaku/students/extracurricular_activity_enrollments/new.js.erb +3 -0
  816. data/frontend/app/views/gaku/students/index.html.slim +0 -1
  817. data/frontend/app/views/gaku/students/simple_grades/_edit.html.slim +6 -8
  818. data/frontend/app/views/gaku/students/simple_grades/_form_fields.html.slim +7 -3
  819. data/frontend/app/views/gaku/students/simple_grades/_simple_grades.html.slim +21 -2
  820. data/frontend/app/views/gaku/students/simple_grades/create.js.erb +1 -1
  821. data/frontend/app/views/gaku/students/simple_grades/destroy.js.erb +1 -2
  822. data/frontend/app/views/gaku/students/simple_grades/edit.js.erb +5 -3
  823. data/frontend/app/views/gaku/students/simple_grades/index.js.erb +1 -5
  824. data/frontend/app/views/gaku/students/simple_grades/update.js.erb +2 -3
  825. data/frontend/app/views/gaku/students/student_specialties/_edit.html.slim +5 -7
  826. data/frontend/app/views/gaku/students/student_specialties/_student_specialties.html.slim +18 -2
  827. data/frontend/app/views/gaku/students/student_specialties/create.js.erb +3 -3
  828. data/frontend/app/views/gaku/students/student_specialties/destroy.js.erb +1 -1
  829. data/frontend/app/views/gaku/students/student_specialties/edit.js.erb +3 -2
  830. data/frontend/app/views/gaku/students/student_specialties/index.js.erb +1 -5
  831. data/frontend/app/views/gaku/students/student_specialties/update.js.erb +2 -3
  832. data/frontend/app/views/gaku/syllabuses/_edit_form.html.slim +9 -0
  833. data/frontend/app/views/gaku/syllabuses/edit.html.slim +12 -12
  834. data/frontend/app/views/gaku/syllabuses/edit.js.erb +1 -0
  835. data/frontend/app/views/gaku/syllabuses/exam_syllabuses/_form.html.slim +6 -0
  836. data/frontend/app/views/gaku/syllabuses/exam_syllabuses/create.js.erb +3 -3
  837. data/frontend/app/views/gaku/syllabuses/exam_syllabuses/destroy.js.erb +3 -2
  838. data/frontend/app/views/gaku/syllabuses/exam_syllabuses/new.js.erb +8 -0
  839. data/frontend/app/views/gaku/syllabuses/exams/_exams.html.slim +29 -13
  840. data/frontend/app/views/gaku/syllabuses/exams/destroy.js.erb +2 -2
  841. data/frontend/app/views/gaku/syllabuses/exams/index.js.erb +1 -0
  842. data/frontend/app/views/gaku/syllabuses/exams/new.js.erb +5 -0
  843. data/{archive/app/views/gaku/teachers/recovery.js.erb → frontend/app/views/gaku/syllabuses/update.js.erb} +0 -0
  844. data/frontend/app/views/gaku/teachers/_edit_form.html.slim +9 -0
  845. data/frontend/app/views/gaku/teachers/_fields.html.slim +5 -1
  846. data/frontend/app/views/gaku/teachers/_teacher.html.slim +1 -1
  847. data/frontend/app/views/gaku/teachers/_teachers.html.slim +1 -1
  848. data/frontend/app/views/gaku/teachers/edit.html.slim +22 -14
  849. data/frontend/app/views/gaku/teachers/edit.js.erb +1 -0
  850. data/frontend/app/views/gaku/teachers/show.html.slim +6 -8
  851. data/frontend/config/routes.rb +71 -37
  852. data/frontend/gaku_frontend.gemspec +23 -22
  853. data/frontend/lib/gaku/app_responder.rb +1 -1
  854. data/frontend/lib/gaku/frontend.rb +4 -1
  855. data/frontend/lib/gaku/frontend/engine.rb +2 -2
  856. data/frontend/lib/gaku_frontend.rb +1 -1
  857. data/frontend/lib/tasks/admin_user.rake +2 -1
  858. data/frontend/spec/controllers/gaku/addresses_controller_spec.rb +23 -7
  859. data/frontend/spec/controllers/gaku/class_groups/class_groups_controller_spec.rb +11 -6
  860. data/frontend/spec/controllers/gaku/contacts_controller_spec.rb +25 -8
  861. data/frontend/spec/controllers/gaku/course_groups/course_group_enrollments_controller.rb +12 -4
  862. data/frontend/spec/controllers/gaku/course_groups/course_groups_controller_spec.rb +0 -1
  863. data/frontend/spec/controllers/gaku/exams/exam_portions_controller_spec.rb +8 -4
  864. data/frontend/spec/controllers/gaku/exams/exam_sessions_controller_spec.rb +147 -0
  865. data/frontend/spec/controllers/gaku/exams/exams_controller_spec.rb +0 -2
  866. data/frontend/spec/controllers/gaku/extracurricular_activities_controller_spec.rb +66 -35
  867. data/frontend/spec/controllers/gaku/guardians_controller_spec.rb +125 -0
  868. data/frontend/spec/controllers/gaku/student_selection_controller_spec.rb +66 -0
  869. data/frontend/spec/controllers/gaku/students/badges_controller_spec.rb +17 -9
  870. data/frontend/spec/controllers/gaku/students/external_school_records_controller_spec.rb +35 -19
  871. data/frontend/spec/controllers/gaku/students/simple_grades_controller_spec.rb +16 -9
  872. data/frontend/spec/controllers/gaku/students/student_specialties_controller_spec.rb +17 -9
  873. data/frontend/spec/controllers/gaku/students/students_controller_spec.rb +179 -36
  874. data/frontend/spec/controllers/gaku/syllabuses_controller_spec.rb +44 -34
  875. data/frontend/spec/controllers/gaku/teachers_controller_spec.rb +10 -3
  876. data/frontend/spec/features/{change_language_spec.rb → other/change_language_spec.rb} +0 -0
  877. data/frontend/spec/features/other/class_groups/class_groups_spec.rb +96 -0
  878. data/frontend/spec/features/other/class_groups/enrollments_spec.rb +109 -0
  879. data/frontend/spec/features/other/class_groups/notes_spec.rb +32 -0
  880. data/frontend/spec/features/other/class_groups/semester_attendances_spec.rb +52 -0
  881. data/frontend/spec/features/other/class_groups/semester_connectors_spec.rb +106 -0
  882. data/frontend/spec/features/other/class_groups/student_reviews_spec.rb +77 -0
  883. data/frontend/spec/features/other/course_groups/course_groups_spec.rb +75 -0
  884. data/frontend/spec/features/other/course_groups/courses_spec.rb +38 -0
  885. data/frontend/spec/features/other/courses/courses_spec.rb +137 -0
  886. data/frontend/spec/features/other/courses/enrollments_spec.rb +96 -0
  887. data/frontend/spec/features/other/courses/exams_spec.rb +36 -0
  888. data/frontend/spec/features/other/courses/grading_method_connectors_spec.rb +99 -0
  889. data/frontend/spec/features/other/courses/notes_spec.rb +32 -0
  890. data/frontend/spec/features/other/courses/semester_connectors_spec.rb +97 -0
  891. data/frontend/spec/features/other/exams/exam_portions/attachments_spec.rb +90 -0
  892. data/frontend/spec/features/other/exams/exam_portions/exam_portions_spec.rb +86 -0
  893. data/frontend/spec/features/other/exams/exam_sessions_spec.rb +75 -0
  894. data/frontend/spec/features/other/exams/exams_spec.rb +138 -0
  895. data/frontend/spec/features/other/exams/grading_method_connectors_spec.rb +106 -0
  896. data/frontend/spec/features/other/exams/notes_spec.rb +32 -0
  897. data/frontend/spec/features/other/extracurricular_activities/enrollments_spec.rb +84 -0
  898. data/frontend/spec/features/other/extracurricular_activities/extracurricular_activities_spec.rb +66 -0
  899. data/frontend/spec/features/{sign_in_spec.rb → other/sign_in_spec.rb} +0 -0
  900. data/frontend/spec/features/{sign_out_spec.rb → other/sign_out_spec.rb} +0 -0
  901. data/frontend/spec/features/other/sign_up_spec.rb +70 -0
  902. data/frontend/spec/features/other/syllabuses/exams_spec.rb +161 -0
  903. data/frontend/spec/features/other/syllabuses/notes_spec.rb +32 -0
  904. data/frontend/spec/features/{syllabuses → other/syllabuses}/syllabuses_spec.rb +0 -0
  905. data/frontend/spec/features/other/teachers/addresses_spec.rb +62 -0
  906. data/frontend/spec/features/other/teachers/contacts_spec.rb +55 -0
  907. data/frontend/spec/features/other/teachers/notes_spec.rb +34 -0
  908. data/frontend/spec/features/other/teachers/picture_spec.rb +54 -0
  909. data/frontend/spec/features/other/teachers/teachers_spec.rb +81 -0
  910. data/frontend/spec/features/students/addresses_spec.rb +4 -2
  911. data/frontend/spec/features/students/badges_spec.rb +14 -18
  912. data/frontend/spec/features/students/class_group_enrollments_spec.rb +72 -28
  913. data/frontend/spec/features/students/contacts_spec.rb +3 -4
  914. data/frontend/spec/features/students/course_enrollments_spec.rb +43 -20
  915. data/frontend/spec/features/students/external_school_records_spec.rb +5 -6
  916. data/frontend/spec/features/students/extracurricular_activity_enrollments_spec.rb +64 -0
  917. data/frontend/spec/features/students/guardians/addresses_spec.rb +5 -3
  918. data/frontend/spec/features/students/guardians/contacts_spec.rb +5 -10
  919. data/frontend/spec/features/students/guardians/guardians_spec.rb +3 -5
  920. data/frontend/spec/features/students/guardians/picture_spec.rb +41 -8
  921. data/frontend/spec/features/students/notes_spec.rb +2 -4
  922. data/frontend/spec/features/students/picture_spec.rb +39 -8
  923. data/frontend/spec/features/students/preset_spec.rb +44 -48
  924. data/frontend/spec/features/students/simple_grades_spec.rb +12 -17
  925. data/frontend/spec/features/students/student_specialties_spec.rb +12 -18
  926. data/frontend/spec/features/students/students_selection_spec.rb +150 -0
  927. data/frontend/spec/features/students/students_spec.rb +51 -34
  928. data/frontend/spec/requests/class_groups/enrollments_spec.rb +236 -0
  929. data/frontend/spec/requests/courses/enrollments_spec.rb +242 -0
  930. data/frontend/spec/requests/extracurricular_activities/enrollments_spec.rb +258 -0
  931. data/frontend/spec/routing/class_groups/enrollments_routing_spec.rb +55 -0
  932. data/frontend/spec/routing/courses/enrollments_routing_spec.rb +55 -0
  933. data/frontend/spec/routing/extracurricular_activities/enrollments_routing_spec.rb +55 -0
  934. data/frontend/spec/routing/guardians_routing_spec.rb +79 -0
  935. data/frontend/spec/routing/student_routes_spec.rb +1 -7
  936. data/frontend/spec/routing/students/external_school_records_routing_spec.rb +62 -0
  937. data/frontend/spec/routing/students/simple_grades_routes_spec.rb +1 -2
  938. data/frontend/spec/routing/students/student_specialties_routes_spec.rb +1 -2
  939. data/frontend/spec/routing/teachers_routes_spec.rb +75 -0
  940. data/frontend/spec/support/controllers/shared_examples/allow.rb +1 -1
  941. data/frontend/spec/support/features/shared_examples/addresses_spec.rb +13 -15
  942. data/frontend/spec/support/features/shared_examples/avatarable_spec.rb +2 -3
  943. data/frontend/spec/support/features/shared_examples/contacts_spec.rb +2 -4
  944. data/frontend/spec/support/features/shared_examples/course_enrollable_spec.rb +10 -2
  945. data/frontend/spec/support/features/shared_examples/notes_spec.rb +10 -7
  946. data/frontend/spec/support/models/matchers/accept_nested_attributes_for_matcher.rb +36 -33
  947. data/frontend/spec/support/models/shared_examples/addressable.rb +1 -1
  948. data/frontend/spec/support/models/shared_examples/notable.rb +1 -1
  949. data/frontend/spec/support/models/shared_examples/person.rb +1 -1
  950. data/gaku.gemspec +25 -17
  951. data/lib/gaku.rb +1 -2
  952. data/sample/Rakefile +0 -12
  953. data/sample/db/sample/gaku/01_syllabuses.rb +128 -0
  954. data/sample/db/sample/gaku/02_courses.rb +12 -0
  955. data/sample/db/sample/gaku/20-grading_methods.rb +32 -0
  956. data/sample/db/sample/gaku/badge_types.rb +3 -7
  957. data/sample/db/sample/gaku/changes/student_changes.rb +27 -27
  958. data/sample/db/sample/gaku/class_groups.rb +3 -3
  959. data/sample/db/sample/gaku/disposals/address_and_contact_disposals.rb +1 -1
  960. data/sample/db/sample/gaku/disposals/attachment_disposals.rb +15 -7
  961. data/sample/db/sample/gaku/disposals/course_group_disposals.rb +6 -6
  962. data/sample/db/sample/gaku/disposals/exam_disposals.rb +6 -6
  963. data/sample/db/sample/gaku/disposals/student_disposals.rb +8 -8
  964. data/sample/db/sample/gaku/disposals/teacher_disposals.rb +6 -6
  965. data/sample/db/sample/gaku/exams.rb +1 -4
  966. data/sample/db/sample/gaku/extracurricular_activities.rb +1 -4
  967. data/sample/db/sample/gaku/grading_widget.rb +7 -13
  968. data/sample/db/sample/gaku/roles.rb +2 -5
  969. data/sample/db/sample/gaku/schools.rb +22 -0
  970. data/sample/db/sample/gaku/specialties.rb +2 -8
  971. data/sample/db/sample/gaku/students.rb +6 -8
  972. data/sample/db/sample/gaku/teachers.rb +5 -12
  973. data/sample/db/sample/gaku/users.rb +2 -3
  974. data/sample/gaku_sample.gemspec +6 -9
  975. data/sample/lib/shared_sample_data.rb +35 -24
  976. data/testing/Rakefile +6 -10
  977. data/testing/gaku_testing.gemspec +6 -11
  978. data/testing/lib/gaku/testing/env.rb +2 -2
  979. data/testing/lib/gaku/testing/feature_helpers.rb +3 -7
  980. data/testing/lib/gaku/testing/flash_helpers.rb +1 -1
  981. data/testing/lib/gaku/testing/spec_helpers/spec_helper.rb +7 -4
  982. data/testing/lib/gaku/testing/spec_helpers/spec_helper_base.rb +5 -1
  983. data/testing/lib/gaku/testing/spec_helpers/spec_helper_controllers.rb +4 -4
  984. data/testing/lib/gaku/testing/spec_helpers/spec_helper_models.rb +1 -1
  985. data/testing/lib/gaku_testing.rb +1 -1
  986. metadata +494 -459
  987. data/.ruby-gemset +0 -1
  988. data/.ruby-version +0 -1
  989. data/admin/.ruby-gemset +0 -1
  990. data/admin/.ruby-version +0 -1
  991. data/admin/app/controllers/gaku/admin/achievements/simple_grade_types_controller.rb +0 -70
  992. data/admin/app/controllers/gaku/admin/schools/campuses/addresses_controller.rb +0 -64
  993. data/admin/app/controllers/gaku/admin/schools/campuses/contacts_controller.rb +0 -77
  994. data/admin/app/controllers/gaku/admin/schools/campuses_controller.rb +0 -72
  995. data/admin/app/views/gaku/admin/achievements/simple_grade_types/index.html.slim +0 -23
  996. data/admin/app/views/gaku/admin/attendance_types/index.html.slim +0 -24
  997. data/admin/app/views/gaku/admin/badge_types/index.html.slim +0 -22
  998. data/admin/app/views/gaku/admin/commute_method_types/index.html.slim +0 -18
  999. data/admin/app/views/gaku/admin/contact_types/index.html.slim +0 -18
  1000. data/admin/app/views/gaku/admin/departments/index.html.slim +0 -20
  1001. data/admin/app/views/gaku/admin/enrollment_statuses/index.html.slim +0 -21
  1002. data/admin/app/views/gaku/admin/grading_method_sets/index.html.slim +0 -23
  1003. data/admin/app/views/gaku/admin/grading_method_sets/show.html.slim +0 -13
  1004. data/admin/app/views/gaku/admin/grading_methods/index.html.slim +0 -20
  1005. data/admin/app/views/gaku/admin/presets/index.html.slim +0 -16
  1006. data/admin/app/views/gaku/admin/roles/index.html.slim +0 -20
  1007. data/admin/app/views/gaku/admin/school_years/index.html.slim +0 -21
  1008. data/admin/app/views/gaku/admin/school_years/show.html.slim +0 -15
  1009. data/admin/app/views/gaku/admin/schools/campuses/_campus.html.slim +0 -6
  1010. data/admin/app/views/gaku/admin/schools/campuses/_campuses.html.slim +0 -23
  1011. data/admin/app/views/gaku/admin/schools/campuses/_picture.html.slim +0 -8
  1012. data/admin/app/views/gaku/admin/schools/campuses/_show_table.html.slim +0 -10
  1013. data/admin/app/views/gaku/admin/schools/campuses/_tabs.html.slim +0 -15
  1014. data/admin/app/views/gaku/admin/schools/campuses/_upload_picture.html.slim +0 -7
  1015. data/admin/app/views/gaku/admin/schools/campuses/addresses/_address.html.slim +0 -7
  1016. data/admin/app/views/gaku/admin/schools/campuses/addresses/_address_row_fields.html.slim +0 -4
  1017. data/admin/app/views/gaku/admin/schools/campuses/addresses/_addresses.html.slim +0 -24
  1018. data/admin/app/views/gaku/admin/schools/campuses/addresses/update.js.erb +0 -4
  1019. data/admin/app/views/gaku/admin/schools/campuses/contacts/_contact.html.slim +0 -3
  1020. data/admin/app/views/gaku/admin/schools/campuses/contacts/_contacts.html.slim +0 -22
  1021. data/admin/app/views/gaku/admin/schools/campuses/contacts/_fields.html.slim +0 -12
  1022. data/admin/app/views/gaku/admin/schools/campuses/contacts/_primary_field.html.slim +0 -13
  1023. data/admin/app/views/gaku/admin/schools/campuses/contacts/create.js.erb +0 -20
  1024. data/admin/app/views/gaku/admin/schools/campuses/contacts/destroy.js.erb +0 -8
  1025. data/admin/app/views/gaku/admin/schools/campuses/contacts/edit.js.erb +0 -4
  1026. data/admin/app/views/gaku/admin/schools/campuses/edit.html.slim +0 -19
  1027. data/admin/app/views/gaku/admin/schools/campuses/show.html.slim +0 -13
  1028. data/admin/app/views/gaku/admin/schools/index.html.slim +0 -25
  1029. data/admin/app/views/gaku/admin/schools/show.html.slim +0 -13
  1030. data/admin/app/views/gaku/admin/schools/show_master.html.slim +0 -14
  1031. data/admin/app/views/gaku/admin/specialties/index.html.slim +0 -21
  1032. data/admin/app/views/gaku/admin/states/index.html.slim +0 -15
  1033. data/admin/app/views/gaku/admin/templates/edit.html.slim +0 -1
  1034. data/admin/app/views/gaku/admin/templates/index.html.slim +0 -20
  1035. data/admin/app/views/gaku/admin/templates/new.html.slim +0 -1
  1036. data/admin/app/views/gaku/admin/users/index.html.slim +0 -21
  1037. data/admin/config/initializers/client_side_validations.rb +0 -9
  1038. data/admin/spec/controllers/gaku/admin/achievements/simple_grade_types_controller_spec.rb +0 -168
  1039. data/admin/spec/features/badge_types/badge_types_spec.rb +0 -72
  1040. data/admin/spec/routing/admin/schools/admin_school_routes_spec.rb +0 -79
  1041. data/admin/spec/routing/admin/schools/campuses/admin_schools_campus_routes_spec.rb +0 -65
  1042. data/admin/spec/routing/admin/schools/campuses/admin_schools_campuses_address_routes_spec.rb +0 -61
  1043. data/admin/spec/routing/admin/schools/campuses/contacts_routing_spec.rb +0 -61
  1044. data/all_dependencies.rb +0 -23
  1045. data/archive/.rspec +0 -2
  1046. data/archive/.ruby-gemset +0 -1
  1047. data/archive/.ruby-version +0 -1
  1048. data/archive/Gemfile +0 -8
  1049. data/archive/Rakefile +0 -31
  1050. data/archive/app/assets/javascripts/gaku/archive.js.coffee +0 -4
  1051. data/archive/app/assets/stylesheets/gaku/archive.css +0 -5
  1052. data/archive/app/controllers/concerns/trashable_controller.rb +0 -32
  1053. data/archive/app/controllers/gaku/admin/changes/student_address_changes_controller.rb +0 -14
  1054. data/archive/app/controllers/gaku/admin/changes/student_changes_controller.rb +0 -13
  1055. data/archive/app/controllers/gaku/admin/changes/student_contact_changes_controller.rb +0 -13
  1056. data/archive/app/controllers/gaku/admin/disposals_controller.rb +0 -55
  1057. data/archive/app/controllers/gaku/admin/students_controller.rb +0 -22
  1058. data/archive/app/controllers/gaku/class_groups_controller_injector.rb +0 -5
  1059. data/archive/app/controllers/gaku/contacts_controller_injector.rb +0 -21
  1060. data/archive/app/controllers/gaku/course_groups_controller_injector.rb +0 -5
  1061. data/archive/app/controllers/gaku/courses_controller_injector.rb +0 -5
  1062. data/archive/app/controllers/gaku/exams_controller_injector.rb +0 -5
  1063. data/archive/app/controllers/gaku/extracurricular_activities_controller_injector.rb +0 -5
  1064. data/archive/app/controllers/gaku/students_controller_injector.rb +0 -5
  1065. data/archive/app/controllers/gaku/syllabuses_controller_injector.rb +0 -5
  1066. data/archive/app/controllers/gaku/teachers_controller_injector.rb +0 -5
  1067. data/archive/app/models/concerns/trashable.rb +0 -17
  1068. data/archive/app/models/gaku/address_injector.rb +0 -31
  1069. data/archive/app/models/gaku/attachment_injector.rb +0 -5
  1070. data/archive/app/models/gaku/class_group_injector.rb +0 -5
  1071. data/archive/app/models/gaku/contact_injector.rb +0 -34
  1072. data/archive/app/models/gaku/course_group_injector.rb +0 -5
  1073. data/archive/app/models/gaku/course_injector.rb +0 -5
  1074. data/archive/app/models/gaku/exam_injector.rb +0 -5
  1075. data/archive/app/models/gaku/extracurricular_activity_injector.rb +0 -5
  1076. data/archive/app/models/gaku/guardian_injector.rb +0 -5
  1077. data/archive/app/models/gaku/student_injector.rb +0 -16
  1078. data/archive/app/models/gaku/syllabus_injector.rb +0 -5
  1079. data/archive/app/models/gaku/teacher_injector.rb +0 -5
  1080. data/archive/app/models/gaku/versioning/address_version.rb +0 -9
  1081. data/archive/app/models/gaku/versioning/contact_version.rb +0 -7
  1082. data/archive/app/models/gaku/versioning/student_version.rb +0 -47
  1083. data/archive/app/overrides/archive_menu.rb +0 -6
  1084. data/archive/app/views/gaku/addresses/_delete_link.html.slim +0 -1
  1085. data/archive/app/views/gaku/admin/changes/student_address_changes/_change.html.slim +0 -10
  1086. data/archive/app/views/gaku/admin/changes/student_address_changes/_changes.html.slim +0 -19
  1087. data/archive/app/views/gaku/admin/changes/student_address_changes/_deletion.html.slim +0 -9
  1088. data/archive/app/views/gaku/admin/changes/student_address_changes/index.html.slim +0 -11
  1089. data/archive/app/views/gaku/admin/changes/student_changes/_change.html.slim +0 -10
  1090. data/archive/app/views/gaku/admin/changes/student_changes/_changes.html.slim +0 -18
  1091. data/archive/app/views/gaku/admin/changes/student_changes/_deletion.html.slim +0 -9
  1092. data/archive/app/views/gaku/admin/changes/student_changes/index.html.slim +0 -13
  1093. data/archive/app/views/gaku/admin/changes/student_contact_changes/_change.html.slim +0 -10
  1094. data/archive/app/views/gaku/admin/changes/student_contact_changes/_changes.html.slim +0 -19
  1095. data/archive/app/views/gaku/admin/changes/student_contact_changes/_deletion.html.slim +0 -9
  1096. data/archive/app/views/gaku/admin/changes/student_contact_changes/index.html.slim +0 -11
  1097. data/archive/app/views/gaku/admin/disposals/_address.html.slim +0 -12
  1098. data/archive/app/views/gaku/admin/disposals/_addresses.html.slim +0 -17
  1099. data/archive/app/views/gaku/admin/disposals/_contact.html.slim +0 -9
  1100. data/archive/app/views/gaku/admin/disposals/_contacts.html.slim +0 -14
  1101. data/archive/app/views/gaku/admin/disposals/_course_group.html.slim +0 -3
  1102. data/archive/app/views/gaku/admin/disposals/_course_groups.html.slim +0 -12
  1103. data/archive/app/views/gaku/admin/disposals/_exam.html.slim +0 -10
  1104. data/archive/app/views/gaku/admin/disposals/_guardian.html.slim +0 -10
  1105. data/archive/app/views/gaku/admin/disposals/_student.html.slim +0 -10
  1106. data/archive/app/views/gaku/admin/disposals/_tabs.html.slim +0 -17
  1107. data/archive/app/views/gaku/admin/disposals/_teacher.html.slim +0 -10
  1108. data/archive/app/views/gaku/admin/disposals/addresses.html.slim +0 -2
  1109. data/archive/app/views/gaku/admin/disposals/attachments.html.slim +0 -30
  1110. data/archive/app/views/gaku/admin/disposals/contacts.html.slim +0 -2
  1111. data/archive/app/views/gaku/admin/disposals/course_groups.html.slim +0 -12
  1112. data/archive/app/views/gaku/admin/disposals/exams.html.slim +0 -16
  1113. data/archive/app/views/gaku/admin/disposals/guardians.html.slim +0 -16
  1114. data/archive/app/views/gaku/admin/disposals/index.html.slim +0 -1
  1115. data/archive/app/views/gaku/admin/disposals/students.html.slim +0 -16
  1116. data/archive/app/views/gaku/admin/disposals/tabs/_addresses_tabs.html.slim +0 -19
  1117. data/archive/app/views/gaku/admin/disposals/tabs/_contacts_tabs.html.slim +0 -19
  1118. data/archive/app/views/gaku/admin/disposals/teachers.html.slim +0 -16
  1119. data/archive/app/views/gaku/contacts/_delete_link.html.slim +0 -1
  1120. data/archive/app/views/gaku/shared/_delete_link.html.slim +0 -1
  1121. data/archive/app/views/gaku/shared/_delete_modal.html.slim +0 -11
  1122. data/archive/app/views/gaku/shared/menu/_archive.html.erb +0 -1
  1123. data/archive/config/initializers/paper_trail.rb +0 -3
  1124. data/archive/config/routes.rb +0 -67
  1125. data/archive/db/migrate/20131203160531_create_versioning_tables.rb +0 -47
  1126. data/archive/db/migrate/20131203160607_add_deleted_fields.rb +0 -53
  1127. data/archive/gaku_archive.gemspec +0 -28
  1128. data/archive/lib/gaku/archive.rb +0 -13
  1129. data/archive/lib/gaku/archive/engine.rb +0 -22
  1130. data/archive/lib/gaku_archive.rb +0 -1
  1131. data/archive/spec/controllers/gaku/addresses_controller_spec.rb +0 -144
  1132. data/archive/spec/controllers/gaku/admin/disposals_controller_spec.rb +0 -177
  1133. data/archive/spec/controllers/gaku/class_groups_controller_spec.rb +0 -86
  1134. data/archive/spec/controllers/gaku/contacts_controller_spec.rb +0 -133
  1135. data/archive/spec/controllers/gaku/course_groups_controller_spec.rb +0 -86
  1136. data/archive/spec/controllers/gaku/courses_controller_spec.rb +0 -86
  1137. data/archive/spec/controllers/gaku/exams_controller_spec.rb +0 -86
  1138. data/archive/spec/controllers/gaku/extracurricular_activities_controller_spec.rb +0 -85
  1139. data/archive/spec/controllers/gaku/students_controller_spec.rb +0 -72
  1140. data/archive/spec/controllers/gaku/syllabuses_controller_spec.rb +0 -86
  1141. data/archive/spec/controllers/gaku/teachers_controller_spec.rb +0 -86
  1142. data/archive/spec/features/admin/changes_and_deletions/student_addresses_spec.rb +0 -40
  1143. data/archive/spec/features/admin/changes_and_deletions/student_contacts_spec.rb +0 -28
  1144. data/archive/spec/features/admin/changes_and_deletions/students_spec.rb +0 -45
  1145. data/archive/spec/features/admin/disposals/student_disposals_spec.rb +0 -51
  1146. data/archive/spec/features/admin/disposals/teacher_disposals_spec.rb +0 -51
  1147. data/archive/spec/features/students/addresses_spec.rb +0 -29
  1148. data/archive/spec/features/students/contacts_spec.rb +0 -36
  1149. data/archive/spec/features/students/guardians/addresses_spec.rb +0 -32
  1150. data/archive/spec/features/students/guardians/contacts_spec.rb +0 -31
  1151. data/archive/spec/features/students/guardians/guardians_spec.rb +0 -33
  1152. data/archive/spec/features/students/students_spec.rb +0 -36
  1153. data/archive/spec/integration/student_address_versioning_spec.rb +0 -20
  1154. data/archive/spec/integration/student_contact_vesioning_spec.rb +0 -21
  1155. data/archive/spec/integration/student_versioning_spec.rb +0 -91
  1156. data/archive/spec/models/address_spec.rb +0 -64
  1157. data/archive/spec/models/attachment_spec.rb +0 -9
  1158. data/archive/spec/models/class_group_spec.rb +0 -9
  1159. data/archive/spec/models/contact_spec.rb +0 -9
  1160. data/archive/spec/models/course_group_spec.rb +0 -9
  1161. data/archive/spec/models/course_spec.rb +0 -9
  1162. data/archive/spec/models/exam_spec.rb +0 -11
  1163. data/archive/spec/models/extracurricular_activity_spec.rb +0 -9
  1164. data/archive/spec/models/guardian_spec.rb +0 -9
  1165. data/archive/spec/models/student_spec.rb +0 -13
  1166. data/archive/spec/models/syllabus_spec.rb +0 -9
  1167. data/archive/spec/models/teacher_spec.rb +0 -9
  1168. data/archive/spec/routing/student_routes_spec.rb +0 -26
  1169. data/archive/spec/routing/students/guardians_routes_spec.rb +0 -37
  1170. data/archive/spec/spec_helper.rb +0 -5
  1171. data/archive/spec/spec_helper_base.rb +0 -20
  1172. data/archive/spec/spec_helper_controllers.rb +0 -4
  1173. data/archive/spec/spec_helper_models.rb +0 -38
  1174. data/archive/spec/spec_helper_routing.rb +0 -4
  1175. data/archive/spec/support/controllers.rb +0 -3
  1176. data/archive/spec/support/controllers/matchers/have_attributes_matcher.rb +0 -8
  1177. data/archive/spec/support/controllers/shared_examples/allow.rb +0 -10
  1178. data/archive/spec/support/controllers/shared_examples/deny.rb +0 -27
  1179. data/archive/spec/support/features.rb +0 -5
  1180. data/archive/spec/support/features/shared_examples/addresses_spec.rb +0 -22
  1181. data/archive/spec/support/features/shared_examples/contacts_spec.rb +0 -26
  1182. data/archive/spec/support/models/shared_examples/thrashable.rb +0 -6
  1183. data/core/.ruby-gemset +0 -1
  1184. data/core/.ruby-version +0 -1
  1185. data/core/app/models/gaku/class_group_course_enrollment.rb +0 -17
  1186. data/core/app/models/gaku/class_group_enrollment.rb +0 -31
  1187. data/core/app/models/gaku/course_enrollment.rb +0 -23
  1188. data/core/app/models/gaku/disposal.rb +0 -45
  1189. data/core/app/models/gaku/extracurricular_activity_enrollment.rb +0 -15
  1190. data/core/app/models/gaku/semester_class_group.rb +0 -21
  1191. data/core/app/models/gaku/semester_course.rb +0 -21
  1192. data/core/lib/gaku/grading/calculations.rb +0 -279
  1193. data/core/lib/gaku/grading/grade.rb +0 -17
  1194. data/core/lib/gaku/grading/japanese_hs_standard.rb +0 -8
  1195. data/core/lib/gaku/testing/factories/class_group_course_enrollment_factory.rb +0 -8
  1196. data/core/lib/gaku/testing/factories/class_group_enrollment_factory.rb +0 -9
  1197. data/core/lib/gaku/testing/factories/semester_class_group_factory.rb +0 -8
  1198. data/core/lib/gaku/testing/factories/semester_course.rb +0 -8
  1199. data/core/spec/models/class_group_course_enrollment_spec.rb +0 -16
  1200. data/core/spec/models/class_group_enrollment_spec.rb +0 -24
  1201. data/core/spec/models/course_enrollment_spec.rb +0 -16
  1202. data/core/spec/models/extracurricular_activity_enrollment_spec.rb +0 -18
  1203. data/core/spec/models/semester_class_group_spec.rb +0 -17
  1204. data/core/spec/models/semester_course_spec.rb +0 -17
  1205. data/core_dependencies.rb +0 -12
  1206. data/frontend/.ruby-gemset +0 -1
  1207. data/frontend/.ruby-version +0 -1
  1208. data/frontend/app/controllers/concerns/enrollments_controller.rb +0 -83
  1209. data/frontend/app/controllers/gaku/class_group_enrollments_controller.rb +0 -15
  1210. data/frontend/app/controllers/gaku/class_groups/courses_controller.rb +0 -50
  1211. data/frontend/app/controllers/gaku/class_groups/semester_class_groups_controller.rb +0 -63
  1212. data/frontend/app/controllers/gaku/class_groups/students_controller.rb +0 -37
  1213. data/frontend/app/controllers/gaku/course_enrollments_controller.rb +0 -10
  1214. data/frontend/app/controllers/gaku/courses/enrollments_controller.rb +0 -55
  1215. data/frontend/app/controllers/gaku/courses/semester_courses_controller.rb +0 -64
  1216. data/frontend/app/controllers/gaku/exams/exam_portions/attachments_controller.rb +0 -46
  1217. data/frontend/app/controllers/gaku/extracurricular_activities/students_controller.rb +0 -21
  1218. data/frontend/app/controllers/gaku/extracurricular_activity_enrollments_controller.rb +0 -16
  1219. data/frontend/app/controllers/gaku/students/guardians_controller.rb +0 -70
  1220. data/frontend/app/views/gaku/class_groups/_student_chooser_form.html.slim +0 -4
  1221. data/frontend/app/views/gaku/class_groups/_tabs.html.slim +0 -41
  1222. data/frontend/app/views/gaku/class_groups/courses/_course.html.slim +0 -4
  1223. data/frontend/app/views/gaku/class_groups/courses/_courses.html.slim +0 -14
  1224. data/frontend/app/views/gaku/class_groups/courses/_form.html.slim +0 -5
  1225. data/frontend/app/views/gaku/class_groups/courses/create.js.erb +0 -7
  1226. data/frontend/app/views/gaku/class_groups/courses/destroy.js.erb +0 -2
  1227. data/frontend/app/views/gaku/class_groups/courses/new.js.erb +0 -3
  1228. data/frontend/app/views/gaku/class_groups/semester_class_groups/_fields.html.slim +0 -4
  1229. data/frontend/app/views/gaku/class_groups/semester_class_groups/_form.html.slim +0 -4
  1230. data/frontend/app/views/gaku/class_groups/semester_class_groups/_form_fields.html.slim +0 -3
  1231. data/frontend/app/views/gaku/class_groups/semester_class_groups/_modal.html.slim +0 -5
  1232. data/frontend/app/views/gaku/class_groups/semester_class_groups/_semester.html.slim +0 -3
  1233. data/frontend/app/views/gaku/class_groups/semester_class_groups/_semester_modal.html.slim +0 -4
  1234. data/frontend/app/views/gaku/class_groups/semester_class_groups/_semesters.html.slim +0 -13
  1235. data/frontend/app/views/gaku/class_groups/semester_class_groups/create.js.erb +0 -8
  1236. data/frontend/app/views/gaku/class_groups/semester_class_groups/destroy.js.erb +0 -2
  1237. data/frontend/app/views/gaku/class_groups/semester_class_groups/edit.js.erb +0 -3
  1238. data/frontend/app/views/gaku/class_groups/semester_class_groups/new.js.erb +0 -3
  1239. data/frontend/app/views/gaku/class_groups/semester_class_groups/update.js.erb +0 -3
  1240. data/frontend/app/views/gaku/class_groups/student_chooser.js.erb +0 -9
  1241. data/frontend/app/views/gaku/class_groups/students/_student.html.slim +0 -5
  1242. data/frontend/app/views/gaku/class_groups/students/_students.html.slim +0 -14
  1243. data/frontend/app/views/gaku/class_groups/students/destroy.js.erb +0 -2
  1244. data/frontend/app/views/gaku/class_groups/students/enroll_students.js.erb +0 -16
  1245. data/frontend/app/views/gaku/class_groups/students/new.js.erb +0 -3
  1246. data/frontend/app/views/gaku/class_groups/students/without_semester.js.erb +0 -2
  1247. data/frontend/app/views/gaku/courses/_student_chooser_form.html.slim +0 -4
  1248. data/frontend/app/views/gaku/courses/_tabs.html.slim +0 -26
  1249. data/frontend/app/views/gaku/courses/enrollments/_enrolled.html.slim +0 -7
  1250. data/frontend/app/views/gaku/courses/enrollments/_enrollments.html.slim +0 -27
  1251. data/frontend/app/views/gaku/courses/enrollments/_errors_modal.html.slim +0 -11
  1252. data/frontend/app/views/gaku/courses/enrollments/class_groups/_form.html.slim +0 -3
  1253. data/frontend/app/views/gaku/courses/enrollments/class_groups/enroll.js.erb +0 -16
  1254. data/frontend/app/views/gaku/courses/enrollments/class_groups/new.js.erb +0 -4
  1255. data/frontend/app/views/gaku/courses/enrollments/error.js.erb +0 -2
  1256. data/frontend/app/views/gaku/courses/enrollments/students/enroll_students.js.erb +0 -11
  1257. data/frontend/app/views/gaku/courses/semester_courses/_fields.html.slim +0 -4
  1258. data/frontend/app/views/gaku/courses/semester_courses/_form.html.slim +0 -4
  1259. data/frontend/app/views/gaku/courses/semester_courses/_form_fields.html.slim +0 -3
  1260. data/frontend/app/views/gaku/courses/semester_courses/_modal.html.slim +0 -4
  1261. data/frontend/app/views/gaku/courses/semester_courses/_semester_course.html.slim +0 -3
  1262. data/frontend/app/views/gaku/courses/semester_courses/_semester_courses.html.slim +0 -16
  1263. data/frontend/app/views/gaku/courses/semester_courses/create.js.erb +0 -6
  1264. data/frontend/app/views/gaku/courses/semester_courses/destroy.js.erb +0 -3
  1265. data/frontend/app/views/gaku/courses/semester_courses/edit.js.erb +0 -3
  1266. data/frontend/app/views/gaku/courses/semester_courses/new.js.erb +0 -3
  1267. data/frontend/app/views/gaku/courses/semester_courses/update.js.erb +0 -3
  1268. data/frontend/app/views/gaku/courses/student_chooser.js.erb +0 -7
  1269. data/frontend/app/views/gaku/exams/exam_portions/attachments/_attachment.html.slim +0 -2
  1270. data/frontend/app/views/gaku/exams/exam_portions/attachments/_attachments.html.slim +0 -20
  1271. data/frontend/app/views/gaku/exams/exam_portions/attachments/_form.html.slim +0 -3
  1272. data/frontend/app/views/gaku/exams/exam_portions/attachments/_modal.html.slim +0 -4
  1273. data/frontend/app/views/gaku/exams/exam_portions/attachments/new.js.erb +0 -3
  1274. data/frontend/app/views/gaku/extracurricular_activities/_student_chooser_form.html.slim +0 -4
  1275. data/frontend/app/views/gaku/extracurricular_activities/_tabs.html.slim +0 -15
  1276. data/frontend/app/views/gaku/extracurricular_activities/student_chooser.js.erb +0 -9
  1277. data/frontend/app/views/gaku/extracurricular_activities/students/_student.html.slim +0 -5
  1278. data/frontend/app/views/gaku/extracurricular_activities/students/_students.html.slim +0 -16
  1279. data/frontend/app/views/gaku/extracurricular_activities/students/destroy.js.erb +0 -3
  1280. data/frontend/app/views/gaku/extracurricular_activities/students/enroll_students.js.erb +0 -11
  1281. data/frontend/app/views/gaku/shared/_external_school_record.html.slim +0 -36
  1282. data/frontend/app/views/gaku/shared/_picture.html.slim +0 -8
  1283. data/frontend/app/views/gaku/shared/_upload_picture.html.slim +0 -7
  1284. data/frontend/app/views/gaku/shared/student/_show.html.slim +0 -12
  1285. data/frontend/app/views/gaku/students/_academic.html.slim +0 -18
  1286. data/frontend/app/views/gaku/students/_personal.html.slim +0 -3
  1287. data/frontend/app/views/gaku/students/_student_chooser_form.html.slim +0 -16
  1288. data/frontend/app/views/gaku/students/_tabs.html.slim +0 -48
  1289. data/frontend/app/views/gaku/students/_tabs_academic.html.slim +0 -40
  1290. data/frontend/app/views/gaku/students/_tabs_personal.html.slim +0 -27
  1291. data/frontend/app/views/gaku/students/badges/_badge_type.html.slim +0 -5
  1292. data/frontend/app/views/gaku/students/badges/_badges_tab.html.slim +0 -8
  1293. data/frontend/app/views/gaku/students/badges/_index.html.slim +0 -20
  1294. data/frontend/app/views/gaku/students/badges/_index_modal.html.slim +0 -4
  1295. data/frontend/app/views/gaku/students/class_group_enrollments/_new_modal.html.slim +0 -28
  1296. data/frontend/app/views/gaku/students/course_enrollments/_errors_modal.html.slim +0 -11
  1297. data/frontend/app/views/gaku/students/course_enrollments/error.js.erb +0 -2
  1298. data/frontend/app/views/gaku/students/guardians/_delete_modal.html.slim +0 -12
  1299. data/frontend/app/views/gaku/students/guardians/_form.html.slim +0 -3
  1300. data/frontend/app/views/gaku/students/guardians/_guardian.html.slim +0 -12
  1301. data/frontend/app/views/gaku/students/guardians/_guardians.html.slim +0 -24
  1302. data/frontend/app/views/gaku/students/guardians/_picture.html.slim +0 -8
  1303. data/frontend/app/views/gaku/students/guardians/_tabs.html.slim +0 -14
  1304. data/frontend/app/views/gaku/students/guardians/_upload_picture.html.slim +0 -7
  1305. data/frontend/app/views/gaku/students/guardians/create.js.erb +0 -7
  1306. data/frontend/app/views/gaku/students/guardians/destroy.js.erb +0 -1
  1307. data/frontend/app/views/gaku/students/guardians/edit.html.slim +0 -21
  1308. data/frontend/app/views/gaku/students/guardians/recovery.js.erb +0 -1
  1309. data/frontend/app/views/gaku/students/guardians/show.html.slim +0 -17
  1310. data/frontend/app/views/gaku/students/show.html.slim +0 -24
  1311. data/frontend/app/views/gaku/students/simple_grades/_index.html.slim +0 -21
  1312. data/frontend/app/views/gaku/students/simple_grades/_index_modal.html.slim +0 -4
  1313. data/frontend/app/views/gaku/students/student_specialties/_index.html.slim +0 -18
  1314. data/frontend/app/views/gaku/students/student_specialties/_index_modal.html.slim +0 -4
  1315. data/frontend/app/views/gaku/syllabuses/_all_exams.html.slim +0 -14
  1316. data/frontend/app/views/gaku/syllabuses/_tabs.html.slim +0 -16
  1317. data/frontend/app/views/gaku/syllabuses/exams/_select_form.html.slim +0 -6
  1318. data/frontend/app/views/gaku/teachers/_tabs.html.slim +0 -20
  1319. data/frontend/config/initializers/client_side_validations.rb +0 -9
  1320. data/frontend/spec/controllers/gaku/class_group_enrollments_controller_spec.rb +0 -62
  1321. data/frontend/spec/controllers/gaku/class_groups/courses_controller_spec.rb +0 -90
  1322. data/frontend/spec/controllers/gaku/class_groups/semesters_controller_spec.rb +0 -90
  1323. data/frontend/spec/controllers/gaku/students/course_enrollments_controller_spec.rb +0 -121
  1324. data/frontend/spec/controllers/gaku/students/guardians_controller_spec.rb +0 -115
  1325. data/frontend/spec/features/class_groups/class_groups_spec.rb +0 -96
  1326. data/frontend/spec/features/class_groups/courses_spec.rb +0 -39
  1327. data/frontend/spec/features/class_groups/notes_spec.rb +0 -32
  1328. data/frontend/spec/features/class_groups/semester_class_groups_spec.rb +0 -96
  1329. data/frontend/spec/features/class_groups/students_spec.rb +0 -90
  1330. data/frontend/spec/features/course_groups/course_groups_spec.rb +0 -76
  1331. data/frontend/spec/features/course_groups/courses_spec.rb +0 -37
  1332. data/frontend/spec/features/courses/courses_spec.rb +0 -108
  1333. data/frontend/spec/features/courses/enrollments/class_groups_spec.rb +0 -81
  1334. data/frontend/spec/features/courses/enrollments/students_spec.rb +0 -75
  1335. data/frontend/spec/features/courses/exams_spec.rb +0 -36
  1336. data/frontend/spec/features/courses/notes_spec.rb +0 -32
  1337. data/frontend/spec/features/courses/semester_courses_spec.rb +0 -108
  1338. data/frontend/spec/features/exams/exam_portions/attachments_spec.rb +0 -101
  1339. data/frontend/spec/features/exams/exam_portions/exam_portions_spec.rb +0 -81
  1340. data/frontend/spec/features/exams/exams_spec.rb +0 -101
  1341. data/frontend/spec/features/exams/notes_spec.rb +0 -32
  1342. data/frontend/spec/features/extracurricular_activities/extracurricular_activities_spec.rb +0 -67
  1343. data/frontend/spec/features/extracurricular_activities/students_spec.rb +0 -164
  1344. data/frontend/spec/features/sign_up_spec.rb +0 -71
  1345. data/frontend/spec/features/syllabuses/exams_spec.rb +0 -161
  1346. data/frontend/spec/features/syllabuses/notes_spec.rb +0 -32
  1347. data/frontend/spec/features/teachers/addresses_spec.rb +0 -60
  1348. data/frontend/spec/features/teachers/contacts_spec.rb +0 -56
  1349. data/frontend/spec/features/teachers/notes_spec.rb +0 -34
  1350. data/frontend/spec/features/teachers/picture_spec.rb +0 -22
  1351. data/frontend/spec/features/teachers/teachers_spec.rb +0 -82
  1352. data/frontend/spec/routing/class_groups/courses_routing_spec.rb +0 -40
  1353. data/frontend/spec/routing/class_groups/students_routing_spec.rb +0 -40
  1354. data/frontend/spec/routing/students/course_enrollments_routes_spec.rb +0 -36
  1355. data/frontend/spec/routing/students/guardians_routes_spec.rb +0 -55
  1356. data/sample/db/sample/gaku/01-syllabuses.rb +0 -130
  1357. data/sample/db/sample/gaku/02-courses.rb +0 -13
@@ -15,7 +15,6 @@ module Gaku
15
15
  user ||= User.new
16
16
 
17
17
  can :manage, :all if user.role? :admin
18
-
19
18
  end
20
19
  end
21
20
  end
@@ -1,6 +1,5 @@
1
1
  module Gaku
2
2
  class Assignment < ActiveRecord::Base
3
-
4
3
  belongs_to :syllabus
5
4
  belongs_to :grading_method
6
5
 
@@ -10,6 +9,5 @@ module Gaku
10
9
  def to_s
11
10
  name
12
11
  end
13
-
14
12
  end
15
13
  end
@@ -8,6 +8,5 @@ module Gaku
8
8
  def to_s
9
9
  score
10
10
  end
11
-
12
11
  end
13
12
  end
@@ -1,12 +1,10 @@
1
1
  module Gaku
2
2
  class Attachment < ActiveRecord::Base
3
-
4
3
  belongs_to :attachable, polymorphic: true
5
4
 
6
5
  has_attached_file :asset
7
6
 
8
- validates_associated :attachable,
9
- message: I18n.t(:'attachment.associated')
7
+ validates_associated :attachable, message: I18n.t(:'attachment.associated')
10
8
 
11
9
  validates :name, presence: true
12
10
  validates :asset, presence: true, on: :create
@@ -14,6 +12,5 @@ module Gaku
14
12
  def to_s
15
13
  name
16
14
  end
17
-
18
15
  end
19
16
  end
@@ -1,6 +1,5 @@
1
1
  module Gaku
2
2
  class Attendance < ActiveRecord::Base
3
-
4
3
  belongs_to :attendancable, polymorphic: true
5
4
  belongs_to :student
6
5
  belongs_to :attendance_type
@@ -11,6 +10,5 @@ module Gaku
11
10
  def to_s
12
11
  reason
13
12
  end
14
-
15
13
  end
16
14
  end
@@ -1,6 +1,5 @@
1
1
  module Gaku
2
2
  class AttendanceType < ActiveRecord::Base
3
-
4
3
  has_many :attendances
5
4
 
6
5
  translates :name
@@ -10,6 +9,5 @@ module Gaku
10
9
  def to_s
11
10
  name
12
11
  end
13
-
14
12
  end
15
13
  end
@@ -1,10 +1,8 @@
1
1
  module Gaku
2
2
  class Badge < ActiveRecord::Base
3
-
4
3
  belongs_to :student, counter_cache: :badges_count
5
4
  belongs_to :badge_type
6
5
 
7
6
  validates :badge_type_id, :student_id, presence: true
8
-
9
7
  end
10
8
  end
@@ -10,6 +10,5 @@ module Gaku
10
10
  def to_s
11
11
  name
12
12
  end
13
-
14
13
  end
15
14
  end
@@ -1,23 +1,23 @@
1
1
  module Gaku
2
2
  class ClassGroup < ActiveRecord::Base
3
3
 
4
- include Notes, Pagination
4
+ include Notes, Pagination, Enrollmentable, Semesterable, StudentReviewable
5
5
 
6
- has_many :enrollments, class_name: 'Gaku::ClassGroupEnrollment'
7
- has_many :students, through: :enrollments
8
-
9
- has_many :class_group_course_enrollments, dependent: :destroy
10
- has_many :courses, through: :class_group_course_enrollments
6
+ validates :name, presence: true
11
7
 
12
- has_many :semester_class_groups, dependent: :destroy
13
- has_many :semesters, through: :semester_class_groups
8
+ def self.for_select
9
+ %w(active upcomming).map do |state|
10
+ [state.humanize, send(state).map { |cg| [cg.to_s, cg.id] }]
11
+ end
12
+ end
14
13
 
15
- validates :name, presence: true
14
+ def self.active
15
+ @active = joins(:semesters).merge(Gaku::Semester.active).uniq
16
+ end
16
17
 
17
- scope :without_semester, -> {
18
- includes(:semester_class_groups)
19
- .where(gaku_semester_class_groups: {class_group_id: nil})
20
- }
18
+ def self.upcomming
19
+ @upcomming = joins(:semesters).merge(Gaku::Semester.upcomming).uniq - active
20
+ end
21
21
 
22
22
  def to_s
23
23
  "#{grade} - #{name}"
@@ -1,6 +1,5 @@
1
1
  module Gaku
2
2
  class CommuteMethodType < ActiveRecord::Base
3
-
4
3
  has_many :students
5
4
 
6
5
  validates :name, presence: true, uniqueness: true
@@ -10,6 +9,5 @@ module Gaku
10
9
  def to_s
11
10
  name
12
11
  end
13
-
14
12
  end
15
13
  end
@@ -1,15 +1,10 @@
1
1
  module Gaku
2
2
  class Contact < ActiveRecord::Base
3
-
4
3
  belongs_to :contact_type
5
4
  belongs_to :contactable, polymorphic: true, counter_cache: true
6
5
 
7
6
  validates :data, :contact_type, presence: true
8
7
 
9
- before_save :ensure_first_is_primary, on: :create
10
- before_save :remove_other_primary
11
- after_save :update_primary_contact_field
12
-
13
8
  delegate :name, to: :contact_type, allow_nil: true
14
9
 
15
10
  def to_s
@@ -33,12 +28,12 @@ module Gaku
33
28
  end
34
29
 
35
30
  def make_primary
36
- contacts.where.not(id: id).update_all(primary: false)
31
+ contactable.contacts.where.not(id: id).update_all(primary: false)
37
32
  update_attribute(:primary, true)
38
33
 
39
- if contactable.has_attribute?(:primary_contact)
40
- contactable.update_attribute(:primary_contact, contact_widget)
41
- end
34
+ # if contactable.has_attribute?(:primary_contact)
35
+ # contactable.update_attribute(:primary_contact, contactable.contact_widget)
36
+ # end
42
37
  end
43
38
 
44
39
  def primary?
@@ -56,37 +51,12 @@ module Gaku
56
51
  private
57
52
 
58
53
  def increment_count
59
- contactable.class.increment_counter(:addresses_count, contactable.id)
54
+ contactable.class.increment_counter(:contacts_count, contactable.id)
60
55
  end
61
56
 
62
57
  def decrement_count
63
- contactable.class.decrement_counter(:addresses_count, contactable.id)
64
- end
65
-
66
- def remove_other_primary
67
- contacts.where.not(id: id).update_all(primary: false) if primary?
68
- end
69
-
70
- def ensure_first_is_primary
71
- if contactable.respond_to? :contacts
72
- self.primary = true if contacts.blank?
73
- end
74
- end
75
-
76
- def contact_widget
77
- contactable.contact_widget
78
- end
79
-
80
- def update_primary_contact_field
81
- if contactable.has_attribute? :primary_contact
82
- contactable.update_attribute(:primary_contact, contactable.contact_widget)
83
- end
84
- end
85
-
86
- def contacts
87
- contactable.contacts
58
+ contactable.class.decrement_counter(:contacts_count, contactable.id)
88
59
  end
89
60
 
90
61
  end
91
62
  end
92
-
@@ -1,6 +1,5 @@
1
1
  module Gaku
2
2
  class ContactType < ActiveRecord::Base
3
-
4
3
  has_many :contacts
5
4
 
6
5
  validates :name, presence: true, uniqueness: true
@@ -8,6 +7,5 @@ module Gaku
8
7
  def to_s
9
8
  name
10
9
  end
11
-
12
10
  end
13
11
  end
@@ -1,11 +1,9 @@
1
1
  module Gaku
2
2
  class Country < ActiveRecord::Base
3
-
4
3
  has_many :states, -> { order name: :asc },
5
4
  foreign_key: :country_iso,
6
5
  primary_key: :iso
7
6
 
8
-
9
7
  default_scope -> { order('name ASC') }
10
8
 
11
9
  validates :name, :iso_name, :iso, presence: true
@@ -18,6 +16,5 @@ module Gaku
18
16
  def to_s
19
17
  name
20
18
  end
21
-
22
19
  end
23
20
  end
@@ -1,23 +1,11 @@
1
1
  module Gaku
2
2
  class Course < ActiveRecord::Base
3
3
 
4
- include Notes
5
-
6
- has_many :enrollments,
7
- class_name: 'Gaku::CourseEnrollment',
8
- dependent: :destroy
9
-
10
- has_many :students, through: :enrollments
4
+ include Notes, Gradable, Enrollmentable, Semesterable
11
5
 
12
6
  has_many :course_group_enrollments
13
7
  has_many :course_groups, through: :course_group_enrollments
14
8
 
15
- has_many :class_groups, through: :class_group_course_enrollments
16
- has_many :class_group_course_enrollments, dependent: :destroy
17
-
18
- has_many :semester_courses, dependent: :destroy
19
- has_many :semesters, through: :semester_courses
20
-
21
9
  has_many :exam_schedules
22
10
 
23
11
  belongs_to :syllabus
@@ -25,12 +13,10 @@ module Gaku
25
13
 
26
14
  delegate :name, :code, to: :syllabus, prefix: true, allow_nil: true
27
15
 
28
- accepts_nested_attributes_for :enrollments
16
+ # accepts_nested_attributes_for :enrollments
29
17
 
30
18
  validates :code, presence: true
31
19
 
32
- scope :without_semester, -> { includes(:semester_courses).where(gaku_semester_courses: { course_id: nil }) }
33
-
34
20
  def to_s
35
21
  if syllabus_name
36
22
  "#{syllabus_name}-#{code}"
@@ -43,15 +29,15 @@ module Gaku
43
29
  [to_s, id]
44
30
  end
45
31
 
46
- def enroll_class_group(class_group)
47
- unless class_group.blank?
48
- ActiveRecord::Base.transaction do
49
- class_group.student_ids.each do |student_id|
50
- CourseEnrollment.find_or_create_by(student_id: student_id, course_id: id)
51
- end
52
- end
53
- end
54
- end
32
+ # def enroll_class_group(class_group)
33
+ # unless class_group.blank?
34
+ # ActiveRecord::Base.transaction do
35
+ # class_group.student_ids.each do |student_id|
36
+ # CourseEnrollment.find_or_create_by(student_id: student_id, course_id: id)
37
+ # end
38
+ # end
39
+ # end
40
+ # end
55
41
 
56
42
  end
57
43
  end
@@ -1,6 +1,5 @@
1
1
  module Gaku
2
2
  class CourseGroup < ActiveRecord::Base
3
-
4
3
  has_many :course_group_enrollments
5
4
  has_many :courses, through: :course_group_enrollments
6
5
 
@@ -9,6 +8,5 @@ module Gaku
9
8
  def to_s
10
9
  name
11
10
  end
12
-
13
11
  end
14
12
  end
@@ -8,9 +8,8 @@ module Gaku
8
8
  validates :course_id,
9
9
  presence: true,
10
10
  uniqueness: {
11
- scope: :course_group_id,
12
- message: I18n.t(:'course_group.already_enrolled')
13
- }
14
-
11
+ scope: :course_group_id,
12
+ message: I18n.t(:'course_group.already_enrolled')
13
+ }
15
14
  end
16
15
  end
@@ -1,6 +1,5 @@
1
1
  module Gaku
2
2
  class Department < ActiveRecord::Base
3
-
4
3
  has_many :specialties
5
4
  has_many :syllabuses
6
5
  has_many :exams
@@ -12,6 +11,5 @@ module Gaku
12
11
  def to_s
13
12
  name
14
13
  end
15
-
16
14
  end
17
15
  end
@@ -0,0 +1,85 @@
1
+ module Gaku
2
+ class Enrollment < ActiveRecord::Base
3
+
4
+ belongs_to :student
5
+ belongs_to :enrollmentable, polymorphic: true, counter_cache: true
6
+
7
+ validates :enrollmentable_type, :enrollmentable_id, :student_id, presence: true
8
+
9
+ validates :student_id,
10
+ uniqueness: {
11
+ scope: %w( enrollmentable_type enrollmentable_id ),
12
+ message: I18n.t(:'student.already_enrolled')
13
+ }
14
+
15
+ validates :enrollmentable_type,
16
+ inclusion: {
17
+ in: %w( Gaku::Course Gaku::ClassGroup Gaku::ExtracurricularActivity ),
18
+ message: '%{value} is not a valid'
19
+ }
20
+
21
+ validate :class_group_semesters_overlap, if: ->(record) { record.class_group_type? }
22
+
23
+ before_create :increment_enrollmentable_counter
24
+ before_destroy :decrement_enrollmentable_counter
25
+
26
+ before_create :proper_position, if: ->(record) { record.class_group_type? }
27
+ after_destroy :refresh_positions, if: ->(record) { record.class_group_type? }
28
+
29
+ scope :seat_numbered, -> { order('seat_number ASC') }
30
+
31
+ def class_group_type?
32
+ enrollmentable_type == 'Gaku::ClassGroup'
33
+ end
34
+
35
+ private
36
+
37
+ def class_group_semesters_overlap
38
+ if overlap_semester? && not_in_student_class_groups?
39
+ errors.add(:base, I18n.t('enrollment.class_group_overlapping'))
40
+ end
41
+ end
42
+
43
+ def overlap_semester?
44
+ if student && student.semesters && enrollmentable
45
+ student.semesters.where(id: enrollmentable.semester_ids).any?
46
+ end
47
+ end
48
+
49
+ def not_in_student_class_groups?
50
+ student.class_groups.exclude?(enrollmentable)
51
+ end
52
+
53
+ def increment_enrollmentable_counter
54
+ Student.increment_counter(resource_name_counter, student.id) if student
55
+ end
56
+
57
+ def decrement_enrollmentable_counter
58
+ Student.decrement_counter(resource_name_counter, student.id) if student
59
+ end
60
+
61
+ def resource_name_counter
62
+ enrollmentable_type.demodulize.underscore.pluralize.concat('_count') if enrollmentable_type
63
+ end
64
+
65
+ def proper_position
66
+ self.seat_number = enrollmentable.enrollments_count.next
67
+ end
68
+
69
+ def refresh_positions
70
+ enrollments = enrollmentable.enrollments
71
+ enrollments.pluck(:id).each_with_index do |id, index|
72
+ enrollments.where(id: id).update_all(seat_number: index.next)
73
+ end
74
+ end
75
+
76
+ def class_group_is_active?
77
+ Gaku::ClassGroup.active.include?(enrollmentable)
78
+ end
79
+
80
+ def not_in_student_class_groups?
81
+ student.class_groups.exclude?(enrollmentable)
82
+ end
83
+
84
+ end
85
+ end