gaku_frontend 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/frontend/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/fonts/gaku/frontend/glyphicons-halflings-regular.svg +228 -0
- data/app/assets/fonts/gaku/frontend/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/fonts/gaku/frontend/glyphicons-halflings-regular.woff +0 -0
- data/app/assets/javascripts/gaku/frontend.js.coffee +42 -0
- data/app/assets/javascripts/gaku/frontend/base.js.coffee +147 -0
- data/app/assets/javascripts/gaku/frontend/class_groups.js.coffee +19 -0
- data/app/assets/javascripts/gaku/frontend/courses.js.coffee +23 -0
- data/app/assets/javascripts/gaku/frontend/exams.js.coffee +23 -0
- data/app/assets/javascripts/gaku/frontend/extracurricular_activities.js.coffee +12 -0
- data/app/assets/javascripts/gaku/frontend/slide.js.erb +14 -0
- data/app/assets/javascripts/gaku/frontend/students.js.coffee +38 -0
- data/app/assets/javascripts/gaku/frontend/syllabuses.js.coffee +23 -0
- data/app/assets/javascripts/gaku/frontend/teachers.js.coffee +12 -0
- data/app/assets/stylesheets/gaku/bootstrap_and_theme.css.scss +573 -0
- data/app/assets/stylesheets/gaku/frontend.css +14 -0
- data/app/assets/stylesheets/gaku/frontend/class_groups.css.scss +19 -0
- data/app/assets/stylesheets/gaku/frontend/course_groups.css.scss +14 -0
- data/app/assets/stylesheets/gaku/frontend/courses.css.scss +19 -0
- data/app/assets/stylesheets/gaku/frontend/exams.css.scss +72 -0
- data/app/assets/stylesheets/gaku/frontend/gaku.css.scss +216 -0
- data/app/assets/stylesheets/gaku/frontend/students.css.scss +22 -0
- data/app/assets/templates/roster.xls +0 -0
- data/app/controllers/concerns/enrollments_controller.rb +83 -0
- data/app/controllers/concerns/polymorphic_resource_concern.rb +48 -0
- data/app/controllers/concerns/student_chooser_controller.rb +41 -0
- data/app/controllers/gaku/addresses_controller.rb +94 -0
- data/app/controllers/gaku/attachments_controller.rb +90 -0
- data/app/controllers/gaku/attendances_controller.rb +28 -0
- data/app/controllers/gaku/class_group_enrollments_controller.rb +15 -0
- data/app/controllers/gaku/class_groups/courses_controller.rb +50 -0
- data/app/controllers/gaku/class_groups/semester_class_groups_controller.rb +63 -0
- data/app/controllers/gaku/class_groups/students_controller.rb +37 -0
- data/app/controllers/gaku/class_groups_controller.rb +120 -0
- data/app/controllers/gaku/contacts_controller.rb +79 -0
- data/app/controllers/gaku/course_enrollments_controller.rb +10 -0
- data/app/controllers/gaku/course_groups/course_group_enrollments_controller.rb +54 -0
- data/app/controllers/gaku/course_groups_controller.rb +91 -0
- data/app/controllers/gaku/courses/enrollments_controller.rb +55 -0
- data/app/controllers/gaku/courses/exams_controller.rb +28 -0
- data/app/controllers/gaku/courses/semester_courses_controller.rb +64 -0
- data/app/controllers/gaku/courses_controller.rb +95 -0
- data/app/controllers/gaku/devise/passwords_controller.rb +4 -0
- data/app/controllers/gaku/devise/registrations_controller.rb +60 -0
- data/app/controllers/gaku/devise/sessions_controller.rb +13 -0
- data/app/controllers/gaku/exam_portion_scores_controller.rb +26 -0
- data/app/controllers/gaku/exams/exam_portions/attachments_controller.rb +46 -0
- data/app/controllers/gaku/exams/exam_portions_controller.rb +76 -0
- data/app/controllers/gaku/exams_controller.rb +153 -0
- data/app/controllers/gaku/extracurricular_activities/students_controller.rb +21 -0
- data/app/controllers/gaku/extracurricular_activities_controller.rb +68 -0
- data/app/controllers/gaku/extracurricular_activity_enrollments_controller.rb +16 -0
- data/app/controllers/gaku/gaku_controller.rb +23 -0
- data/app/controllers/gaku/home_controller.rb +11 -0
- data/app/controllers/gaku/notes_controller.rb +81 -0
- data/app/controllers/gaku/realtime_controller.rb +29 -0
- data/app/controllers/gaku/search_controller.rb +16 -0
- data/app/controllers/gaku/states_controller.rb +17 -0
- data/app/controllers/gaku/students/badges_controller.rb +65 -0
- data/app/controllers/gaku/students/class_group_enrollments_controller.rb +45 -0
- data/app/controllers/gaku/students/course_enrollments_controller.rb +51 -0
- data/app/controllers/gaku/students/external_school_records_controller.rb +70 -0
- data/app/controllers/gaku/students/guardians_controller.rb +70 -0
- data/app/controllers/gaku/students/simple_grades_controller.rb +69 -0
- data/app/controllers/gaku/students/student_specialties_controller.rb +68 -0
- data/app/controllers/gaku/students_controller.rb +198 -0
- data/app/controllers/gaku/syllabuses/assignments_controller.rb +20 -0
- data/app/controllers/gaku/syllabuses/exam_syllabuses_controller.rb +38 -0
- data/app/controllers/gaku/syllabuses/exams_controller.rb +68 -0
- data/app/controllers/gaku/syllabuses_controller.rb +77 -0
- data/app/controllers/gaku/teachers_controller.rb +76 -0
- data/app/helpers/gaku/autocomplete_helper.rb +31 -0
- data/app/helpers/gaku/exam_helper.rb +13 -0
- data/app/helpers/gaku/frontend_helper.rb +42 -0
- data/app/helpers/gaku/person_helper.rb +79 -0
- data/app/helpers/gaku/shared_helper.rb +29 -0
- data/app/helpers/gaku/student_chooser_helper.rb +11 -0
- data/app/helpers/gaku/students_helper.rb +31 -0
- data/app/overrides/frontend_menu.rb +6 -0
- data/app/views/gaku/addresses/_address.html.slim +5 -0
- data/app/views/gaku/addresses/_addresses.html.slim +25 -0
- data/app/views/gaku/addresses/_delete_link.html.slim +1 -0
- data/app/views/gaku/addresses/_fields.html.slim +14 -0
- data/app/views/gaku/addresses/_form.html.slim +3 -0
- data/app/views/gaku/addresses/_form_fields.html.slim +26 -0
- data/app/views/gaku/addresses/_modal.html.slim +4 -0
- data/app/views/gaku/addresses/_primary_field.html.slim +12 -0
- data/app/views/gaku/addresses/create.js.erb +12 -0
- data/app/views/gaku/addresses/destroy.js.erb +8 -0
- data/app/views/gaku/addresses/edit.js.erb +4 -0
- data/app/views/gaku/addresses/make_primary.js.erb +7 -0
- data/app/views/gaku/addresses/new.js.erb +4 -0
- data/app/views/gaku/addresses/recovery.js.erb +1 -0
- data/app/views/gaku/addresses/soft_delete.js.erb +8 -0
- data/app/views/gaku/addresses/update.js.erb +5 -0
- data/app/views/gaku/attachments/destroy.js.erb +1 -0
- data/app/views/gaku/attachments/edit.js.erb +3 -0
- data/app/views/gaku/attachments/new.js.erb +1 -0
- data/app/views/gaku/attachments/recovery.js.erb +1 -0
- data/app/views/gaku/attachments/soft_delete.js.erb +3 -0
- data/app/views/gaku/class_groups/_class_group.html.slim +4 -0
- data/app/views/gaku/class_groups/_class_groups.html.slim +11 -0
- data/app/views/gaku/class_groups/_class_groups_with_semester.html.slim +12 -0
- data/app/views/gaku/class_groups/_fields.html.slim +3 -0
- data/app/views/gaku/class_groups/_form.html.slim +3 -0
- data/app/views/gaku/class_groups/_form_fields.html.slim +7 -0
- data/app/views/gaku/class_groups/_student_chooser_form.html.slim +4 -0
- data/app/views/gaku/class_groups/_tabs.html.slim +41 -0
- data/app/views/gaku/class_groups/advanced_search.js.erb +30 -0
- data/app/views/gaku/class_groups/courses/_course.html.slim +4 -0
- data/app/views/gaku/class_groups/courses/_courses.html.slim +14 -0
- data/app/views/gaku/class_groups/courses/_form.html.slim +5 -0
- data/app/views/gaku/class_groups/courses/create.js.erb +7 -0
- data/app/views/gaku/class_groups/courses/destroy.js.erb +2 -0
- data/app/views/gaku/class_groups/courses/new.js.erb +3 -0
- data/app/views/gaku/class_groups/create.js.erb +6 -0
- data/app/views/gaku/class_groups/destroy.js.erb +1 -0
- data/app/views/gaku/class_groups/edit.html.slim +16 -0
- data/app/views/gaku/class_groups/index.html.slim +25 -0
- data/app/views/gaku/class_groups/new.js.erb +3 -0
- data/app/views/gaku/class_groups/search/_form.html.slim +18 -0
- data/app/views/gaku/class_groups/search/_semester_form.html.slim +23 -0
- data/app/views/gaku/class_groups/semester_advanced_search.js.erb +30 -0
- data/app/views/gaku/class_groups/semester_class_groups/_fields.html.slim +4 -0
- data/app/views/gaku/class_groups/semester_class_groups/_form.html.slim +4 -0
- data/app/views/gaku/class_groups/semester_class_groups/_form_fields.html.slim +3 -0
- data/app/views/gaku/class_groups/semester_class_groups/_modal.html.slim +5 -0
- data/app/views/gaku/class_groups/semester_class_groups/_semester.html.slim +3 -0
- data/app/views/gaku/class_groups/semester_class_groups/_semester_modal.html.slim +4 -0
- data/app/views/gaku/class_groups/semester_class_groups/_semesters.html.slim +13 -0
- data/app/views/gaku/class_groups/semester_class_groups/create.js.erb +8 -0
- data/app/views/gaku/class_groups/semester_class_groups/destroy.js.erb +2 -0
- data/app/views/gaku/class_groups/semester_class_groups/edit.js.erb +3 -0
- data/app/views/gaku/class_groups/semester_class_groups/new.js.erb +3 -0
- data/app/views/gaku/class_groups/semester_class_groups/update.js.erb +3 -0
- data/app/views/gaku/class_groups/student_chooser.js.erb +9 -0
- data/app/views/gaku/class_groups/students/_student.html.slim +5 -0
- data/app/views/gaku/class_groups/students/_students.html.slim +14 -0
- data/app/views/gaku/class_groups/students/destroy.js.erb +2 -0
- data/app/views/gaku/class_groups/students/enroll_students.js.erb +16 -0
- data/app/views/gaku/class_groups/students/new.js.erb +3 -0
- data/app/views/gaku/class_groups/students/without_semester.js.erb +2 -0
- data/app/views/gaku/class_groups/with_semester.html.slim +26 -0
- data/app/views/gaku/class_groups/with_semester.js.erb +2 -0
- data/app/views/gaku/class_groups/without_semester.html.slim +26 -0
- data/app/views/gaku/class_groups/without_semester.js.erb +2 -0
- data/app/views/gaku/contacts/_contact.html.slim +5 -0
- data/app/views/gaku/contacts/_contacts.html.slim +22 -0
- data/app/views/gaku/contacts/_delete_link.html.slim +1 -0
- data/app/views/gaku/contacts/_fields.html.slim +14 -0
- data/app/views/gaku/contacts/_form.html.slim +4 -0
- data/app/views/gaku/contacts/_form_fields.html.slim +14 -0
- data/app/views/gaku/contacts/_modal.html.slim +4 -0
- data/app/views/gaku/contacts/_primary_field.html.slim +13 -0
- data/app/views/gaku/contacts/create.js.erb +21 -0
- data/app/views/gaku/contacts/destroy.js.erb +9 -0
- data/app/views/gaku/contacts/edit.js.erb +4 -0
- data/app/views/gaku/contacts/make_primary.js.erb +6 -0
- data/app/views/gaku/contacts/new.js.erb +3 -0
- data/app/views/gaku/contacts/recovery.js.erb +1 -0
- data/app/views/gaku/contacts/soft_delete.js.erb +8 -0
- data/app/views/gaku/contacts/update.js.erb +14 -0
- data/app/views/gaku/course_groups/_course_group.html.slim +4 -0
- data/app/views/gaku/course_groups/_course_groups.html.slim +7 -0
- data/app/views/gaku/course_groups/_fields.html.slim +1 -0
- data/app/views/gaku/course_groups/_form.html.slim +3 -0
- data/app/views/gaku/course_groups/_form_fields.html.slim +1 -0
- data/app/views/gaku/course_groups/course_group_enrollments/_course.html.slim +4 -0
- data/app/views/gaku/course_groups/course_group_enrollments/_courses.html.slim +21 -0
- data/app/views/gaku/course_groups/course_group_enrollments/_form.html.slim +4 -0
- data/app/views/gaku/course_groups/course_group_enrollments/create.js.erb +7 -0
- data/app/views/gaku/course_groups/course_group_enrollments/destroy.js.erb +2 -0
- data/app/views/gaku/course_groups/course_group_enrollments/new.js.erb +3 -0
- data/app/views/gaku/course_groups/create.js.erb +6 -0
- data/app/views/gaku/course_groups/destroy.js.erb +1 -0
- data/app/views/gaku/course_groups/edit.html.slim +21 -0
- data/app/views/gaku/course_groups/index.html.slim +14 -0
- data/app/views/gaku/course_groups/new.js.erb +3 -0
- data/app/views/gaku/courses/_course.html.slim +7 -0
- data/app/views/gaku/courses/_courses.html.slim +24 -0
- data/app/views/gaku/courses/_form.html.slim +3 -0
- data/app/views/gaku/courses/_form_fields.html.slim +5 -0
- data/app/views/gaku/courses/_student_chooser_form.html.slim +4 -0
- data/app/views/gaku/courses/_tabs.html.slim +26 -0
- data/app/views/gaku/courses/create.js.erb +6 -0
- data/app/views/gaku/courses/destroy.js.erb +1 -0
- data/app/views/gaku/courses/edit.html.slim +16 -0
- data/app/views/gaku/courses/enrollments/_enrolled.html.slim +7 -0
- data/app/views/gaku/courses/enrollments/_enrollments.html.slim +27 -0
- data/app/views/gaku/courses/enrollments/_errors_modal.html.slim +11 -0
- data/app/views/gaku/courses/enrollments/class_groups/_form.html.slim +3 -0
- data/app/views/gaku/courses/enrollments/class_groups/enroll.js.erb +16 -0
- data/app/views/gaku/courses/enrollments/class_groups/new.js.erb +4 -0
- data/app/views/gaku/courses/enrollments/error.js.erb +2 -0
- data/app/views/gaku/courses/enrollments/students/enroll_students.js.erb +11 -0
- data/app/views/gaku/courses/exams/_exam.html.slim +5 -0
- data/app/views/gaku/courses/exams/_exam_portion_head.html.slim +5 -0
- data/app/views/gaku/courses/exams/_exams.html.slim +14 -0
- data/app/views/gaku/courses/exams/_grading_table_head.html.slim +9 -0
- data/app/views/gaku/courses/exams/_grading_table_student_field.html.slim +11 -0
- data/app/views/gaku/courses/exams/grading.html.slim +7 -0
- data/app/views/gaku/courses/index.html.slim +14 -0
- data/app/views/gaku/courses/new.js.erb +3 -0
- data/app/views/gaku/courses/semester_courses/_fields.html.slim +4 -0
- data/app/views/gaku/courses/semester_courses/_form.html.slim +4 -0
- data/app/views/gaku/courses/semester_courses/_form_fields.html.slim +3 -0
- data/app/views/gaku/courses/semester_courses/_modal.html.slim +4 -0
- data/app/views/gaku/courses/semester_courses/_semester_course.html.slim +3 -0
- data/app/views/gaku/courses/semester_courses/_semester_courses.html.slim +16 -0
- data/app/views/gaku/courses/semester_courses/create.js.erb +6 -0
- data/app/views/gaku/courses/semester_courses/destroy.js.erb +3 -0
- data/app/views/gaku/courses/semester_courses/edit.js.erb +3 -0
- data/app/views/gaku/courses/semester_courses/new.js.erb +3 -0
- data/app/views/gaku/courses/semester_courses/update.js.erb +3 -0
- data/app/views/gaku/courses/student_chooser.js.erb +7 -0
- data/app/views/gaku/devise/confirmations/new.html.slim +9 -0
- data/app/views/gaku/devise/mailer/confirmation_instructions.html.slim +4 -0
- data/app/views/gaku/devise/mailer/reset_password_instructions.html.slim +6 -0
- data/app/views/gaku/devise/mailer/unlock_instructions.html.slim +5 -0
- data/app/views/gaku/devise/passwords/edit.html.slim +14 -0
- data/app/views/gaku/devise/passwords/new.html.slim +8 -0
- data/app/views/gaku/devise/registrations/edit.html.slim +31 -0
- data/app/views/gaku/devise/registrations/new.html.slim +27 -0
- data/app/views/gaku/devise/registrations/set_up_admin_account.html.slim +26 -0
- data/app/views/gaku/devise/sessions/new.html.slim +24 -0
- data/app/views/gaku/devise/shared/_links.html.erb +25 -0
- data/app/views/gaku/devise/unlocks/new.html.slim +9 -0
- data/app/views/gaku/exam_divisions/_form.html.erb +29 -0
- data/app/views/gaku/exam_divisions/edit.html.erb +6 -0
- data/app/views/gaku/exam_divisions/index.html.erb +27 -0
- data/app/views/gaku/exam_divisions/new.html.erb +5 -0
- data/app/views/gaku/exam_divisions/show.html.erb +20 -0
- data/app/views/gaku/exams/_exam.html.slim +2 -0
- data/app/views/gaku/exams/_form.html.slim +16 -0
- data/app/views/gaku/exams/_form_fields.html.slim +17 -0
- data/app/views/gaku/exams/_table_fields.html.slim +8 -0
- data/app/views/gaku/exams/_tabs.html.slim +15 -0
- data/app/views/gaku/exams/_weight_check_widget.html.slim +20 -0
- data/app/views/gaku/exams/create.js.erb +6 -0
- data/app/views/gaku/exams/destroy.js.erb +1 -0
- data/app/views/gaku/exams/edit.html.slim +16 -0
- data/app/views/gaku/exams/exam_portions/_custom_exam_portion_error.html.slim +4 -0
- data/app/views/gaku/exams/exam_portions/_exam_portion.html.slim +2 -0
- data/app/views/gaku/exams/exam_portions/_exam_portion_weight_td.html.slim +3 -0
- data/app/views/gaku/exams/exam_portions/_exam_portions.html.slim +27 -0
- data/app/views/gaku/exams/exam_portions/_form.html.slim +3 -0
- data/app/views/gaku/exams/exam_portions/_table_fields.slim +8 -0
- data/app/views/gaku/exams/exam_portions/_tabs.html.slim +11 -0
- data/app/views/gaku/exams/exam_portions/attachments/_attachment.html.slim +2 -0
- data/app/views/gaku/exams/exam_portions/attachments/_attachments.html.slim +20 -0
- data/app/views/gaku/exams/exam_portions/attachments/_form.html.slim +3 -0
- data/app/views/gaku/exams/exam_portions/attachments/_form_fields.html.slim +3 -0
- data/app/views/gaku/exams/exam_portions/attachments/_modal.html.slim +4 -0
- data/app/views/gaku/exams/exam_portions/attachments/create.js.erb +0 -0
- data/app/views/gaku/exams/exam_portions/attachments/new.js.erb +3 -0
- data/app/views/gaku/exams/exam_portions/create.js.erb +49 -0
- data/app/views/gaku/exams/exam_portions/destroy.js.erb +8 -0
- data/app/views/gaku/exams/exam_portions/edit.html.slim +16 -0
- data/app/views/gaku/exams/exam_portions/new.js.erb +3 -0
- data/app/views/gaku/exams/exam_portions/show.html.slim +30 -0
- data/app/views/gaku/exams/export.xls.rb +67 -0
- data/app/views/gaku/exams/index.html.slim +24 -0
- data/app/views/gaku/exams/new.js.erb +3 -0
- data/app/views/gaku/exams/show.html.slim +28 -0
- data/app/views/gaku/extracurricular_activities/_extracurricular_activities.html.slim +7 -0
- data/app/views/gaku/extracurricular_activities/_extracurricular_activity.html.slim +4 -0
- data/app/views/gaku/extracurricular_activities/_fields.html.slim +1 -0
- data/app/views/gaku/extracurricular_activities/_form.html.slim +3 -0
- data/app/views/gaku/extracurricular_activities/_form_fields.html.slim +3 -0
- data/app/views/gaku/extracurricular_activities/_student_chooser_form.html.slim +4 -0
- data/app/views/gaku/extracurricular_activities/_tabs.html.slim +15 -0
- data/app/views/gaku/extracurricular_activities/create.js.erb +6 -0
- data/app/views/gaku/extracurricular_activities/destroy.js.erb +2 -0
- data/app/views/gaku/extracurricular_activities/edit.html.slim +16 -0
- data/app/views/gaku/extracurricular_activities/index.html.slim +15 -0
- data/app/views/gaku/extracurricular_activities/new.js.erb +3 -0
- data/app/views/gaku/extracurricular_activities/student_chooser.js.erb +9 -0
- data/app/views/gaku/extracurricular_activities/students/_student.html.slim +5 -0
- data/app/views/gaku/extracurricular_activities/students/_students.html.slim +16 -0
- data/app/views/gaku/extracurricular_activities/students/destroy.js.erb +3 -0
- data/app/views/gaku/extracurricular_activities/students/enroll_students.js.erb +11 -0
- data/app/views/gaku/home/_user_info.html.slim +7 -0
- data/app/views/gaku/home/_user_menu.html.slim +4 -0
- data/app/views/gaku/home/index.html.slim +10 -0
- data/app/views/gaku/layouts/edit.html.slim +10 -0
- data/app/views/gaku/layouts/gaku.html.slim +22 -0
- data/app/views/gaku/layouts/home.html.slim +1 -0
- data/app/views/gaku/layouts/index.html.slim +12 -0
- data/app/views/gaku/layouts/show.html.slim +10 -0
- data/app/views/gaku/notes/_buttons.html.slim +8 -0
- data/app/views/gaku/notes/_fields.html.slim +2 -0
- data/app/views/gaku/notes/_form.html.slim +6 -0
- data/app/views/gaku/notes/_form_fields.html.slim +6 -0
- data/app/views/gaku/notes/_modal.html.slim +4 -0
- data/app/views/gaku/notes/_note.html.slim +4 -0
- data/app/views/gaku/notes/_notes.html.slim +21 -0
- data/app/views/gaku/notes/_show_modal.html.slim +4 -0
- data/app/views/gaku/notes/create.js.erb +11 -0
- data/app/views/gaku/notes/destroy.js.erb +4 -0
- data/app/views/gaku/notes/edit.js.erb +3 -0
- data/app/views/gaku/notes/new.js.erb +3 -0
- data/app/views/gaku/notes/show.js.erb +2 -0
- data/app/views/gaku/notes/update.js.erb +4 -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/_external_school_record.html.slim +36 -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/_menubar.html.slim +7 -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/fields/_address_and_contact_show_table.html.slim +6 -0
- data/app/views/gaku/shared/fields/_attachment_fields.html.slim +10 -0
- data/app/views/gaku/shared/fields/_course_fields.html.slim +4 -0
- data/app/views/gaku/shared/fields/_course_show_fields.html.slim +3 -0
- data/app/views/gaku/shared/fields/_exam_portion_fields.html.slim +7 -0
- data/app/views/gaku/shared/fields/_person_edit_table.html.slim +7 -0
- data/app/views/gaku/shared/fields/_person_show_table.html.slim +15 -0
- data/app/views/gaku/shared/fields/_semester_fields.html.slim +1 -0
- data/app/views/gaku/shared/form_fields/_exam_portion_form_fields.html.slim +14 -0
- data/app/views/gaku/shared/form_fields/_person_form_fields.html.slim +17 -0
- data/app/views/gaku/shared/menu/_frontend.html.erb +22 -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/shared/overrides/students/_import_link.html.slim +0 -0
- data/app/views/gaku/shared/overrides/syllabuses/_import_link.html.slim +0 -0
- data/app/views/gaku/shared/student/_show.html.slim +12 -0
- data/app/views/gaku/shared/student_chooser/_chooser.html.slim +7 -0
- data/app/views/gaku/shared/student_chooser/_chooser_widget.html.slim +10 -0
- data/app/views/gaku/shared/student_chooser/_modal.html.slim +3 -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/app/views/gaku/students/_academic.html.slim +18 -0
- data/app/views/gaku/students/_chooser_widget.html.slim +14 -0
- data/app/views/gaku/students/_form.html.slim +3 -0
- data/app/views/gaku/students/_form_fields.html.slim +25 -0
- data/app/views/gaku/students/_personal.html.slim +3 -0
- data/app/views/gaku/students/_student.html.slim +5 -0
- data/app/views/gaku/students/_student_chooser_form.html.slim +16 -0
- data/app/views/gaku/students/_student_unit.html.slim +5 -0
- data/app/views/gaku/students/_students.html.slim +62 -0
- data/app/views/gaku/students/_table_fields.html.slim +63 -0
- data/app/views/gaku/students/_tabs.html.slim +48 -0
- data/app/views/gaku/students/_tabs_academic.html.slim +40 -0
- data/app/views/gaku/students/_tabs_personal.html.slim +27 -0
- data/app/views/gaku/students/advanced_search.js.erb +66 -0
- data/app/views/gaku/students/badges/_badge.html.slim +2 -0
- data/app/views/gaku/students/badges/_badge_type.html.slim +5 -0
- data/app/views/gaku/students/badges/_badges.html.slim +2 -0
- data/app/views/gaku/students/badges/_badges_tab.html.slim +8 -0
- data/app/views/gaku/students/badges/_edit.html.slim +8 -0
- data/app/views/gaku/students/badges/_fields.html.slim +8 -0
- data/app/views/gaku/students/badges/_form.html.slim +3 -0
- data/app/views/gaku/students/badges/_form_fields.html.slim +1 -0
- data/app/views/gaku/students/badges/_index.html.slim +20 -0
- data/app/views/gaku/students/badges/_index_modal.html.slim +4 -0
- data/app/views/gaku/students/badges/create.js.erb +14 -0
- data/app/views/gaku/students/badges/destroy.js.erb +6 -0
- data/app/views/gaku/students/badges/edit.js.erb +2 -0
- data/app/views/gaku/students/badges/index.js.erb +3 -0
- data/app/views/gaku/students/badges/new.js.erb +3 -0
- data/app/views/gaku/students/badges/update.js.erb +5 -0
- data/app/views/gaku/students/chosen.js.erb +12 -0
- data/app/views/gaku/students/class_group_enrollments/_new_modal.html.slim +28 -0
- data/app/views/gaku/students/class_group_enrollments/create.js.erb +11 -0
- data/app/views/gaku/students/class_group_enrollments/new.js.erb +2 -0
- data/app/views/gaku/students/course_enrollments/_course_enrollment.html.slim +4 -0
- data/app/views/gaku/students/course_enrollments/_course_enrollments.html.slim +17 -0
- data/app/views/gaku/students/course_enrollments/_errors_modal.html.slim +11 -0
- data/app/views/gaku/students/course_enrollments/_form.html.slim +4 -0
- data/app/views/gaku/students/course_enrollments/create.js.erb +9 -0
- data/app/views/gaku/students/course_enrollments/destroy.js.erb +3 -0
- data/app/views/gaku/students/course_enrollments/error.js.erb +2 -0
- data/app/views/gaku/students/course_enrollments/new.js.erb +3 -0
- data/app/views/gaku/students/create.js.erb +8 -0
- data/app/views/gaku/students/destroy.js.erb +2 -0
- data/app/views/gaku/students/edit.html.slim +37 -0
- data/app/views/gaku/students/external_school_records/_external_school_record.html.slim +2 -0
- data/app/views/gaku/students/external_school_records/_external_school_records.html.slim +24 -0
- data/app/views/gaku/students/external_school_records/_fields.html.slim +11 -0
- data/app/views/gaku/students/external_school_records/_form.html.slim +3 -0
- data/app/views/gaku/students/external_school_records/_form_fields.html.slim +17 -0
- data/app/views/gaku/students/external_school_records/_modal.html.slim +4 -0
- data/app/views/gaku/students/external_school_records/create.js.erb +8 -0
- data/app/views/gaku/students/external_school_records/destroy.js.erb +3 -0
- data/app/views/gaku/students/external_school_records/edit.js.erb +4 -0
- data/app/views/gaku/students/external_school_records/new.js.erb +4 -0
- data/app/views/gaku/students/external_school_records/update.js.erb +3 -0
- data/app/views/gaku/students/guardians/_delete_modal.html.slim +12 -0
- data/app/views/gaku/students/guardians/_form.html.slim +3 -0
- data/app/views/gaku/students/guardians/_form_fields.html.slim +4 -0
- data/app/views/gaku/students/guardians/_guardian.html.slim +12 -0
- data/app/views/gaku/students/guardians/_guardians.html.slim +24 -0
- data/app/views/gaku/students/guardians/_picture.html.slim +8 -0
- data/app/views/gaku/students/guardians/_tabs.html.slim +14 -0
- data/app/views/gaku/students/guardians/_upload_picture.html.slim +7 -0
- data/app/views/gaku/students/guardians/create.js.erb +7 -0
- data/app/views/gaku/students/guardians/destroy.js.erb +1 -0
- data/app/views/gaku/students/guardians/edit.html.slim +21 -0
- data/app/views/gaku/students/guardians/new.js.erb +3 -0
- data/app/views/gaku/students/guardians/recovery.js.erb +1 -0
- data/app/views/gaku/students/guardians/show.html.slim +17 -0
- data/app/views/gaku/students/importer/index.html.slim +26 -0
- data/app/views/gaku/students/index.html.slim +22 -0
- data/app/views/gaku/students/index.js.erb +2 -0
- data/app/views/gaku/students/new.html.slim +3 -0
- data/app/views/gaku/students/new.js.erb +3 -0
- data/app/views/gaku/students/search/_academic.html.slim +22 -0
- data/app/views/gaku/students/search/_address.html.slim +34 -0
- data/app/views/gaku/students/search/_advanced_form.html.slim +36 -0
- data/app/views/gaku/students/search/_extended.slim +108 -0
- data/app/views/gaku/students/search/_form.html.slim +8 -0
- data/app/views/gaku/students/search/_student.html.slim +36 -0
- data/app/views/gaku/students/show.html.slim +24 -0
- data/app/views/gaku/students/simple_grades/_edit.html.slim +8 -0
- data/app/views/gaku/students/simple_grades/_fields.html.slim +8 -0
- data/app/views/gaku/students/simple_grades/_form.html.slim +3 -0
- data/app/views/gaku/students/simple_grades/_form_fields.html.slim +3 -0
- data/app/views/gaku/students/simple_grades/_index.html.slim +21 -0
- data/app/views/gaku/students/simple_grades/_index_modal.html.slim +4 -0
- data/app/views/gaku/students/simple_grades/_simple_grade.html.slim +2 -0
- data/app/views/gaku/students/simple_grades/_simple_grades.html.slim +2 -0
- data/app/views/gaku/students/simple_grades/create.js.erb +10 -0
- data/app/views/gaku/students/simple_grades/destroy.js.erb +4 -0
- data/app/views/gaku/students/simple_grades/edit.js.erb +4 -0
- data/app/views/gaku/students/simple_grades/index.js.erb +5 -0
- data/app/views/gaku/students/simple_grades/new.js.erb +6 -0
- data/app/views/gaku/students/simple_grades/update.js.erb +4 -0
- data/app/views/gaku/students/student_specialties/_edit.html.slim +8 -0
- data/app/views/gaku/students/student_specialties/_fields.html.slim +5 -0
- data/app/views/gaku/students/student_specialties/_form.html.slim +3 -0
- data/app/views/gaku/students/student_specialties/_form_fields.html.slim +2 -0
- data/app/views/gaku/students/student_specialties/_index.html.slim +18 -0
- data/app/views/gaku/students/student_specialties/_index_modal.html.slim +4 -0
- data/app/views/gaku/students/student_specialties/_student_specialties.html.slim +2 -0
- data/app/views/gaku/students/student_specialties/_student_specialty.html.slim +2 -0
- data/app/views/gaku/students/student_specialties/create.js.erb +10 -0
- data/app/views/gaku/students/student_specialties/destroy.js.erb +4 -0
- data/app/views/gaku/students/student_specialties/edit.js.erb +2 -0
- data/app/views/gaku/students/student_specialties/index.js.erb +5 -0
- data/app/views/gaku/students/student_specialties/new.js.erb +3 -0
- data/app/views/gaku/students/student_specialties/update.js.erb +4 -0
- data/app/views/gaku/syllabuses/_all_exams.html.slim +14 -0
- data/app/views/gaku/syllabuses/_fields.html.slim +7 -0
- data/app/views/gaku/syllabuses/_form.html.slim +3 -0
- data/app/views/gaku/syllabuses/_form_fields.html.slim +12 -0
- data/app/views/gaku/syllabuses/_syllabus.html.slim +2 -0
- data/app/views/gaku/syllabuses/_syllabuses.html.slim +12 -0
- data/app/views/gaku/syllabuses/_tabs.html.slim +16 -0
- data/app/views/gaku/syllabuses/create.js.erb +7 -0
- data/app/views/gaku/syllabuses/destroy.js.erb +1 -0
- data/app/views/gaku/syllabuses/edit.html.slim +16 -0
- data/app/views/gaku/syllabuses/exam_syllabuses/create.js.erb +12 -0
- data/app/views/gaku/syllabuses/exam_syllabuses/destroy.js.erb +5 -0
- data/app/views/gaku/syllabuses/exams/_exam.html.slim +3 -0
- data/app/views/gaku/syllabuses/exams/_exams.html.slim +13 -0
- data/app/views/gaku/syllabuses/exams/_fields.html.slim +10 -0
- data/app/views/gaku/syllabuses/exams/_form.html.slim +17 -0
- data/app/views/gaku/syllabuses/exams/_form_fields.html.slim +10 -0
- data/app/views/gaku/syllabuses/exams/_modal.html.slim +4 -0
- data/app/views/gaku/syllabuses/exams/_select_form.html.slim +6 -0
- data/app/views/gaku/syllabuses/exams/create.js.erb +9 -0
- data/app/views/gaku/syllabuses/exams/destroy.js.erb +3 -0
- data/app/views/gaku/syllabuses/exams/edit.js.erb +3 -0
- data/app/views/gaku/syllabuses/exams/new.js.erb +3 -0
- data/app/views/gaku/syllabuses/exams/update.js.erb +4 -0
- data/app/views/gaku/syllabuses/importer/index.html.slim +14 -0
- data/app/views/gaku/syllabuses/index.html.slim +14 -0
- data/app/views/gaku/syllabuses/new.js.erb +3 -0
- data/app/views/gaku/teachers/_fields.html.slim +5 -0
- data/app/views/gaku/teachers/_form.html.slim +3 -0
- data/app/views/gaku/teachers/_form_fields.html.slim +1 -0
- data/app/views/gaku/teachers/_tabs.html.slim +20 -0
- data/app/views/gaku/teachers/_teacher.html.slim +5 -0
- data/app/views/gaku/teachers/_teachers.html.slim +11 -0
- data/app/views/gaku/teachers/create.js.erb +8 -0
- data/app/views/gaku/teachers/destroy.js.erb +1 -0
- data/app/views/gaku/teachers/edit.html.slim +19 -0
- data/app/views/gaku/teachers/index.html.slim +16 -0
- data/app/views/gaku/teachers/new.js.erb +3 -0
- data/app/views/gaku/teachers/show.html.slim +13 -0
- data/app/views/kaminari/_first_page.html.erb +11 -0
- data/app/views/kaminari/_gap.html.erb +8 -0
- data/app/views/kaminari/_last_page.html.erb +11 -0
- data/app/views/kaminari/_next_page.html.erb +11 -0
- data/app/views/kaminari/_page.html.erb +12 -0
- data/app/views/kaminari/_paginator.html.erb +27 -0
- data/app/views/kaminari/_prev_page.html.erb +11 -0
- data/config/initializers/client_side_validations.rb +9 -0
- data/config/initializers/wrap_parameters.rb +14 -0
- data/config/routes.rb +137 -0
- data/lib/gaku/app_responder.rb +6 -0
- data/lib/gaku/class_name_detector.rb +23 -0
- data/lib/gaku/frontend.rb +33 -0
- data/lib/gaku/frontend/engine.rb +30 -0
- data/lib/gaku_frontend.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 +848 -0
@@ -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,137 @@
|
|
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 :addresses do
|
9
|
+
resources :addresses, concerns: %i( soft_delete primary ), except: %i( show index )
|
10
|
+
end
|
11
|
+
|
12
|
+
concern :contacts do
|
13
|
+
resources :contacts, concerns: %i( soft_delete primary )
|
14
|
+
end
|
15
|
+
|
16
|
+
concern :notes do
|
17
|
+
resources :notes
|
18
|
+
end
|
19
|
+
|
20
|
+
concern(:primary) { patch :make_primary, on: :member }
|
21
|
+
concern(:show_deleted) { get :show_deleted, on: :member }
|
22
|
+
concern(:pagination) { get 'page/:page', action: :index, on: :collection }
|
23
|
+
concern(:sort) { post :sort, on: :collection }
|
24
|
+
concern(:download) { get :download, on: :member }
|
25
|
+
concern(:enroll_students) { post :enroll_students, on: :collection }
|
26
|
+
concern(:enroll_student) { post :enroll_student, on: :collection }
|
27
|
+
concern(:student_chooser) { get :student_chooser, on: :member }
|
28
|
+
|
29
|
+
|
30
|
+
devise_scope :user do
|
31
|
+
get :set_up_admin_account, to: 'devise/registrations#set_up_admin_account'
|
32
|
+
post :create_admin, to: 'devise/registrations#create_admin'
|
33
|
+
end
|
34
|
+
|
35
|
+
resources :extracurricular_activities, concerns: %i( student_chooser pagination ) do
|
36
|
+
resources :students,
|
37
|
+
controller: 'extracurricular_activities/students',
|
38
|
+
concerns: %i( enroll_student )
|
39
|
+
end
|
40
|
+
|
41
|
+
resources :class_groups, concerns: %i( notes student_chooser pagination ) do
|
42
|
+
collection do
|
43
|
+
get :search
|
44
|
+
get :search_semester
|
45
|
+
get :advanced_search
|
46
|
+
get :semester_advanced_search
|
47
|
+
get :with_semester
|
48
|
+
get :without_semester
|
49
|
+
end
|
50
|
+
resources :semester_class_groups, controller: 'class_groups/semester_class_groups'
|
51
|
+
resources :class_group_course_enrollments, controller: 'class_groups/courses', only: %i( new create destroy )
|
52
|
+
resources :students, controller: 'class_groups/students', only: %i( new destroy ), concerns: %i( enroll_student )
|
53
|
+
end
|
54
|
+
|
55
|
+
resources :courses, concerns: %i( notes student_chooser ) do
|
56
|
+
resources :semester_courses, controller: 'courses/semester_courses'
|
57
|
+
resources :enrollments, controller: 'courses/enrollments', concerns: %i( enroll_student ) do
|
58
|
+
post :enroll_class_group, on: :collection
|
59
|
+
end
|
60
|
+
|
61
|
+
resources :exams, controller: 'courses/exams' do
|
62
|
+
resources :exam_portion_scores do
|
63
|
+
resources :attendances
|
64
|
+
end
|
65
|
+
|
66
|
+
collection do
|
67
|
+
get :grading
|
68
|
+
get :export
|
69
|
+
end
|
70
|
+
|
71
|
+
member do
|
72
|
+
get :grading
|
73
|
+
put :update_score
|
74
|
+
get :completed
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
resources :class_group_enrollments, concerns: %i( enroll_students )
|
80
|
+
resources :course_enrollments, concerns: %i( enroll_students )
|
81
|
+
resources :extracurricular_activity_enrollments, concerns: %i( enroll_students )
|
82
|
+
|
83
|
+
resources :syllabuses, concerns: %i( notes ) do
|
84
|
+
resources :assignments, controller: 'syllabuses/assignments'
|
85
|
+
resources :exams, controller: 'syllabuses/exams'
|
86
|
+
resources :exam_syllabuses, controller: 'syllabuses/exam_syllabuses'
|
87
|
+
end
|
88
|
+
|
89
|
+
resources :teachers, concerns: %i( addresses contacts notes show_deleted pagination )
|
90
|
+
|
91
|
+
resources :students, concerns: %i( addresses contacts notes pagination ) do
|
92
|
+
get :search, on: :collection
|
93
|
+
get :clear_search, on: :collection
|
94
|
+
get :advanced_search, on: :collection
|
95
|
+
get :chosen, on: :collection
|
96
|
+
resources :simple_grades, controller: 'students/simple_grades', except: :show
|
97
|
+
resources :commute_methods, controller: 'students/commute_methods'
|
98
|
+
resources :badges, controller: 'students/badges', except: :show
|
99
|
+
resources :student_specialties, controller: 'students/student_specialties', except: :show
|
100
|
+
resources :external_school_records, controller: 'students/external_school_records', except: :show
|
101
|
+
|
102
|
+
resources :guardians, except: %i( index show ),
|
103
|
+
controller: 'students/guardians',
|
104
|
+
concerns: %i( addresses contacts )
|
105
|
+
|
106
|
+
resources :course_enrollments,
|
107
|
+
controller: 'students/course_enrollments',
|
108
|
+
only: %i( new create destroy )
|
109
|
+
|
110
|
+
resources :class_group_enrollments, controller: 'students/class_group_enrollments'
|
111
|
+
end
|
112
|
+
|
113
|
+
resources :exams, concerns: %i( notes pagination ) do
|
114
|
+
put :create_exam_portion, on: :member
|
115
|
+
|
116
|
+
resources :exam_scores
|
117
|
+
resources :exam_portions, controller: 'exams/exam_portions', concerns: %i( sort ) do
|
118
|
+
resources :attachments, controller: 'exams/exam_portions/attachments'
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
resources :attachments, concerns: %i( download )
|
123
|
+
|
124
|
+
resources :course_groups do
|
125
|
+
resources :course_group_enrollments, controller: 'course_groups/course_group_enrollments'
|
126
|
+
end
|
127
|
+
|
128
|
+
resources :search, only: :index do
|
129
|
+
collection do
|
130
|
+
get :students
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
get 'realtime/exam_portion_scores', to: 'realtime#exam_portion_scores'
|
135
|
+
|
136
|
+
|
137
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Gaku::ClassNameDetector
|
2
|
+
|
3
|
+
def class_name
|
4
|
+
"Gaku::#{controller_name.classify}"
|
5
|
+
end
|
6
|
+
|
7
|
+
def class_name_minus_enrollment
|
8
|
+
"Gaku::#{controller_name.classify.split('Enrollment').first}"
|
9
|
+
end
|
10
|
+
|
11
|
+
def class_name_underscored
|
12
|
+
controller_name.classify.split('Enrollment').first.underscore
|
13
|
+
end
|
14
|
+
|
15
|
+
def class_name_underscored_plural
|
16
|
+
class_name_underscored.pluralize
|
17
|
+
end
|
18
|
+
|
19
|
+
def enrollment_param
|
20
|
+
"#{controller_name.classify.split('Enrollment').first.underscore}_id"
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,33 @@
|
|
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 'kaminari'
|
14
|
+
require 'rails4_client_side_validations'
|
15
|
+
require 'sass'
|
16
|
+
require 'bootstrap-sass'
|
17
|
+
require 'bootstrap-datepicker-rails'
|
18
|
+
require 'nested_form'
|
19
|
+
require 'phantom_helpers'
|
20
|
+
require 'phantom_forms'
|
21
|
+
require 'phantom_nested_forms'
|
22
|
+
require 'select2-rails'
|
23
|
+
|
24
|
+
require 'gaku/core'
|
25
|
+
|
26
|
+
module Gaku
|
27
|
+
|
28
|
+
module Frontend
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
require 'gaku/frontend/engine'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Gaku
|
2
|
+
module Frontend
|
3
|
+
class Engine < ::Rails::Engine
|
4
|
+
engine_name 'gaku_frontend'
|
5
|
+
|
6
|
+
config.autoload_paths += %W(#{config.root}/lib)
|
7
|
+
|
8
|
+
config.to_prepare do
|
9
|
+
Gaku::GakuController.helper(Gaku::FrontendHelper)
|
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/frontend/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
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'gaku/frontend'
|
@@ -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
|
data/lib/tasks/core.rake
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'active_record/fixtures'
|
2
|
+
|
3
|
+
namespace :db do
|
4
|
+
desc %q{Loads a specified fixture file:
|
5
|
+
For .yml use rake db:load_file[gaku/filename.yml,/absolute/path/to/parent/]
|
6
|
+
For .rb use rake db:load_file[/absolute/path/to/sample/filename.rb]}
|
7
|
+
|
8
|
+
task :load_file , [:file, :dir] => :environment do |t, args|
|
9
|
+
file = Pathname.new(args.file)
|
10
|
+
|
11
|
+
if %w{.yml}.include? file.extname
|
12
|
+
puts "#{File.basename(args.file)}".green
|
13
|
+
ActiveRecord::Fixtures.create_fixtures(args.dir, file.to_s.sub(file.extname, ""))
|
14
|
+
elsif file.exist?
|
15
|
+
puts "#{File.basename(file)}".green
|
16
|
+
require file
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "Loads fixtures from the the dir you specify using rake db:load_dir[loadfrom]"
|
21
|
+
task :load_dir , [:dir] => :environment do |t , args|
|
22
|
+
dir = args.dir
|
23
|
+
dir = File.join(Rails.root, "db", dir) if Pathname.new(dir).relative?
|
24
|
+
|
25
|
+
fixtures = ActiveSupport::OrderedHash.new
|
26
|
+
ruby_files = ActiveSupport::OrderedHash.new
|
27
|
+
Dir.glob(File.join(dir , '**/*.{yml,csv,rb}')).each do |fixture_file|
|
28
|
+
ext = File.extname fixture_file
|
29
|
+
if ext == ".rb"
|
30
|
+
ruby_files[File.basename(fixture_file, '.*')] = fixture_file
|
31
|
+
else
|
32
|
+
fixtures[fixture_file.sub(dir, "")[1..-1]] = fixture_file
|
33
|
+
end
|
34
|
+
end
|
35
|
+
fixtures.sort.each do |relative_path , fixture_file|
|
36
|
+
# an invoke will only execute the task once
|
37
|
+
Rake::Task["db:load_file"].execute( Rake::TaskArguments.new([:file, :dir], [relative_path, dir]) )
|
38
|
+
end
|
39
|
+
ruby_files.sort.each do |fixture , ruby_file|
|
40
|
+
# an invoke will only execute the task once
|
41
|
+
Rake::Task["db:load_file"].execute( Rake::TaskArguments.new([:file], [ruby_file]) )
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
desc "Migrate schema to version 0 and back up again. WARNING: Destroys all data in tables!!"
|
46
|
+
task remigrate: :environment do
|
47
|
+
require 'highline/import'
|
48
|
+
|
49
|
+
if ENV['SKIP_NAG'] or ENV['OVERWRITE'].to_s.downcase == 'true' or agree("This task will destroy any data in the database. Are you sure you want to \ncontinue? [y/n] ")
|
50
|
+
|
51
|
+
# Drop all tables
|
52
|
+
ActiveRecord::Base.connection.tables.each { |t| ActiveRecord::Base.connection.drop_table t }
|
53
|
+
|
54
|
+
# Migrate upward
|
55
|
+
Rake::Task["db:migrate"].invoke
|
56
|
+
|
57
|
+
# Dump the schema
|
58
|
+
Rake::Task["db:schema:dump"].invoke
|
59
|
+
else
|
60
|
+
say "Task cancelled."
|
61
|
+
exit
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'highline/import'
|
2
|
+
|
3
|
+
namespace :gaku do
|
4
|
+
namespace :db do
|
5
|
+
|
6
|
+
desc "!!! Reset DB and delete migrations !!!"
|
7
|
+
task reset: :environment do
|
8
|
+
say "!!! Reset DB and delete migrations !!!"
|
9
|
+
|
10
|
+
dir = "#{Rails.root}/db/migrate"
|
11
|
+
FileUtils.rm_rf("#{dir}/.", secure: true)
|
12
|
+
say "Migrations deleted!"
|
13
|
+
|
14
|
+
Rake::Task["db:drop"].invoke
|
15
|
+
say "Database dropped!"
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
desc "Reset db + delete migrations and run generator + load sample data"
|
22
|
+
task reset_app: :environment do
|
23
|
+
unless Rails.env.production?
|
24
|
+
say "rake db:drop"
|
25
|
+
Rake::Task["db:drop"].invoke
|
26
|
+
|
27
|
+
say "rake db:create"
|
28
|
+
Rake::Task["db:create"].invoke
|
29
|
+
|
30
|
+
say "rails g gaku:install"
|
31
|
+
system('rails g gaku:install')
|
32
|
+
|
33
|
+
#say "rake gaku:sample:load"
|
34
|
+
#Rake::Task["gaku:sample:load"].invoke
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|