gaku_admin 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (233) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/gaku/admin/admin.coffee +6 -6
  3. data/app/assets/javascripts/gaku/admin/base.js.coffee +11 -2
  4. data/app/assets/javascripts/gaku/admin.js.coffee +6 -0
  5. data/app/assets/stylesheets/gaku/admin/bootstrap_and_theme.css.scss +16 -1
  6. data/app/assets/stylesheets/gaku/admin.css +0 -1
  7. data/app/controllers/concerns/admin_picture_controller.rb +28 -0
  8. data/app/controllers/gaku/admin/attendance_types_controller.rb +8 -8
  9. data/app/controllers/gaku/admin/badge_types_controller.rb +9 -16
  10. data/app/controllers/gaku/admin/base_controller.rb +1 -1
  11. data/app/controllers/gaku/admin/{schools/campuses → campuses}/addresses_controller.rb +3 -9
  12. data/app/controllers/gaku/admin/{schools/campuses → campuses}/contacts_controller.rb +6 -10
  13. data/app/controllers/gaku/admin/{schools/campuses_controller.rb → campuses_controller.rb} +7 -11
  14. data/app/controllers/gaku/admin/commute_method_types_controller.rb +8 -7
  15. data/app/controllers/gaku/admin/contact_types_controller.rb +7 -7
  16. data/app/controllers/gaku/admin/departments_controller.rb +7 -7
  17. data/app/controllers/gaku/admin/enrollment_statuses_controller.rb +9 -8
  18. data/app/controllers/gaku/admin/grading_method_sets/grading_method_set_items_controller.rb +1 -1
  19. data/app/controllers/gaku/admin/grading_method_sets_controller.rb +11 -11
  20. data/app/controllers/gaku/admin/grading_methods_controller.rb +10 -9
  21. data/app/controllers/gaku/admin/home_controller.rb +11 -0
  22. data/app/controllers/gaku/admin/presets_controller.rb +4 -6
  23. data/app/controllers/gaku/admin/roles_controller.rb +8 -7
  24. data/app/controllers/gaku/admin/school_years/semesters_controller.rb +0 -1
  25. data/app/controllers/gaku/admin/school_years_controller.rb +3 -7
  26. data/app/controllers/gaku/admin/schools/programs_controller.rb +11 -4
  27. data/app/controllers/gaku/admin/schools_controller.rb +82 -79
  28. data/app/controllers/gaku/admin/{achievements/simple_grade_types_controller.rb → simple_grade_types_controller.rb} +4 -3
  29. data/app/controllers/gaku/admin/specialties_controller.rb +2 -5
  30. data/app/controllers/gaku/admin/states_controller.rb +71 -71
  31. data/app/controllers/gaku/admin/student_review_categories_controller.rb +57 -0
  32. data/app/controllers/gaku/admin/templates_controller.rb +47 -50
  33. data/app/controllers/gaku/admin/users_controller.rb +5 -7
  34. data/app/controllers/gaku/states_controller.rb +2 -0
  35. data/app/helpers/gaku/admin_helper.rb +16 -1
  36. data/app/helpers/gaku/shared_helper.rb +2 -2
  37. data/app/overrides/admin_menu.rb +7 -6
  38. data/app/views/gaku/admin/attendance_types/{index.html.slim → _attendance_types.html.slim} +9 -8
  39. data/app/views/gaku/admin/attendance_types/index.js.erb +1 -0
  40. data/app/views/gaku/admin/attendance_types/index.json.rb +1 -1
  41. data/app/views/gaku/admin/badge_types/{index.html.slim → _badge_types.html.slim} +9 -8
  42. data/app/views/gaku/admin/badge_types/_form.html.slim +1 -1
  43. data/app/views/gaku/admin/badge_types/_modal.html.slim +1 -1
  44. data/app/views/gaku/admin/badge_types/create.js.erb +7 -0
  45. data/app/views/gaku/admin/badge_types/index.js.erb +1 -0
  46. data/app/views/gaku/admin/badge_types/new.js.erb +1 -1
  47. data/app/views/gaku/admin/badge_types/update.js.erb +3 -0
  48. data/app/views/gaku/admin/campuses/_campus.html.slim +4 -0
  49. data/app/views/gaku/admin/{schools/campuses → campuses}/_campuses.html.slim +4 -6
  50. data/app/views/gaku/admin/campuses/_edit_form.html.slim +3 -0
  51. data/app/views/gaku/admin/campuses/addresses/_address.html.slim +6 -0
  52. data/app/views/gaku/admin/{schools/campuses → campuses}/addresses/_address_row_fields.html.slim +1 -1
  53. data/app/views/gaku/admin/{schools/campuses → campuses}/addresses/_addresses.html.slim +3 -4
  54. data/app/views/gaku/admin/campuses/addresses/index.js.erb +1 -0
  55. data/app/views/gaku/admin/{schools/campuses → campuses}/addresses/update.js.erb +1 -1
  56. data/app/views/gaku/admin/campuses/contacts/_contact.html.slim +3 -0
  57. data/app/views/gaku/admin/{schools/campuses → campuses}/contacts/_contacts.html.slim +4 -4
  58. data/app/views/gaku/admin/campuses/contacts/_fields.html.slim +11 -0
  59. data/app/views/gaku/admin/campuses/contacts/_primary_field.html.slim +6 -0
  60. data/app/views/gaku/admin/{schools/campuses → campuses}/contacts/create.js.erb +1 -1
  61. data/app/views/gaku/admin/{schools/campuses → campuses}/contacts/destroy.js.erb +1 -1
  62. data/app/views/gaku/admin/{schools/campuses → campuses}/contacts/edit.js.erb +1 -1
  63. data/app/views/gaku/admin/campuses/contacts/index.js.erb +1 -0
  64. data/app/views/gaku/admin/campuses/edit.html.slim +34 -0
  65. data/app/views/gaku/admin/campuses/edit.js.erb +1 -0
  66. data/app/views/gaku/admin/campuses/index.js.erb +1 -0
  67. data/app/views/gaku/admin/campuses/update.js.erb +2 -0
  68. data/app/views/gaku/admin/commute_method_types/_commute_method_types.html.slim +18 -0
  69. data/app/views/gaku/admin/commute_method_types/index.js.erb +1 -0
  70. data/app/views/gaku/admin/contact_types/_contact_types.html.slim +18 -0
  71. data/app/views/gaku/admin/contact_types/index.js.erb +1 -0
  72. data/app/views/gaku/admin/departments/_departments.html.slim +21 -0
  73. data/app/views/gaku/admin/departments/index.js.erb +1 -0
  74. data/app/views/gaku/admin/enrollment_statuses/{index.html.slim → _enrollment_statuses.html.slim} +9 -10
  75. data/app/views/gaku/admin/enrollment_statuses/index.js.erb +1 -0
  76. data/app/views/gaku/admin/grading_method_sets/_fields.html.slim +1 -1
  77. data/app/views/gaku/admin/grading_method_sets/{index.html.slim → _grading_method_sets.html.slim} +9 -8
  78. data/app/views/gaku/admin/grading_method_sets/_show.html.slim +4 -0
  79. data/app/views/gaku/admin/grading_method_sets/grading_method_set_items/_fields.html.slim +2 -2
  80. data/app/views/gaku/admin/grading_method_sets/grading_method_set_items/_items.html.slim +1 -1
  81. data/app/views/gaku/admin/grading_method_sets/index.js.erb +1 -0
  82. data/app/views/gaku/admin/grading_method_sets/show.js.erb +1 -0
  83. data/app/views/gaku/admin/grading_methods/_criteria_form_fields.html.slim +19 -0
  84. data/app/views/gaku/admin/grading_methods/_criteria_template.html.slim +11 -0
  85. data/app/views/gaku/admin/grading_methods/_fields.html.slim +1 -1
  86. data/app/views/gaku/admin/grading_methods/_form_fields.html.slim +3 -2
  87. data/app/views/gaku/admin/grading_methods/_grading_methods.html.slim +21 -0
  88. data/app/views/gaku/admin/grading_methods/index.js.erb +1 -0
  89. data/app/views/gaku/admin/home/index.html.slim +5 -0
  90. data/app/views/gaku/admin/presets/_address.html.slim +8 -7
  91. data/app/views/gaku/admin/presets/_chooser_fields.html.slim +1 -1
  92. data/app/views/gaku/admin/presets/_export_formats.html.slim +5 -4
  93. data/app/views/gaku/admin/presets/_fields.html.slim +1 -1
  94. data/app/views/gaku/admin/presets/_grading.html.slim +4 -3
  95. data/app/views/gaku/admin/presets/_locale.html.slim +6 -3
  96. data/app/views/gaku/admin/presets/_names_order.html.slim +1 -1
  97. data/app/views/gaku/admin/presets/_pagination.html.slim +10 -9
  98. data/app/views/gaku/admin/presets/_person.html.slim +3 -2
  99. data/app/views/gaku/admin/presets/{index.html.slim → _presets.html.slim} +7 -4
  100. data/app/views/gaku/admin/presets/_student.html.slim +1 -1
  101. data/app/views/gaku/admin/presets/_tabs.html.slim +2 -3
  102. data/app/views/gaku/admin/presets/edit.js.erb +1 -0
  103. data/app/views/gaku/admin/presets/index.js.erb +1 -0
  104. data/app/views/gaku/admin/presets/update.js.erb +1 -0
  105. data/app/views/gaku/admin/roles/_roles.html.slim +21 -0
  106. data/app/views/gaku/admin/roles/index.js.erb +1 -0
  107. data/app/views/gaku/admin/school_years/_edit_form.html.slim +4 -0
  108. data/app/views/gaku/admin/school_years/_fields.html.slim +1 -2
  109. data/app/views/gaku/admin/school_years/_school_years.html.slim +23 -0
  110. data/app/views/gaku/admin/school_years/edit.html.slim +20 -0
  111. data/app/views/gaku/admin/school_years/edit.js.erb +4 -2
  112. data/app/views/gaku/admin/school_years/index.js.erb +1 -0
  113. data/app/views/gaku/admin/school_years/semesters/_semesters.html.slim +1 -1
  114. data/app/views/gaku/admin/school_years/semesters/index.js.erb +1 -0
  115. data/app/views/gaku/admin/schools/_edit_form.html.slim +3 -0
  116. data/app/views/gaku/admin/schools/_edit_master_form.html.slim +10 -0
  117. data/app/views/gaku/admin/schools/_school.html.slim +4 -2
  118. data/app/views/gaku/admin/schools/{index.html.slim → _schools.html.slim} +10 -9
  119. data/app/views/gaku/admin/schools/_tabs.html.slim +1 -1
  120. data/app/views/gaku/admin/schools/edit.html.slim +37 -14
  121. data/app/views/gaku/admin/schools/edit.js.erb +1 -0
  122. data/app/views/gaku/admin/schools/edit_master.html.slim +36 -16
  123. data/app/views/gaku/admin/schools/index.js.erb +1 -0
  124. data/app/views/gaku/admin/schools/programs/_fields.html.slim +3 -4
  125. data/app/views/gaku/admin/schools/programs/_programs.html.slim +2 -2
  126. data/app/views/gaku/admin/schools/programs/create.js.erb +1 -0
  127. data/app/views/gaku/admin/schools/programs/destroy.js.erb +1 -0
  128. data/app/views/gaku/admin/schools/programs/index.js.erb +1 -0
  129. data/app/views/gaku/admin/schools/update.js.erb +1 -0
  130. data/app/views/gaku/admin/shared/_ajax_picture.html.slim +8 -0
  131. data/app/views/gaku/admin/shared/_ajax_upload_picture.html.slim +14 -0
  132. data/app/views/gaku/admin/shared/remove_picture.js.erb +3 -0
  133. data/app/views/gaku/admin/shared/set_picture.js.erb +3 -0
  134. data/app/views/gaku/admin/simple_grade_types/_simple_grade_types.html.slim +24 -0
  135. data/app/views/gaku/admin/simple_grade_types/index.js.erb +1 -0
  136. data/app/views/gaku/admin/specialties/{index.html.slim → _specialties.html.slim} +9 -8
  137. data/app/views/gaku/admin/specialties/index.js.erb +1 -0
  138. data/app/views/gaku/admin/states/_country_select_form.html.slim +1 -2
  139. data/app/views/gaku/admin/states/_form_fields.html.slim +1 -1
  140. data/app/views/gaku/admin/states/_states.html.slim +16 -0
  141. data/app/views/gaku/admin/states/index.js.erb +1 -0
  142. data/app/views/gaku/admin/student_review_categories/_form.html.slim +3 -0
  143. data/app/views/gaku/admin/student_review_categories/_form_fields.html.slim +1 -0
  144. data/app/views/gaku/admin/student_review_categories/_modal.html.slim +4 -0
  145. data/app/views/gaku/admin/student_review_categories/_student_review_categories.html.slim +18 -0
  146. data/app/views/gaku/admin/student_review_categories/_student_review_category.html.slim +2 -0
  147. data/app/views/gaku/admin/student_review_categories/_table_fields.html.slim +4 -0
  148. data/app/views/gaku/admin/student_review_categories/create.js.erb +7 -0
  149. data/app/views/gaku/admin/student_review_categories/destroy.js.erb +2 -0
  150. data/app/views/gaku/admin/student_review_categories/edit.js.erb +3 -0
  151. data/app/views/gaku/admin/student_review_categories/index.js.erb +1 -0
  152. data/app/views/gaku/admin/student_review_categories/new.js.erb +3 -0
  153. data/app/views/gaku/admin/student_review_categories/update.js.erb +3 -0
  154. data/app/views/gaku/admin/templates/_fields.html.slim +2 -2
  155. data/app/views/gaku/admin/templates/_form.html.slim +1 -1
  156. data/app/views/gaku/admin/templates/_modal.html.slim +5 -2
  157. data/app/views/gaku/admin/templates/_templates.html.slim +21 -0
  158. data/app/views/gaku/admin/templates/create.js.erb +7 -0
  159. data/app/views/gaku/admin/templates/edit.js.erb +3 -0
  160. data/app/views/gaku/admin/templates/index.js.erb +1 -0
  161. data/app/views/gaku/admin/templates/new.js.erb +3 -0
  162. data/app/views/gaku/admin/templates/update.js.erb +3 -0
  163. data/app/views/gaku/admin/users/_users.html.slim +22 -0
  164. data/app/views/gaku/admin/users/index.js.erb +1 -0
  165. data/app/views/gaku/layouts/admin/index.html.slim +0 -1
  166. data/app/views/gaku/shared/menu/_admin.html.erb +1 -71
  167. data/app/views/gaku/shared/menu/_admin_menu.html.erb +154 -0
  168. data/config/routes.rb +20 -10
  169. data/lib/gaku/admin/engine.rb +3 -5
  170. data/lib/gaku/admin.rb +2 -1
  171. data/lib/gaku/app_responder.rb +1 -1
  172. data/lib/gaku_admin.rb +1 -1
  173. data/lib/tasks/admin_user.rake +2 -1
  174. metadata +456 -374
  175. data/app/views/gaku/admin/achievements/simple_grade_types/index.html.slim +0 -23
  176. data/app/views/gaku/admin/commute_method_types/index.html.slim +0 -18
  177. data/app/views/gaku/admin/contact_types/index.html.slim +0 -18
  178. data/app/views/gaku/admin/departments/index.html.slim +0 -20
  179. data/app/views/gaku/admin/grading_method_sets/show.html.slim +0 -13
  180. data/app/views/gaku/admin/grading_methods/index.html.slim +0 -20
  181. data/app/views/gaku/admin/roles/index.html.slim +0 -20
  182. data/app/views/gaku/admin/school_years/index.html.slim +0 -21
  183. data/app/views/gaku/admin/school_years/show.html.slim +0 -15
  184. data/app/views/gaku/admin/schools/campuses/_campus.html.slim +0 -6
  185. data/app/views/gaku/admin/schools/campuses/_picture.html.slim +0 -8
  186. data/app/views/gaku/admin/schools/campuses/_show_table.html.slim +0 -10
  187. data/app/views/gaku/admin/schools/campuses/_tabs.html.slim +0 -15
  188. data/app/views/gaku/admin/schools/campuses/_upload_picture.html.slim +0 -7
  189. data/app/views/gaku/admin/schools/campuses/addresses/_address.html.slim +0 -7
  190. data/app/views/gaku/admin/schools/campuses/contacts/_contact.html.slim +0 -3
  191. data/app/views/gaku/admin/schools/campuses/contacts/_fields.html.slim +0 -12
  192. data/app/views/gaku/admin/schools/campuses/contacts/_primary_field.html.slim +0 -13
  193. data/app/views/gaku/admin/schools/campuses/edit.html.slim +0 -19
  194. data/app/views/gaku/admin/schools/campuses/show.html.slim +0 -13
  195. data/app/views/gaku/admin/schools/show.html.slim +0 -13
  196. data/app/views/gaku/admin/schools/show_master.html.slim +0 -14
  197. data/app/views/gaku/admin/states/index.html.slim +0 -15
  198. data/app/views/gaku/admin/templates/edit.html.slim +0 -1
  199. data/app/views/gaku/admin/templates/index.html.slim +0 -20
  200. data/app/views/gaku/admin/templates/new.html.slim +0 -1
  201. data/app/views/gaku/admin/users/index.html.slim +0 -21
  202. data/config/initializers/client_side_validations.rb +0 -9
  203. /data/app/views/gaku/admin/{schools/campuses → campuses}/_form.html.slim +0 -0
  204. /data/app/views/gaku/admin/{schools/campuses → campuses}/_form_fields.html.slim +0 -0
  205. /data/app/views/gaku/admin/{schools/campuses → campuses}/addresses/_fields.html.slim +0 -0
  206. /data/app/views/gaku/admin/{schools/campuses → campuses}/addresses/_form.html.slim +0 -0
  207. /data/app/views/gaku/admin/{schools/campuses → campuses}/addresses/_form_fields.html.slim +0 -0
  208. /data/app/views/gaku/admin/{schools/campuses → campuses}/addresses/_modal.html.slim +0 -0
  209. /data/app/views/gaku/admin/{schools/campuses → campuses}/addresses/create.js.erb +0 -0
  210. /data/app/views/gaku/admin/{schools/campuses → campuses}/addresses/destroy.js.erb +0 -0
  211. /data/app/views/gaku/admin/{schools/campuses → campuses}/addresses/edit.js.erb +0 -0
  212. /data/app/views/gaku/admin/{schools/campuses → campuses}/addresses/new.js.erb +0 -0
  213. /data/app/views/gaku/admin/{schools/campuses → campuses}/contacts/_delete_link.html.slim +0 -0
  214. /data/app/views/gaku/admin/{schools/campuses → campuses}/contacts/_form.html.slim +0 -0
  215. /data/app/views/gaku/admin/{schools/campuses → campuses}/contacts/_form_fields.html.slim +0 -0
  216. /data/app/views/gaku/admin/{schools/campuses → campuses}/contacts/_modal.html.slim +0 -0
  217. /data/app/views/gaku/admin/{schools/campuses → campuses}/contacts/make_primary.js.erb +0 -0
  218. /data/app/views/gaku/admin/{schools/campuses → campuses}/contacts/new.js.erb +0 -0
  219. /data/app/views/gaku/admin/{schools/campuses → campuses}/contacts/soft_delete.js.erb +0 -0
  220. /data/app/views/gaku/admin/{schools/campuses → campuses}/contacts/update.js.erb +0 -0
  221. /data/app/views/gaku/admin/{schools/campuses → campuses}/create.js.erb +0 -0
  222. /data/app/views/gaku/admin/{schools/campuses → campuses}/destroy.js.erb +0 -0
  223. /data/app/views/gaku/admin/{schools/campuses → campuses}/new.js.erb +0 -0
  224. /data/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/_fields.html.slim +0 -0
  225. /data/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/_form.html.slim +0 -0
  226. /data/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/_form_fields.html.slim +0 -0
  227. /data/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/_modal.html.slim +0 -0
  228. /data/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/_simple_grade_type.html.slim +0 -0
  229. /data/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/create.js.erb +0 -0
  230. /data/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/destroy.js.erb +0 -0
  231. /data/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/edit.js.erb +0 -0
  232. /data/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/new.js.erb +0 -0
  233. /data/app/views/gaku/admin/{achievements/simple_grade_types → simple_grade_types}/update.js.erb +0 -0
