gaku_admin 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/app/assets/fonts/gaku/admin/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/fonts/gaku/admin/glyphicons-halflings-regular.svg +228 -0
- data/app/assets/fonts/gaku/admin/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/fonts/gaku/admin/glyphicons-halflings-regular.woff +0 -0
- data/app/assets/javascripts/gaku/admin/admin.coffee +51 -0
- data/app/assets/javascripts/gaku/admin/base.js.coffee +118 -0
- data/app/assets/javascripts/gaku/admin/slide.js.erb +14 -0
- data/app/assets/javascripts/gaku/admin.js.coffee +43 -0
- data/app/assets/stylesheets/gaku/admin/bootstrap_and_theme.css.scss +571 -0
- data/app/assets/stylesheets/gaku/admin/disposals.css.scss +14 -0
- data/app/assets/stylesheets/gaku/admin/gaku.css.scss +216 -0
- data/app/assets/stylesheets/gaku/admin.css +13 -0
- data/app/assets/templates/roster.xls +0 -0
- data/app/controllers/gaku/admin/achievements/simple_grade_types_controller.rb +70 -0
- data/app/controllers/gaku/admin/attendance_types_controller.rb +60 -0
- data/app/controllers/gaku/admin/badge_types_controller.rb +69 -0
- data/app/controllers/gaku/admin/base_controller.rb +43 -0
- data/app/controllers/gaku/admin/commute_method_types_controller.rb +54 -0
- data/app/controllers/gaku/admin/contact_types_controller.rb +55 -0
- data/app/controllers/gaku/admin/departments_controller.rb +55 -0
- data/app/controllers/gaku/admin/enrollment_statuses_controller.rb +58 -0
- data/app/controllers/gaku/admin/grading_method_sets/grading_method_set_items_controller.rb +70 -0
- data/app/controllers/gaku/admin/grading_method_sets_controller.rb +69 -0
- data/app/controllers/gaku/admin/grading_methods_controller.rb +60 -0
- data/app/controllers/gaku/admin/presets_controller.rb +75 -0
- data/app/controllers/gaku/admin/roles_controller.rb +54 -0
- data/app/controllers/gaku/admin/school_years/semesters_controller.rb +58 -0
- data/app/controllers/gaku/admin/school_years_controller.rb +63 -0
- data/app/controllers/gaku/admin/schools/campuses/addresses_controller.rb +64 -0
- data/app/controllers/gaku/admin/schools/campuses/contacts_controller.rb +77 -0
- data/app/controllers/gaku/admin/schools/campuses_controller.rb +72 -0
- data/app/controllers/gaku/admin/schools/programs_controller.rb +79 -0
- data/app/controllers/gaku/admin/schools_controller.rb +84 -0
- data/app/controllers/gaku/admin/specialties_controller.rb +63 -0
- data/app/controllers/gaku/admin/states_controller.rb +92 -0
- data/app/controllers/gaku/admin/system_tools_controller.rb +8 -0
- data/app/controllers/gaku/admin/templates_controller.rb +72 -0
- data/app/controllers/gaku/admin/users_controller.rb +82 -0
- data/app/controllers/gaku/states_controller.rb +17 -0
- data/app/helpers/gaku/admin_helper.rb +12 -0
- data/app/helpers/gaku/presets_helper.rb +10 -0
- data/app/helpers/gaku/shared_helper.rb +25 -0
- data/app/overrides/admin_menu.rb +6 -0
- data/app/views/gaku/admin/achievements/simple_grade_types/_fields.html.slim +8 -0
- data/app/views/gaku/admin/achievements/simple_grade_types/_form.html.slim +3 -0
- data/app/views/gaku/admin/achievements/simple_grade_types/_form_fields.html.slim +7 -0
- data/app/views/gaku/admin/achievements/simple_grade_types/_modal.html.slim +4 -0
- data/app/views/gaku/admin/achievements/simple_grade_types/_simple_grade_type.html.slim +2 -0
- data/app/views/gaku/admin/achievements/simple_grade_types/create.js.erb +7 -0
- data/app/views/gaku/admin/achievements/simple_grade_types/destroy.js.erb +2 -0
- data/app/views/gaku/admin/achievements/simple_grade_types/edit.js.erb +3 -0
- data/app/views/gaku/admin/achievements/simple_grade_types/index.html.slim +23 -0
- data/app/views/gaku/admin/achievements/simple_grade_types/new.js.erb +3 -0
- data/app/views/gaku/admin/achievements/simple_grade_types/update.js.erb +4 -0
- data/app/views/gaku/admin/attendance_types/_attendance_type.html.slim +2 -0
- data/app/views/gaku/admin/attendance_types/_fields.html.slim +9 -0
- data/app/views/gaku/admin/attendance_types/_form.html.slim +3 -0
- data/app/views/gaku/admin/attendance_types/_form_fields.html.slim +6 -0
- data/app/views/gaku/admin/attendance_types/_modal.html.slim +4 -0
- data/app/views/gaku/admin/attendance_types/create.js.erb +7 -0
- data/app/views/gaku/admin/attendance_types/destroy.js.erb +2 -0
- data/app/views/gaku/admin/attendance_types/edit.js.erb +4 -0
- data/app/views/gaku/admin/attendance_types/index.html.slim +24 -0
- data/app/views/gaku/admin/attendance_types/index.json.rb +1 -0
- data/app/views/gaku/admin/attendance_types/new.js.erb +4 -0
- data/app/views/gaku/admin/attendance_types/update.js.erb +4 -0
- data/app/views/gaku/admin/badge_types/_badge_type.html.slim +2 -0
- data/app/views/gaku/admin/badge_types/_fields.html.slim +7 -0
- data/app/views/gaku/admin/badge_types/_form.html.slim +3 -0
- data/app/views/gaku/admin/badge_types/_form_fields.html.slim +7 -0
- data/app/views/gaku/admin/badge_types/_modal.html.slim +4 -0
- data/app/views/gaku/admin/badge_types/destroy.js.erb +2 -0
- data/app/views/gaku/admin/badge_types/edit.js.erb +3 -0
- data/app/views/gaku/admin/badge_types/index.html.slim +22 -0
- data/app/views/gaku/admin/badge_types/new.js.erb +3 -0
- data/app/views/gaku/admin/commute_method_types/_commute_method_type.html.slim +2 -0
- data/app/views/gaku/admin/commute_method_types/_fields.html.slim +4 -0
- data/app/views/gaku/admin/commute_method_types/_form.html.slim +3 -0
- data/app/views/gaku/admin/commute_method_types/_modal.html.slim +4 -0
- data/app/views/gaku/admin/commute_method_types/create.js.erb +7 -0
- data/app/views/gaku/admin/commute_method_types/destroy.js.erb +2 -0
- data/app/views/gaku/admin/commute_method_types/edit.js.erb +3 -0
- data/app/views/gaku/admin/commute_method_types/index.html.slim +18 -0
- data/app/views/gaku/admin/commute_method_types/new.js.erb +3 -0
- data/app/views/gaku/admin/commute_method_types/update.js.erb +3 -0
- data/app/views/gaku/admin/contact_types/_contact_type.html.slim +2 -0
- data/app/views/gaku/admin/contact_types/_fields.html.slim +4 -0
- data/app/views/gaku/admin/contact_types/_form.html.slim +3 -0
- data/app/views/gaku/admin/contact_types/_modal.html.slim +4 -0
- data/app/views/gaku/admin/contact_types/create.js.erb +7 -0
- data/app/views/gaku/admin/contact_types/destroy.js.erb +2 -0
- data/app/views/gaku/admin/contact_types/edit.js.erb +3 -0
- data/app/views/gaku/admin/contact_types/index.html.slim +18 -0
- data/app/views/gaku/admin/contact_types/new.js.erb +3 -0
- data/app/views/gaku/admin/contact_types/update.js.erb +3 -0
- data/app/views/gaku/admin/departments/_department.html.slim +2 -0
- data/app/views/gaku/admin/departments/_form.html.slim +3 -0
- data/app/views/gaku/admin/departments/_form_fields.html.slim +1 -0
- data/app/views/gaku/admin/departments/_modal.html.slim +4 -0
- data/app/views/gaku/admin/departments/_table_fields.html.slim +5 -0
- data/app/views/gaku/admin/departments/create.js.erb +7 -0
- data/app/views/gaku/admin/departments/destroy.js.erb +2 -0
- data/app/views/gaku/admin/departments/edit.js.erb +3 -0
- data/app/views/gaku/admin/departments/index.html.slim +20 -0
- data/app/views/gaku/admin/departments/new.js.erb +3 -0
- data/app/views/gaku/admin/departments/update.js.erb +4 -0
- data/app/views/gaku/admin/enrollment_statuses/_enrollment_status.html.slim +2 -0
- data/app/views/gaku/admin/enrollment_statuses/_fields.html.slim +6 -0
- data/app/views/gaku/admin/enrollment_statuses/_form.html.slim +3 -0
- data/app/views/gaku/admin/enrollment_statuses/_form_fields.html.slim +3 -0
- data/app/views/gaku/admin/enrollment_statuses/_modal.html.slim +4 -0
- data/app/views/gaku/admin/enrollment_statuses/create.js.erb +7 -0
- data/app/views/gaku/admin/enrollment_statuses/destroy.js.erb +2 -0
- data/app/views/gaku/admin/enrollment_statuses/edit.js.erb +3 -0
- data/app/views/gaku/admin/enrollment_statuses/index.html.slim +21 -0
- data/app/views/gaku/admin/enrollment_statuses/new.js.erb +3 -0
- data/app/views/gaku/admin/enrollment_statuses/update.js.erb +4 -0
- data/app/views/gaku/admin/grading_method_sets/_fields.html.slim +9 -0
- data/app/views/gaku/admin/grading_method_sets/_form.html.slim +3 -0
- data/app/views/gaku/admin/grading_method_sets/_form_fields.html.slim +4 -0
- data/app/views/gaku/admin/grading_method_sets/_grading_method_set.html.slim +4 -0
- data/app/views/gaku/admin/grading_method_sets/_make_primary_field.html.slim +4 -0
- data/app/views/gaku/admin/grading_method_sets/_modal.html.slim +4 -0
- data/app/views/gaku/admin/grading_method_sets/create.js.erb +7 -0
- data/app/views/gaku/admin/grading_method_sets/destroy.js.erb +7 -0
- data/app/views/gaku/admin/grading_method_sets/edit.js.erb +3 -0
- data/app/views/gaku/admin/grading_method_sets/grading_method_set_items/_fields.html.slim +9 -0
- data/app/views/gaku/admin/grading_method_sets/grading_method_set_items/_form.html.slim +3 -0
- data/app/views/gaku/admin/grading_method_sets/grading_method_set_items/_form_fields.html.slim +1 -0
- data/app/views/gaku/admin/grading_method_sets/grading_method_set_items/_item.html.slim +4 -0
- data/app/views/gaku/admin/grading_method_sets/grading_method_set_items/_items.html.slim +23 -0
- data/app/views/gaku/admin/grading_method_sets/grading_method_set_items/_modal.html.slim +4 -0
- data/app/views/gaku/admin/grading_method_sets/grading_method_set_items/create.js.erb +7 -0
- data/app/views/gaku/admin/grading_method_sets/grading_method_set_items/destroy.js.erb +2 -0
- data/app/views/gaku/admin/grading_method_sets/grading_method_set_items/edit.js.erb +3 -0
- data/app/views/gaku/admin/grading_method_sets/grading_method_set_items/new.js.erb +3 -0
- data/app/views/gaku/admin/grading_method_sets/grading_method_set_items/update.js.erb +3 -0
- data/app/views/gaku/admin/grading_method_sets/index.html.slim +23 -0
- data/app/views/gaku/admin/grading_method_sets/make_primary.js.erb +6 -0
- data/app/views/gaku/admin/grading_method_sets/new.js.erb +3 -0
- data/app/views/gaku/admin/grading_method_sets/show.html.slim +13 -0
- data/app/views/gaku/admin/grading_method_sets/update.js.erb +3 -0
- data/app/views/gaku/admin/grading_methods/_fields.html.slim +6 -0
- data/app/views/gaku/admin/grading_methods/_form.html.slim +3 -0
- data/app/views/gaku/admin/grading_methods/_form_fields.html.slim +4 -0
- data/app/views/gaku/admin/grading_methods/_grading_method.html.slim +2 -0
- data/app/views/gaku/admin/grading_methods/_modal.html.slim +4 -0
- data/app/views/gaku/admin/grading_methods/create.js.erb +7 -0
- data/app/views/gaku/admin/grading_methods/destroy.js.erb +2 -0
- data/app/views/gaku/admin/grading_methods/edit.js.erb +3 -0
- data/app/views/gaku/admin/grading_methods/index.html.slim +20 -0
- data/app/views/gaku/admin/grading_methods/new.js.erb +3 -0
- data/app/views/gaku/admin/grading_methods/update.js.erb +3 -0
- data/app/views/gaku/admin/presets/_address.html.slim +19 -0
- data/app/views/gaku/admin/presets/_chooser_fields.html.slim +91 -0
- data/app/views/gaku/admin/presets/_export_formats.html.slim +19 -0
- data/app/views/gaku/admin/presets/_fields.html.slim +5 -0
- data/app/views/gaku/admin/presets/_grading.html.slim +14 -0
- data/app/views/gaku/admin/presets/_locale.html.slim +3 -0
- data/app/views/gaku/admin/presets/_names_order.html.slim +15 -0
- data/app/views/gaku/admin/presets/_pagination.html.slim +25 -0
- data/app/views/gaku/admin/presets/_person.html.slim +8 -0
- data/app/views/gaku/admin/presets/_preset.html.slim +2 -0
- data/app/views/gaku/admin/presets/_student.html.slim +19 -0
- data/app/views/gaku/admin/presets/_tabs.html.slim +51 -0
- data/app/views/gaku/admin/presets/edit.html.slim +1 -0
- data/app/views/gaku/admin/presets/index.html.slim +16 -0
- data/app/views/gaku/admin/roles/_fields.html.slim +5 -0
- data/app/views/gaku/admin/roles/_form.html.slim +3 -0
- data/app/views/gaku/admin/roles/_form_fields.html.slim +1 -0
- data/app/views/gaku/admin/roles/_modal.html.slim +4 -0
- data/app/views/gaku/admin/roles/_role.html.slim +2 -0
- data/app/views/gaku/admin/roles/create.js.erb +7 -0
- data/app/views/gaku/admin/roles/destroy.js.erb +2 -0
- data/app/views/gaku/admin/roles/edit.js.erb +3 -0
- data/app/views/gaku/admin/roles/index.html.slim +20 -0
- data/app/views/gaku/admin/roles/new.js.erb +3 -0
- data/app/views/gaku/admin/roles/update.js.erb +3 -0
- data/app/views/gaku/admin/school_years/_fields.html.slim +7 -0
- data/app/views/gaku/admin/school_years/_form.html.slim +3 -0
- data/app/views/gaku/admin/school_years/_form_fields.html.slim +5 -0
- data/app/views/gaku/admin/school_years/_modal.html.slim +5 -0
- data/app/views/gaku/admin/school_years/_school_year.html.slim +3 -0
- data/app/views/gaku/admin/school_years/_show_table.html.slim +10 -0
- data/app/views/gaku/admin/school_years/create.js.erb +10 -0
- data/app/views/gaku/admin/school_years/destroy.js.erb +2 -0
- data/app/views/gaku/admin/school_years/edit.js.erb +5 -0
- data/app/views/gaku/admin/school_years/index.html.slim +21 -0
- data/app/views/gaku/admin/school_years/new.js.erb +5 -0
- data/app/views/gaku/admin/school_years/semesters/_fields.html.slim +7 -0
- data/app/views/gaku/admin/school_years/semesters/_form.html.slim +3 -0
- data/app/views/gaku/admin/school_years/semesters/_form_fields.html.slim +5 -0
- data/app/views/gaku/admin/school_years/semesters/_modal.html.slim +5 -0
- data/app/views/gaku/admin/school_years/semesters/_semester.html.slim +3 -0
- data/app/views/gaku/admin/school_years/semesters/_semesters.html.slim +22 -0
- data/app/views/gaku/admin/school_years/semesters/create.js.erb +10 -0
- data/app/views/gaku/admin/school_years/semesters/destroy.js.erb +2 -0
- data/app/views/gaku/admin/school_years/semesters/edit.js.erb +6 -0
- data/app/views/gaku/admin/school_years/semesters/new.js.erb +4 -0
- data/app/views/gaku/admin/school_years/semesters/update.js.erb +8 -0
- data/app/views/gaku/admin/school_years/show.html.slim +15 -0
- data/app/views/gaku/admin/school_years/update.js.erb +8 -0
- data/app/views/gaku/admin/schools/_fields.html.slim +9 -0
- data/app/views/gaku/admin/schools/_form.html.slim +3 -0
- data/app/views/gaku/admin/schools/_form_fields.html.slim +25 -0
- data/app/views/gaku/admin/schools/_school.html.slim +6 -0
- data/app/views/gaku/admin/schools/_show_table.html.slim +35 -0
- data/app/views/gaku/admin/schools/_tabs.html.slim +15 -0
- data/app/views/gaku/admin/schools/campuses/_campus.html.slim +6 -0
- data/app/views/gaku/admin/schools/campuses/_campuses.html.slim +23 -0
- data/app/views/gaku/admin/schools/campuses/_form.html.slim +3 -0
- data/app/views/gaku/admin/schools/campuses/_form_fields.html.slim +1 -0
- data/app/views/gaku/admin/schools/campuses/_picture.html.slim +8 -0
- data/app/views/gaku/admin/schools/campuses/_show_table.html.slim +10 -0
- data/app/views/gaku/admin/schools/campuses/_tabs.html.slim +15 -0
- data/app/views/gaku/admin/schools/campuses/_upload_picture.html.slim +7 -0
- data/app/views/gaku/admin/schools/campuses/addresses/_address.html.slim +7 -0
- data/app/views/gaku/admin/schools/campuses/addresses/_address_row_fields.html.slim +4 -0
- data/app/views/gaku/admin/schools/campuses/addresses/_addresses.html.slim +24 -0
- data/app/views/gaku/admin/schools/campuses/addresses/_fields.html.slim +7 -0
- data/app/views/gaku/admin/schools/campuses/addresses/_form.html.slim +3 -0
- data/app/views/gaku/admin/schools/campuses/addresses/_form_fields.html.slim +26 -0
- data/app/views/gaku/admin/schools/campuses/addresses/_modal.html.slim +5 -0
- data/app/views/gaku/admin/schools/campuses/addresses/create.js.erb +6 -0
- data/app/views/gaku/admin/schools/campuses/addresses/destroy.js.erb +2 -0
- data/app/views/gaku/admin/schools/campuses/addresses/edit.js.erb +4 -0
- data/app/views/gaku/admin/schools/campuses/addresses/new.js.erb +4 -0
- data/app/views/gaku/admin/schools/campuses/addresses/update.js.erb +4 -0
- data/app/views/gaku/admin/schools/campuses/contacts/_contact.html.slim +3 -0
- data/app/views/gaku/admin/schools/campuses/contacts/_contacts.html.slim +22 -0
- data/app/views/gaku/admin/schools/campuses/contacts/_delete_link.html.slim +1 -0
- data/app/views/gaku/admin/schools/campuses/contacts/_fields.html.slim +12 -0
- data/app/views/gaku/admin/schools/campuses/contacts/_form.html.slim +3 -0
- data/app/views/gaku/admin/schools/campuses/contacts/_form_fields.html.slim +14 -0
- data/app/views/gaku/admin/schools/campuses/contacts/_modal.html.slim +5 -0
- data/app/views/gaku/admin/schools/campuses/contacts/_primary_field.html.slim +13 -0
- data/app/views/gaku/admin/schools/campuses/contacts/create.js.erb +20 -0
- data/app/views/gaku/admin/schools/campuses/contacts/destroy.js.erb +8 -0
- data/app/views/gaku/admin/schools/campuses/contacts/edit.js.erb +4 -0
- data/app/views/gaku/admin/schools/campuses/contacts/make_primary.js.erb +6 -0
- data/app/views/gaku/admin/schools/campuses/contacts/new.js.erb +3 -0
- data/app/views/gaku/admin/schools/campuses/contacts/soft_delete.js.erb +8 -0
- data/app/views/gaku/admin/schools/campuses/contacts/update.js.erb +14 -0
- data/app/views/gaku/admin/schools/campuses/create.js.erb +9 -0
- data/app/views/gaku/admin/schools/campuses/destroy.js.erb +2 -0
- data/app/views/gaku/admin/schools/campuses/edit.html.slim +19 -0
- data/app/views/gaku/admin/schools/campuses/new.js.erb +3 -0
- data/app/views/gaku/admin/schools/campuses/show.html.slim +13 -0
- data/app/views/gaku/admin/schools/create.js.erb +7 -0
- data/app/views/gaku/admin/schools/destroy.js.erb +1 -0
- data/app/views/gaku/admin/schools/edit.html.slim +19 -0
- data/app/views/gaku/admin/schools/edit_master.html.slim +22 -0
- data/app/views/gaku/admin/schools/index.html.slim +25 -0
- data/app/views/gaku/admin/schools/new.js.erb +3 -0
- data/app/views/gaku/admin/schools/programs/_fields.html.slim +10 -0
- data/app/views/gaku/admin/schools/programs/_form.html.slim +14 -0
- data/app/views/gaku/admin/schools/programs/_form_fields.html.slim +6 -0
- data/app/views/gaku/admin/schools/programs/_modal.html.slim +3 -0
- data/app/views/gaku/admin/schools/programs/_program.html.slim +2 -0
- data/app/views/gaku/admin/schools/programs/_programs.html.slim +23 -0
- data/app/views/gaku/admin/schools/programs/create.js.erb +7 -0
- data/app/views/gaku/admin/schools/programs/destroy.js.erb +2 -0
- data/app/views/gaku/admin/schools/programs/edit.js.erb +3 -0
- data/app/views/gaku/admin/schools/programs/new.js.erb +3 -0
- data/app/views/gaku/admin/schools/programs/program_levels/_form_fields.html.slim +6 -0
- data/app/views/gaku/admin/schools/programs/program_levels/_modal.html.slim +11 -0
- data/app/views/gaku/admin/schools/programs/program_specialties/_form_fields.html.slim +7 -0
- data/app/views/gaku/admin/schools/programs/program_specialties/_modal.html.slim +10 -0
- data/app/views/gaku/admin/schools/programs/program_syllabuses/_form_fields.html.slim +5 -0
- data/app/views/gaku/admin/schools/programs/program_syllabuses/_modal.html.slim +10 -0
- data/app/views/gaku/admin/schools/programs/show_program_levels.js.erb +3 -0
- data/app/views/gaku/admin/schools/programs/show_program_specialties.js.erb +3 -0
- data/app/views/gaku/admin/schools/programs/show_program_syllabuses.js.erb +3 -0
- data/app/views/gaku/admin/schools/programs/update.js.erb +3 -0
- data/app/views/gaku/admin/schools/show.html.slim +13 -0
- data/app/views/gaku/admin/schools/show_master.html.slim +14 -0
- data/app/views/gaku/admin/shared/_picture.html.slim +6 -0
- data/app/views/gaku/admin/shared/_upload_picture.html.slim +7 -0
- data/app/views/gaku/admin/specialties/_fields.html.slim +7 -0
- data/app/views/gaku/admin/specialties/_form.html.slim +3 -0
- data/app/views/gaku/admin/specialties/_form_fields.html.slim +4 -0
- data/app/views/gaku/admin/specialties/_modal.html.slim +4 -0
- data/app/views/gaku/admin/specialties/_specialty.html.slim +2 -0
- data/app/views/gaku/admin/specialties/create.js.erb +7 -0
- data/app/views/gaku/admin/specialties/destroy.js.erb +2 -0
- data/app/views/gaku/admin/specialties/edit.js.erb +3 -0
- data/app/views/gaku/admin/specialties/index.html.slim +21 -0
- data/app/views/gaku/admin/specialties/new.js.erb +3 -0
- data/app/views/gaku/admin/specialties/update.js.erb +3 -0
- data/app/views/gaku/admin/states/_country_select_form.html.slim +4 -0
- data/app/views/gaku/admin/states/_country_table.html.slim +11 -0
- data/app/views/gaku/admin/states/_fields.html.slim +8 -0
- data/app/views/gaku/admin/states/_form.html.slim +4 -0
- data/app/views/gaku/admin/states/_form_fields.html.slim +14 -0
- data/app/views/gaku/admin/states/_modal.html.slim +4 -0
- data/app/views/gaku/admin/states/_state.html.slim +2 -0
- data/app/views/gaku/admin/states/country_states.js.erb +2 -0
- data/app/views/gaku/admin/states/create.js.erb +7 -0
- data/app/views/gaku/admin/states/destroy.js.erb +2 -0
- data/app/views/gaku/admin/states/edit.js.erb +3 -0
- data/app/views/gaku/admin/states/index.html.slim +15 -0
- data/app/views/gaku/admin/states/new.js.erb +3 -0
- data/app/views/gaku/admin/states/update.js.erb +3 -0
- data/app/views/gaku/admin/system_tools/index.html.slim +1 -0
- data/app/views/gaku/admin/templates/_error_msg.html.slim +8 -0
- data/app/views/gaku/admin/templates/_fields.html.slim +8 -0
- data/app/views/gaku/admin/templates/_form.html.slim +3 -0
- data/app/views/gaku/admin/templates/_form_fields.html.slim +4 -0
- data/app/views/gaku/admin/templates/_modal.html.slim +4 -0
- data/app/views/gaku/admin/templates/_template.html.slim +2 -0
- data/app/views/gaku/admin/templates/destroy.js.erb +2 -0
- data/app/views/gaku/admin/templates/edit.html.slim +1 -0
- data/app/views/gaku/admin/templates/index.html.slim +20 -0
- data/app/views/gaku/admin/templates/new.html.slim +1 -0
- data/app/views/gaku/admin/users/_fields.html.slim +5 -0
- data/app/views/gaku/admin/users/_form.html.slim +3 -0
- data/app/views/gaku/admin/users/_form_fields.html.slim +14 -0
- data/app/views/gaku/admin/users/_modal.html.slim +4 -0
- data/app/views/gaku/admin/users/_user.html.slim +2 -0
- data/app/views/gaku/admin/users/create.js.erb +7 -0
- data/app/views/gaku/admin/users/destroy.js.erb +2 -0
- data/app/views/gaku/admin/users/edit.js.erb +3 -0
- data/app/views/gaku/admin/users/index.html.slim +21 -0
- data/app/views/gaku/admin/users/new.js.erb +3 -0
- data/app/views/gaku/admin/users/update.js.erb +4 -0
- data/app/views/gaku/layouts/admin/edit.html.slim +10 -0
- data/app/views/gaku/layouts/admin/gaku.html.slim +27 -0
- data/app/views/gaku/layouts/admin/index.html.slim +12 -0
- data/app/views/gaku/layouts/admin/show.html.slim +10 -0
- data/app/views/gaku/shared/_delete_link.html.slim +1 -0
- data/app/views/gaku/shared/_delete_modal.html.slim +11 -0
- data/app/views/gaku/shared/_errors.html.slim +6 -0
- data/app/views/gaku/shared/_flash.html.slim +4 -0
- data/app/views/gaku/shared/_language_bar.html.slim +8 -0
- data/app/views/gaku/shared/_login_widget.html.slim +15 -0
- data/app/views/gaku/shared/_manage_buttons.html.slim +4 -0
- data/app/views/gaku/shared/_modal_config.html.slim +37 -0
- data/app/views/gaku/shared/_multi_errors.html.slim +6 -0
- data/app/views/gaku/shared/_picture.html.slim +8 -0
- data/app/views/gaku/shared/_upload_picture.html.slim +7 -0
- data/app/views/gaku/shared/error.js.erb +2 -0
- data/app/views/gaku/shared/menu/_admin.html.erb +71 -0
- data/app/views/gaku/shared/multi_error.js.erb +2 -0
- data/app/views/gaku/shared/notice.js.erb +2 -0
- data/app/views/gaku/states/_no_states_select.html.slim +1 -0
- data/app/views/gaku/states/_states_select.html.slim +1 -0
- data/app/views/gaku/states/index.js.erb +5 -0
- data/config/initializers/client_side_validations.rb +9 -0
- data/config/initializers/wrap_parameters.rb +14 -0
- data/config/routes.rb +67 -0
- data/lib/gaku/admin/engine.rb +30 -0
- data/lib/gaku/admin.rb +31 -0
- data/lib/gaku/app_responder.rb +6 -0
- data/lib/gaku_admin.rb +1 -0
- data/lib/tasks/admin_user.rake +104 -0
- data/lib/tasks/core.rake +65 -0
- data/lib/tasks/reset.rake +37 -0
- metadata +684 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
= content_for :index_header do
|
2
|
+
.pull-left
|
3
|
+
= count_div 'admin-users-count' do
|
4
|
+
= print_count @count, t(:'user.list')
|
5
|
+
.pull-right
|
6
|
+
= ajax_link_to_new t(:'user.add'), [:new, :admin, :user], id: 'new-admin-user-link'
|
7
|
+
|
8
|
+
= content_for :new_form do
|
9
|
+
#new-admin-user.d-none
|
10
|
+
|
11
|
+
#admin-users
|
12
|
+
= table_for 'admin-users-index' do
|
13
|
+
thead
|
14
|
+
tr
|
15
|
+
= th t(:'user.username')
|
16
|
+
= th t(:'user.email')
|
17
|
+
= th_actions 2
|
18
|
+
tbody
|
19
|
+
= render partial: 'gaku/admin/users/user', collection: @users, as: :user
|
20
|
+
|
21
|
+
= paginate @users
|
@@ -0,0 +1,27 @@
|
|
1
|
+
doctype 5
|
2
|
+
html
|
3
|
+
head
|
4
|
+
= favicon_link_tag 'gakuengine20.png'
|
5
|
+
title
|
6
|
+
= content_for?(:title) ? yield(:title) + " | GAKU" : "GAKU"
|
7
|
+
= javascript_tag '$.fx.off = true;' if Rails.env.test?
|
8
|
+
= stylesheet_link_tag "gaku/admin/all"
|
9
|
+
= javascript_include_tag "gaku/admin/all"
|
10
|
+
= csrf_meta_tags
|
11
|
+
body data-action=current_controller_action data-parent-controller=current_parent_controller
|
12
|
+
.container
|
13
|
+
= render 'gaku/shared/modal_config'
|
14
|
+
nav.navbar.navbar-inverse.navbar-fixed-top role="navigation"
|
15
|
+
.navbar-header
|
16
|
+
a.navbar-brand href=root_path = image_tag('gaku-logo.png')
|
17
|
+
- if user_signed_in?
|
18
|
+
= render partial: "gaku/shared/menu/global"
|
19
|
+
= render partial: "gaku/shared/login_widget"
|
20
|
+
#notice
|
21
|
+
- unless flash.empty?
|
22
|
+
= render "gaku/shared/flash", flash: flash
|
23
|
+
#errors
|
24
|
+
|
25
|
+
#modal-dialogs
|
26
|
+
|
27
|
+
= content_for?(:content) ? yield(:content) : yield
|
@@ -0,0 +1 @@
|
|
1
|
+
= ajax_link_to_delete target
|
@@ -0,0 +1,11 @@
|
|
1
|
+
#delete-modal.modal.d-none
|
2
|
+
.modal-dialog
|
3
|
+
.alert-dismissable
|
4
|
+
.panel.panel-danger
|
5
|
+
.panel-heading
|
6
|
+
.panel-title
|
7
|
+
= modal_close_button
|
8
|
+
= t(:confirm_delete)
|
9
|
+
.panel-body
|
10
|
+
.delete_button style='text-align:center'
|
11
|
+
= link_to_delete_with_text(target)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
ul#user_menu.nav.navbar-nav.navbar-right.mr-m
|
2
|
+
- if user_signed_in?
|
3
|
+
li
|
4
|
+
.btn-group.mt-s
|
5
|
+
button.btn.btn-sm.btn-default
|
6
|
+
span.glyphicon.glyphicon-user style="color:#EEA236"
|
7
|
+
= " ".html_safe + current_user.username
|
8
|
+
button#user_menu_dropdown.btn.btn-sm.btn-warning.dropdown-toggle data-toggle="dropdown"
|
9
|
+
span.caret style="border-top-color:white;border-bottom-color:white;"
|
10
|
+
ul.dropdown-menu
|
11
|
+
li= link_to raw('<span class="glyphicon glyphicon-log-out"></span>' + " ".html_safe + t("devise.sessions.sign_out")), destroy_user_session_path, method: :delete
|
12
|
+
li#options
|
13
|
+
a data-toggle="modal" href="#modal-options"
|
14
|
+
span.glyphicon.glyphicon-globe
|
15
|
+
= " ".html_safe + t("config.label")
|
@@ -0,0 +1,4 @@
|
|
1
|
+
/ Using: render 'shared/manage_buttons', target: obj or [obj, obj], id: 'exam_link' #edit- and delete- prefix will be added
|
2
|
+
= link_to_show target, id: "show-#{id}"
|
3
|
+
= link_to_edit [:edit] + [target].flatten, id: "edit-#{id}"
|
4
|
+
= ajax_link_to_delete [target].flatten, id: "delete-#{id}"
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#modal-options.modal.fade
|
2
|
+
.modal-dialog
|
3
|
+
.modal-content
|
4
|
+
.modal-header
|
5
|
+
button.close type="button" data-dismiss="modal"
|
6
|
+
'x
|
7
|
+
h3= t "config.label"
|
8
|
+
.modal-body
|
9
|
+
form role="form"
|
10
|
+
.form-group
|
11
|
+
select#select_lang.form-control
|
12
|
+
option value="ja"
|
13
|
+
| 日本語
|
14
|
+
option value="en"
|
15
|
+
| English
|
16
|
+
p.help-block= t 'config.help.language'
|
17
|
+
|
18
|
+
.d-none
|
19
|
+
#current_lang
|
20
|
+
= I18n.locale
|
21
|
+
#link_langs
|
22
|
+
= link_to "ja", locale: "ja"
|
23
|
+
= link_to "en", locale: "en"
|
24
|
+
|
25
|
+
.modal-footer
|
26
|
+
a.btn.btn-default data-dismiss="modal" href="#" =t("config.close")
|
27
|
+
a.btn.btn-primary id="btn_config_save" href="#" =t("config.save")
|
28
|
+
|
29
|
+
coffee:
|
30
|
+
$("#select_lang").val($("#current_lang").text())
|
31
|
+
$("#btn_config_save").click (e) ->
|
32
|
+
links = $("#link_langs").children()
|
33
|
+
switch $("#select_lang")[0].value
|
34
|
+
when "ja"
|
35
|
+
location.href = links[0].href
|
36
|
+
when "en"
|
37
|
+
location.href = links[1].href
|
@@ -0,0 +1,8 @@
|
|
1
|
+
= image_tag resource.picture.url(:thumb), id: "avatar-picture", class: "img-thumbnail"
|
2
|
+
|
3
|
+
- if can_edit?
|
4
|
+
.row.mt-m
|
5
|
+
.col-md-12
|
6
|
+
= link_to_upload_image 'JavaScript:void(0);', method: :get, id: "upload-picture-link"
|
7
|
+
#upload-picture.d-none
|
8
|
+
= render 'gaku/shared/upload_picture', resource: resource
|
@@ -0,0 +1,71 @@
|
|
1
|
+
<li class="dropdown" data-hook="admin_menu">
|
2
|
+
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
3
|
+
<%= t('menu.admin.admin') %>
|
4
|
+
<b class="caret"></b>
|
5
|
+
</a>
|
6
|
+
<ul class="dropdown-menu" data-hook="admin_dropdown_menu">
|
7
|
+
<li data-hook="school_details"><%= link_to t('menu.admin.school_details'), admin_school_details_path %></li>
|
8
|
+
<li data-hook="schools"><%= link_to t('menu.admin.schools'), admin_schools_path %></li>
|
9
|
+
<li data-hook="school_years"><%= link_to t('menu.admin.school_years'), admin_school_years_path %></li>
|
10
|
+
<li data-hook="specialties"><%= link_to t('menu.admin.specialties'), admin_specialties_path %></li>
|
11
|
+
<li data-hook="badge_types"><%= link_to t('menu.admin.badge_types'), admin_badge_types_path %></li>
|
12
|
+
<li data-hook="template"><%= link_to t('menu.admin.templates'), admin_templates_path %></li>
|
13
|
+
<li data-hook="deparment"><%= link_to t('menu.admin.departments'), admin_departments_path %></li>
|
14
|
+
|
15
|
+
<li class="dropdown-submenu" data-hook="achievements_sub_menu">
|
16
|
+
<a tabindex='-1' href='#'><%= t('menu.admin.achievements.achievements') %></a>
|
17
|
+
<ul class="dropdown-menu">
|
18
|
+
<li data-hook="grading_methods"><%= link_to t('menu.admin.achievements.simple_grade_types'), admin_simple_grade_types_path %></li>
|
19
|
+
</ul>
|
20
|
+
</li>
|
21
|
+
<li class="dropdown-submenu" data-hook="grading_sub_menu">
|
22
|
+
<a tabindex='-1' href='#'><%= t('menu.admin.grading.grading') %></a>
|
23
|
+
<ul class="dropdown-menu">
|
24
|
+
<li data-hook="grading_methods"><%= link_to t('menu.admin.grading.grading_methods'), admin_grading_methods_path %></li>
|
25
|
+
<li data-hook="grading_sets"><%= link_to t('menu.admin.grading.grading_sets'), admin_grading_method_sets_path %></li>
|
26
|
+
</ul>
|
27
|
+
</li>
|
28
|
+
<li class="dropdown-submenu" data-hook="types_sub_menu">
|
29
|
+
<a tabindex='-1' href='#'><%= t('menu.admin.types.types') %></a>
|
30
|
+
<ul class="dropdown-menu">
|
31
|
+
<li data-hook="contact_types"><%= link_to t('menu.admin.types.contact'), admin_contact_types_path %></li>
|
32
|
+
<li data-hook="enrollment_status_types">
|
33
|
+
<%= link_to t('menu.admin.types.enrollment_status'), admin_enrollment_statuses_path %>
|
34
|
+
</li>
|
35
|
+
<li data-hook="commute_method_types">
|
36
|
+
<%= link_to t('menu.admin.types.commute_methods'), admin_commute_method_types_path %>
|
37
|
+
</li>
|
38
|
+
<li data-hook="attendance_types">
|
39
|
+
<%= link_to t('menu.admin.types.attendance_types'), admin_attendance_types_path %>
|
40
|
+
</li>
|
41
|
+
<li data-hook="states">
|
42
|
+
<%= link_to t('menu.admin.types.states'), admin_states_path %>
|
43
|
+
</li>
|
44
|
+
</ul>
|
45
|
+
</li>
|
46
|
+
|
47
|
+
|
48
|
+
<li class="dropdown-submenu" data-hook="users_and_roles_sub_menu">
|
49
|
+
<a tabindex='-1' href='#'><%= t('menu.admin.users.users_and_roles') %></a>
|
50
|
+
<ul class="dropdown-menu">
|
51
|
+
<li data-hook="users"><%= link_to t('menu.admin.users.users'), admin_users_path %></li>
|
52
|
+
<li data-hook="roles">
|
53
|
+
<%= link_to t('menu.admin.users.roles'), admin_roles_path %>
|
54
|
+
</li>
|
55
|
+
</ul>
|
56
|
+
</li>
|
57
|
+
|
58
|
+
<li data-hook="presets"><%= link_to t('menu.admin.preset.plural'), admin_presets_path %></li>
|
59
|
+
|
60
|
+
|
61
|
+
<li class="dropdown-submenu" data-hook="system_tools_sub_menu">
|
62
|
+
<a tabindex='-1' href='#'><%= t('menu.admin.system.system_tools') %></a>
|
63
|
+
<ul class="dropdown-menu">
|
64
|
+
<li data-hook="student_presets"><%= link_to t('menu.admin.system.backup'), admin_system_tools_path %></li>
|
65
|
+
</ul>
|
66
|
+
</li>
|
67
|
+
|
68
|
+
|
69
|
+
</ul>
|
70
|
+
</li>
|
71
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
= collection_select(:address, :state_id, states, :id, :name, {prompt: t(:'address.state.choose') }, disabled: true, class: 'span12')
|
@@ -0,0 +1 @@
|
|
1
|
+
= collection_select(:address, :state_id, states, :id, :name, {prompt: t(:'address.state.choose') }, class: 'span12')
|
@@ -0,0 +1,9 @@
|
|
1
|
+
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
|
2
|
+
unless html_tag =~ /^<label/
|
3
|
+
%{<div class="field_with_errors">#{html_tag}<label for="#{
|
4
|
+
instance.send(:tag_id)}" class="message">#{
|
5
|
+
instance.error_message.first}</label></div>}.html_safe
|
6
|
+
else
|
7
|
+
%{<div class="field_with_errors">#{html_tag}</div>}.html_safe
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
#
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters format: [:json]
|
9
|
+
end
|
10
|
+
|
11
|
+
# Disable root element in JSON by default.
|
12
|
+
ActiveSupport.on_load(:active_record) do
|
13
|
+
self.include_root_in_json = false
|
14
|
+
end
|
data/config/routes.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
Gaku::Core::Engine.routes.draw do
|
2
|
+
|
3
|
+
concern :soft_delete do
|
4
|
+
patch :recovery, on: :member
|
5
|
+
patch :soft_delete, on: :member
|
6
|
+
end
|
7
|
+
|
8
|
+
concern(:primary) { patch :make_primary, on: :member }
|
9
|
+
concern(:pagination) { get 'page/:page', action: :index, on: :collection }
|
10
|
+
concern(:sort) { post :sort, on: :collection }
|
11
|
+
concern(:download) { get :download, on: :member }
|
12
|
+
|
13
|
+
resources :states, only: :index
|
14
|
+
|
15
|
+
namespace :admin do
|
16
|
+
|
17
|
+
get 'school_details', to: 'schools#show_master'
|
18
|
+
get 'school_details/edit', to: 'schools#edit_master'
|
19
|
+
patch 'school_details/update', to: 'schools#update_master'
|
20
|
+
|
21
|
+
resources :schools do
|
22
|
+
resources :programs, controller: 'schools/programs' do
|
23
|
+
member do
|
24
|
+
get :show_program_levels
|
25
|
+
get :show_program_syllabuses
|
26
|
+
get :show_program_specialties
|
27
|
+
end
|
28
|
+
end
|
29
|
+
resources :campuses, controller: 'schools/campuses', except: :index do
|
30
|
+
resources :contacts, controller: 'schools/campuses/contacts', except: %i( show index ), concerns: %i( soft_delete primary )
|
31
|
+
|
32
|
+
resources :addresses, controller: 'schools/campuses/addresses', except: %i( show index )
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
resources :simple_grade_types, controller: 'achievements/simple_grade_types'
|
37
|
+
|
38
|
+
resources :badge_types
|
39
|
+
resources :specialties
|
40
|
+
resources :system_tools
|
41
|
+
resources :commute_method_types
|
42
|
+
resources :contact_types
|
43
|
+
resources :enrollment_statuses
|
44
|
+
resources :attendance_types
|
45
|
+
resources :departments
|
46
|
+
resources :users, concerns: %i( pagination )
|
47
|
+
resources :roles
|
48
|
+
resources :templates, except: %i( show ), concerns: %i( download )
|
49
|
+
resources :grading_methods
|
50
|
+
resources :grading_method_sets, concerns: %i( primary ) do
|
51
|
+
resources :grading_method_set_items,
|
52
|
+
controller: 'grading_method_sets/grading_method_set_items',
|
53
|
+
concerns: %i( sort )
|
54
|
+
end
|
55
|
+
|
56
|
+
resources :states do
|
57
|
+
post :country_states, on: :collection
|
58
|
+
end
|
59
|
+
|
60
|
+
resources :school_years do
|
61
|
+
resources :semesters, controller: 'school_years/semesters', except: %i( show index )
|
62
|
+
end
|
63
|
+
|
64
|
+
resources :presets
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Gaku
|
2
|
+
module Admin
|
3
|
+
class Engine < ::Rails::Engine
|
4
|
+
engine_name 'gaku_admin'
|
5
|
+
|
6
|
+
config.autoload_paths += %W(#{config.root}/lib)
|
7
|
+
|
8
|
+
config.to_prepare do
|
9
|
+
Gaku::Admin::BaseController.helper(Gaku::AdminHelper)
|
10
|
+
end
|
11
|
+
|
12
|
+
config.after_initialize do
|
13
|
+
Rails.application.routes_reloader.reload!
|
14
|
+
end
|
15
|
+
|
16
|
+
# sets the manifests / assets to be precompiled, even when initialize_on_precompile is false
|
17
|
+
initializer 'gaku.assets.precompile', group: :all do |app|
|
18
|
+
app.config.assets.precompile += %w[
|
19
|
+
gaku/admin/all*
|
20
|
+
]
|
21
|
+
end
|
22
|
+
|
23
|
+
# filter sensitive information during logging
|
24
|
+
initializer 'gaku.params.filter' do |app|
|
25
|
+
app.config.filter_parameters += [:password, :password_confirmation, :number]
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/gaku/admin.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rails/all'
|
2
|
+
require 'rails/generators'
|
3
|
+
require 'rails-i18n'
|
4
|
+
require 'coffee_script'
|
5
|
+
require 'slim'
|
6
|
+
require 'responders'
|
7
|
+
require 'jquery-rails'
|
8
|
+
require 'jquery-ui-rails'
|
9
|
+
require 'jquery-minicolors-rails'
|
10
|
+
require 'momentjs-rails'
|
11
|
+
require 'underscore-rails'
|
12
|
+
require 'nprogress-rails'
|
13
|
+
require 'rails4_client_side_validations'
|
14
|
+
require 'sass'
|
15
|
+
require 'bootstrap-sass'
|
16
|
+
require 'bootstrap-datepicker-rails'
|
17
|
+
require 'nested_form'
|
18
|
+
require 'phantom_helpers'
|
19
|
+
require 'phantom_forms'
|
20
|
+
require 'phantom_nested_forms'
|
21
|
+
|
22
|
+
require 'gaku/core'
|
23
|
+
|
24
|
+
module Gaku
|
25
|
+
|
26
|
+
module Admin
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
require 'gaku/admin/engine'
|
data/lib/gaku_admin.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'gaku/admin'
|
@@ -0,0 +1,104 @@
|
|
1
|
+
require 'highline/import'
|
2
|
+
|
3
|
+
namespace :gaku do
|
4
|
+
desc "Create admin username and password"
|
5
|
+
task generate_admin: :environment do
|
6
|
+
|
7
|
+
if Gaku::User.admin.empty?
|
8
|
+
create_admin_user
|
9
|
+
else
|
10
|
+
puts 'Admin user has already been previously created.'
|
11
|
+
if agree('Would you like to create a new admin user? (yes/no)')
|
12
|
+
create_admin_user
|
13
|
+
else
|
14
|
+
puts 'No admin user created.'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def prompt_for_admin_password
|
22
|
+
if ENV['ADMIN_PASSWORD']
|
23
|
+
password = ENV['ADMIN_PASSWORD'].dup
|
24
|
+
say "Admin Password #{password}"
|
25
|
+
else
|
26
|
+
password = ask('Password [123456]: ') do |q|
|
27
|
+
q.echo = false
|
28
|
+
q.validate = /^(|.{5,40})$/
|
29
|
+
q.responses[:not_valid] = 'Invalid password. Must be at least 5 characters long.'
|
30
|
+
q.whitespace = :strip
|
31
|
+
end
|
32
|
+
password = '123456' if password.blank?
|
33
|
+
end
|
34
|
+
|
35
|
+
password
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
def prompt_for_admin_email
|
40
|
+
if ENV['ADMIN_EMAIL']
|
41
|
+
email = ENV['ADMIN_EMAIL'].dup
|
42
|
+
say "Admin User #{email}"
|
43
|
+
else
|
44
|
+
email = ask('Email [admin@gaku-engine.com]: ') do |q|
|
45
|
+
q.echo = true
|
46
|
+
q.whitespace = :strip
|
47
|
+
end
|
48
|
+
email = 'admin@gaku-engine.com' if email.blank?
|
49
|
+
end
|
50
|
+
|
51
|
+
email
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
def prompt_for_admin_username
|
56
|
+
if ENV['ADMIN_USERNAME']
|
57
|
+
username = ENV['ADMIN_USERNAME'].dup
|
58
|
+
say "Admin User #{username}"
|
59
|
+
else
|
60
|
+
username = ask('Username [admin]: ') do |q|
|
61
|
+
q.echo = true
|
62
|
+
q.whitespace = :strip
|
63
|
+
end
|
64
|
+
username = 'admin' if username.blank?
|
65
|
+
end
|
66
|
+
|
67
|
+
username
|
68
|
+
end
|
69
|
+
|
70
|
+
def create_admin_user
|
71
|
+
if ENV['AUTO_ACCEPT']
|
72
|
+
password = '123456'
|
73
|
+
email = 'admin@gaku-engine.com'
|
74
|
+
else
|
75
|
+
puts 'Create the admin user (press enter for defaults).'
|
76
|
+
username = prompt_for_admin_username
|
77
|
+
email = prompt_for_admin_email
|
78
|
+
password = prompt_for_admin_password
|
79
|
+
end
|
80
|
+
attributes = {
|
81
|
+
password: password,
|
82
|
+
password_confirmation: password,
|
83
|
+
email: email,
|
84
|
+
username: username
|
85
|
+
}
|
86
|
+
|
87
|
+
|
88
|
+
if Gaku::User.find_by_email(email)
|
89
|
+
say "\nWARNING: There is already a user with the email: #{email}, so no account changes were made. If you wish to create an additional admin user, please run rake gaku:generate_admin again with a different email.\n\n"
|
90
|
+
elsif Gaku::User.find_by_username(username)
|
91
|
+
say "\nWARNING: There is already a user with the username: #{username}, so no account changes were made. If you wish to create an additional admin user, please run rake gaku:generate_admin again with a different username.\n\n"
|
92
|
+
else
|
93
|
+
say "Creating user..."
|
94
|
+
admin = Gaku::User.create(attributes)
|
95
|
+
# create an admin role and and assign the admin user to that role
|
96
|
+
role = Gaku::Role.find_or_create_by_name 'Admin'
|
97
|
+
admin.roles << role
|
98
|
+
if admin.save
|
99
|
+
say "User Created"
|
100
|
+
else
|
101
|
+
say "User NOT Created"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|