@@ -1,16 +1,13 @@
1
1
  module Gaku
2
2
  class Admin::GradingMethodsController < Admin::BaseController
3
3
 
4
- #load_and_authorize_resource class: GradingMethod
5
-
6
- respond_to :js, only: %i( new create edit update destroy )
7
- respond_to :html, only: :index
4
+ respond_to :js, only: %i( new create edit update destroy index )
8
5
 
9
6
  before_action :set_grading_method, only: %i( edit update destroy )
10
7
 
11
8
  def index
12
9
  @grading_methods = GradingMethod.all
13
- @count = GradingMethod.count
10
+ set_count
14
11
  respond_with @grading_methods
15
12
  end
16
13
 
@@ -22,7 +19,7 @@ module Gaku
22
19
  def create
23
20
  @grading_method = GradingMethod.new(grading_method_params)
24
21
  @grading_method.save
25
- @count = GradingMethod.count
22
+ set_count
26
23
  respond_with @grading_method
27
24
  end
28
25
 
@@ -36,7 +33,7 @@ module Gaku
36
33
 
37
34
  def destroy
38
35
  @grading_method.destroy
39
- @count = GradingMethod.count
36
+ set_count
40
37
  respond_with @grading_method
41
38
  end
42
39
 
@@ -48,12 +45,16 @@ module Gaku
48
45
 
49
46
  def grading_method_params
50
47
  params.require(:grading_method).permit(attributes).tap do |whitelisted|
51
- whitelisted['arguments'] = params[:grading_method][:arguments]
48
+ whitelisted['criteria'] = params[:grading_method][:criteria]
52
49
  end
53
50
  end
54
51
 
55
52
  def attributes
56
- %i( description method name curved arguments )
53
+ %i( description grading_type name curved criteria )
54
+ end
55
+
56
+ def set_count
57
+ @count = GradingMethod.count
57
58
  end
58
59
 
59
60
  end
@@ -0,0 +1,11 @@
1
+ module Gaku
2
+ class Admin::HomeController < Admin::BaseController
3
+
4
+ def index
5
+ @contact_types = ContactType.all
6
+ @count = ContactType.count
7
+ respond_with @contact_types
8
+ end
9
+
10
+ end
11
+ end
@@ -1,7 +1,7 @@
1
1
  module Gaku
2
2
  class Admin::PresetsController < Admin::BaseController
3
3
 
4
- respond_to :html, only: %i( index edit update )
4
+ respond_to :js, only: %i( index edit update )
5
5
  before_action :set_preset, except: :index
6
6
 
7
7
  def index
@@ -28,7 +28,7 @@ module Gaku
28
28
 
29
29
  def preset_attr
30
30
  [
31
- :name, :default, :active, :locale, :names_order,
31
+ :name, :default, :active, :locale, :names_order, :time_format_24,
32
32
  pagination: pagination_attr,
33
33
  grading: grading_attr,
34
34
  person: person_attr,
@@ -59,12 +59,10 @@ module Gaku
59
59
  end
60
60
 
61
61
  def chooser_fields_attr
62
- %i(
63
- show_name show_middle_name show_surname show_birth_date show_gender
62
+ %i( show_name show_middle_name show_surname show_birth_date show_gender
64
63
  show_user show_code show_foreign_id_code show_enrollment_status
65
64
  show_admitted show_graduated show_class_name show_specialty
66
- show_primary_address show_primary_contact show_primary_email show_personal_information
67
- )
65
+ show_primary_address show_primary_contact show_primary_email show_personal_information )
68
66
  end
69
67
 
70
68
  def set_preset
@@ -1,16 +1,13 @@
1
1
  module Gaku
2
2
  class Admin::RolesController < Admin::BaseController
3
3
 
4
- #load_and_authorize_resource class: Role
5
-
6
- respond_to :js, only: %i( new create edit update destroy )
7
- respond_to :html, only: :index
4
+ respond_to :js, only: %i( new create edit update destroy index )
8
5
 
9
6
  before_action :set_role, only: %i( edit update destroy )
10
7
 
11
8
  def index
12
9
  @roles = Role.all
13
- @count = Role.count
10
+ set_count
14
11
  respond_with @roles
15
12
  end
16
13
 
@@ -22,7 +19,7 @@ module Gaku
22
19
  def create
23
20
  @role = Role.new(role_params)
24
21
  @role.save
25
- @count = Role.count
22
+ set_count
26
23
  respond_with @role
27
24
  end
28
25
 
@@ -36,7 +33,7 @@ module Gaku
36
33
 
37
34
  def destroy
38
35
  @role.destroy
39
- @count = Role.count
36
+ set_count
40
37
  respond_with @role
41
38
  end
42
39
 
@@ -50,5 +47,9 @@ module Gaku
50
47
  params.require(:role).permit(:name)
51
48
  end
52
49
 
50
+ def set_count
51
+ @count = Role.count
52
+ end
53
+
53
54
  end
54
55
  end
@@ -6,7 +6,6 @@ module Gaku
6
6
  before_action :set_school_year
7
7
  before_action :set_semester, only: %i( edit update destroy )
8
8
 
9
-
10
9
  def new
11
10
  @semester = Semester.new
12
11
  end
@@ -1,10 +1,10 @@
1
1
  module Gaku
2
2
  class Admin::SchoolYearsController < Admin::BaseController
3
3
 
4
- respond_to :html, only: %i( index show )
5
- respond_to :js, only: %i( new create destroy edit update )
4
+ respond_to :html, only: %i( edit )
5
+ respond_to :js, only: %i( index new create destroy edit update )
6
6
 
7
- before_action :set_school_year, only: %i( show edit update destroy )
7
+ before_action :set_school_year, only: %i( edit update destroy )
8
8
 
9
9
  def index
10
10
  @school_years = SchoolYear.all
@@ -23,9 +23,6 @@ module Gaku
23
23
  respond_with @school_year
24
24
  end
25
25
 
26
- def show
27
- end
28
-
29
26
  def edit
30
27
  end
31
28
 
@@ -40,7 +37,6 @@ module Gaku
40
37
  respond_with @school_year
41
38
  end
42
39
 
43
-
44
40
  private
45
41
 
46
42
  def school_year_params
@@ -1,12 +1,19 @@
1
1
  module Gaku
2
2
  class Admin::Schools::ProgramsController < Admin::BaseController
3
-
4
- respond_to :js, only: %i( new create destroy edit update show_program_levels show_program_specialties show_program_syllabuses )
3
+
4
+ respond_to :js, only: %i( index new create destroy edit update
5
+ show_program_levels show_program_specialties show_program_syllabuses )
5
6
 
6
7
  before_action :set_school
7
- before_action :set_program, only: %i( show_program_levels show_program_specialties show_program_syllabuses destroy edit show update )
8
+ before_action :set_program, only: %i( show_program_levels show_program_specialties show_program_syllabuses
9
+ destroy edit show update )
8
10
  before_action :load_data, only: %i( new edit )
9
11
 
12
+ def index
13
+ @programs = @school.programs
14
+ respond_with @programs
15
+ end
16
+
10
17
  def new
11
18
  @program = Program.new
12
19
  respond_with @program
@@ -50,7 +57,7 @@ module Gaku
50
57
  end
51
58
 
52
59
  def attributes
53
- #permit :id for update nested attributes
60
+ # permit :id for update nested attributes
54
61
  [:id, :name, :description,
55
62
  { program_specialties_attributes: [:id, :specialty_id, :_destroy] },
56
63
  { program_levels_attributes: [:id, :level_id, :_destroy] },
@@ -1,84 +1,87 @@
1
1
  module Gaku
2
- class Admin::SchoolsController < Admin::BaseController
3
-
4
- respond_to :js, only: %i( new create destroy )
5
- respond_to :html, only: %i( index edit edit_master update update_master show show_master )
6
-
7
- before_action :set_school, only: %i( edit show update destroy )
8
- before_action :set_master_school, only: %i( show_master edit_master update_master )
9
-
10
- def show_master
11
- respond_with @school
12
- end
13
-
14
- def edit_master
15
- respond_with @school
16
- end
17
-
18
- def destroy
19
- @school.destroy
20
- set_count
21
- respond_with @school
22
- end
23
-
24
- def new
25
- @school = School.new
26
- respond_with @school
27
- end
28
-
29
- def create
30
- @school = School.new(school_params)
31
- @school.save
32
- set_count
33
- respond_with @school
34
- end
35
-
36
- def edit
37
- respond_with @school
38
- end
39
-
40
- def show
41
- respond_with @school
42
- end
43
-
44
- def update
45
- @school.update(school_params)
46
- respond_with @school, location: [:edit, :admin, @school]
47
- end
48
-
49
- def update_master
50
- @school.update(school_params)
51
- respond_with @school, location: admin_school_details_edit_path
52
- end
53
-
54
- def index
55
- @schools = School.all
56
- set_count
57
- respond_with @schools
58
- end
59
-
60
- private
61
-
62
- def school_params
63
- params.require(:school).permit(attributes)
64
- end
65
-
66
- def attributes
67
- [:name, :primary, :slogan, :description, :founded, :principal, :vice_principal, :grades, :code, { levels_attributes: [ :name, :'_destroy', :id ] }, :picture ]
68
- end
69
-
70
- def set_school
71
- @school = School.find(params[:id])
72
- end
73
-
74
- def set_count
75
- @count = School.count
76
- end
77
-
78
- def set_master_school
79
- @school = School.primary
2
+ module Admin
3
+ class SchoolsController < BaseController
4
+ include AdminPictureController
5
+
6
+ respond_to :js, only: %i( new create destroy index edit update )
7
+ respond_to :html, only: %i( edit_master edit update_master show )
8
+
9
+ before_action :set_school, only: %i( edit show update destroy set_picture remove_picture )
10
+ before_action :set_master_school, only: %i( edit_master update_master )
11
+
12
+ def edit_master
13
+ respond_with @school
14
+ end
15
+
16
+ def destroy
17
+ @school.destroy
18
+ set_count
19
+ respond_with @school
20
+ end
21
+
22
+ def new
23
+ @school = School.new
24
+ respond_with @school
25
+ end
26
+
27
+ def create
28
+ @school = School.new(school_params)
29
+ @school.save
30
+ set_count
31
+ respond_with @school
32
+ end
33
+
34
+ def edit
35
+ respond_with @school
36
+ end
37
+
38
+ def show
39
+ respond_with @school
40
+ end
41
+
42
+ def update
43
+ @school.update(school_params)
44
+ respond_with @school
45
+ end
46
+
47
+ def update_master
48
+ @school.update(school_params)
49
+ respond_with @school, location: admin_school_details_edit_path
50
+ end
51
+
52
+ def index
53
+ @schools = School.all
54
+ set_count
55
+ respond_with @schools
56
+ end
57
+
58
+ private
59
+
60
+ def school_params
61
+ params.require(:school).permit(attributes)
62
+ end
63
+
64
+ def attributes
65
+ [:name, :primary, :slogan, :description, :founded, :principal, :vice_principal, :grades, :code, :picture,
66
+ { levels_attributes: level_attributes }]
67
+ end
68
+
69
+ def level_attributes
70
+ [:name, :'_destroy', :id]
71
+ end
72
+
73
+ def set_school
74
+ @school = School.find(params[:id])
75
+ end
76
+
77
+ def set_count
78
+ @count = School.count
79
+ end
80
+
81
+ def set_master_school
82
+ @school = School.primary
83
+ end
80
84
  end
81
85
 
82
86
  end
83
-
84
87
  end
@@ -1,7 +1,7 @@
1
1
  module Gaku
2
- class Admin::Achievements::SimpleGradeTypesController < Admin::BaseController
3
- respond_to :js, only: %i( new create update edit destroy )
4
- respond_to :html, only: %i( index )
2
+ class Admin::SimpleGradeTypesController < Admin::BaseController
3
+
4
+ respond_to :js, only: %i( new create update edit destroy index )
5
5
 
6
6
  before_action :set_simple_grade_type, only: %i( edit update destroy )
7
7
  before_action :load_data, only: %i( new edit )
@@ -66,5 +66,6 @@ module Gaku
66
66
  def t_resource
67
67
  t(:'simple_grade_type.singular')
68
68
  end
69
+
69
70
  end
70
71
  end
@@ -1,13 +1,10 @@
1
1
  module Gaku
2
2
  class Admin::SpecialtiesController < Admin::BaseController
3
3
 
4
- #load_and_authorize_resource class: Specialty
5
-
6
- respond_to :js, only: %i( new create edit update destroy )
7
- respond_to :html, only: :index
4
+ respond_to :js, only: %i( new create edit update destroy index )
8
5
 
9
6
  before_action :set_specialty, only: %i( edit update destroy )
10
- before_action :load_data, only: %i( new edit )
7
+ before_action :load_data, only: %i( new edit )
11
8
 
12
9
  def index
13
10
  @specialties = Specialty.all
@@ -1,92 +1,92 @@
1
1
  module Gaku
2
- module Admin
3
- class StatesController < Admin::BaseController
4
-
5
- #load_and_authorize_resource class: State
6
-
7
- respond_to :js, only: %i( new create edit update destroy country_states )
8
- respond_to :html, only: %i( index edit update )
9
-
10
- before_action :set_state, only: %i( edit show update destroy )
11
- before_action :set_countries
12
-
13
- def country_states
14
- if params[:state][:country_iso].empty?
15
- @country = set_default_country
16
- set_count @country
17
- if @country
18
- respond_with @country
19
- else
20
- render nothing: true
21
- end
22
- else
23
- @country = Country.where(iso: params[:state][:country_iso]).first
24
- @states = @country.states
25
- set_count @country
26
- respond_with @country
27
- end
28
- end
2
+ class Admin::StatesController < Admin::BaseController
29
3
 
30
- def destroy
31
- @state.destroy
32
- respond_with @state
33
- end
4
+ respond_to :js, only: %i( new create edit update destroy country_states index )
5
+ respond_to :html, only: %i( edit update )
34
6
 
35
- def new
36
- @state = State.new
37
- respond_with @state
38
- end
7
+ before_action :set_state, only: %i( edit show update destroy )
8
+ before_action :set_countries
39
9
 
40
- def create
41
- @state = State.new(state_params)
42
- @state.save
43
- respond_with @state
10
+ def country_states
11
+ if params[:state][:country_iso].empty?
12
+ states_for_default_country
13
+ else
14
+ @country = Country.where(iso: params[:state][:country_iso]).first
15
+ @states = @country.states
16
+ set_count @country
17
+ respond_with @country
44
18
  end
19
+ end
45
20
 
46
- def edit
47
- end
21
+ def destroy
22
+ @state.destroy
23
+ respond_with @state
24
+ end
48
25
 
49
- def update
50
- @state.update(state_params)
51
- respond_with @state
52
- end
26
+ def new
27
+ @state = State.new
28
+ respond_with @state
29
+ end
53
30
 
54
- def index
55
- @country = set_default_country
56
- set_count @country
57
- respond_with @country
58
- end
31
+ def create
32
+ @state = State.new(state_params)
33
+ @state.save
34
+ respond_with @state
35
+ end
59
36
 
60
- private
37
+ def edit
38
+ end
61
39
 
62
- def state_params
63
- params.require(:state).permit(attributes)
64
- end
40
+ def update
41
+ @state.update(state_params)
42
+ respond_with @state
43
+ end
65
44
 
66
- def attributes
67
- %i( name abbr name_ascii code country_iso )
68
- end
45
+ def index
46
+ @country = set_default_country
47
+ set_count @country
48
+ respond_with @country
49
+ end
69
50
 
70
- def set_state
71
- @state = State.find(params[:id])
72
- end
51
+ private
73
52
 
74
- def set_countries
75
- @countries = Country.all
53
+ def states_for_default_country
54
+ @country = set_default_country
55
+ set_count @country
56
+ if @country
57
+ respond_with @country
58
+ else
59
+ render nothing: true
76
60
  end
61
+ end
77
62
 
78
- def set_count(object)
79
- @count = object.states.count unless object.nil?
80
- end
63
+ def state_params
64
+ params.require(:state).permit(attributes)
65
+ end
81
66
 
82
- def country_preset
83
- Preset.address('country')
84
- end
67
+ def attributes
68
+ %i( name abbr name_ascii code country_iso )
69
+ end
85
70
 
86
- def set_default_country
87
- Country.where(iso: country_preset).first
88
- end
71
+ def set_state
72
+ @state = State.find(params[:id])
73
+ end
74
+
75
+ def set_countries
76
+ @countries = Country.all
77
+ end
78
+
79
+ def set_count(object)
80
+ @count = object.states.count unless object.nil?
81
+ end
82
+
83
+ def country_preset
84
+ Preset.address('country')
85
+ end
89
86
 
87
+ def set_default_country
88
+ Country.where(iso: country_preset).first
90
89
  end
90
+
91
91
  end
92
92
  end
@@ -0,0 +1,57 @@
1
+ module Gaku
2
+ class Admin::StudentReviewCategoriesController < Admin::BaseController
3
+
4
+ respond_to :js
5
+
6
+ before_action :set_student_review_category, only: %i( edit update destroy )
7
+
8
+ def index
9
+ @student_review_categories = StudentReviewCategory.all
10
+ set_count
11
+ respond_with @student_review_categories
12
+ end
13
+
14
+ def new
15
+ @student_review_category = StudentReviewCategory.new
16
+ respond_with @student_review_category
17
+ end
18
+
19
+ def create
20
+ @student_review_category = StudentReviewCategory.create(student_review_category_params)
21
+ set_count
22
+ respond_with @student_review_category
23
+ end
24
+
25
+ def edit
26
+ end
27
+
28
+ def update
29
+ @student_review_category.update(student_review_category_params)
30
+ respond_with @student_review_category
31
+ end
32
+
33
+ def destroy
34
+ @student_review_category.destroy!
35
+ set_count
36
+ respond_with @student_review_category
37
+ end
38
+
39
+ private
40
+
41
+ def student_review_category_params
42
+ params.require(:student_review_category).permit(student_review_category_attrs)
43
+ end
44
+
45
+ def student_review_category_attrs
46
+ %i( name )
47
+ end
48
+
49
+ def set_student_review_category
50
+ @student_review_category = StudentReviewCategory.find(params[:id])
51
+ end
52
+
53
+ def set_count
54
+ @count = StudentReviewCategory.count
55
+ end
56
+ end
57
+ end