gaku 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -4
- data/VERSION +1 -1
- data/core/app/controllers/concerns/enrollments_controller.rb +1 -2
- data/core/app/controllers/gaku/contacts_controller.rb +3 -3
- data/core/app/controllers/gaku/notes_controller.rb +33 -24
- data/core/app/controllers/gaku/syllabuses_controller.rb +44 -16
- data/core/app/models/gaku/address.rb +1 -1
- data/core/app/models/gaku/class_group_enrollment.rb +4 -3
- data/core/app/models/gaku/contact.rb +2 -2
- data/core/app/models/gaku/grading_method_set.rb +1 -1
- data/core/app/views/gaku/class_groups/students/enroll_students.js.erb +6 -0
- data/core/app/views/gaku/contacts/_form_fields.html.slim +1 -1
- data/core/app/views/gaku/notes/create.js.erb +3 -3
- data/core/app/views/gaku/notes/destroy.js.erb +3 -3
- data/core/app/views/gaku/notes/edit.js.erb +1 -1
- data/core/app/views/gaku/notes/new.js.erb +1 -1
- data/core/app/views/gaku/notes/show.js.erb +1 -1
- data/core/app/views/gaku/notes/update.js.erb +2 -2
- data/core/app/views/gaku/syllabuses/_syllabus_fields.html.slim +2 -3
- data/core/app/views/gaku/syllabuses/_syllabuses.html.slim +1 -1
- data/core/app/views/gaku/syllabuses/create.js.erb +4 -3
- data/core/app/views/gaku/syllabuses/destroy.js.erb +1 -1
- data/core/app/views/gaku/syllabuses/{show.html.slim → edit.html.slim} +0 -0
- data/core/app/views/gaku/syllabuses/edit.js.erb +1 -1
- data/core/app/views/gaku/syllabuses/new.js.erb +1 -1
- data/core/app/views/gaku/syllabuses/update.js.erb +1 -1
- data/core/config/routes.rb +0 -8
- data/core/gaku_core.gemspec +15 -11
- data/core/lib/gaku/testing/factories/note_factory.rb +4 -0
- data/core/lib/gaku/testing/factories/syllabus_factory.rb +4 -0
- data/core/lib/gaku/testing/request_helpers.rb +5 -0
- data/core/spec/controllers/gaku/addresses_controller_spec.rb +1 -1
- data/core/spec/controllers/gaku/contacts_controller_spec.rb +83 -12
- data/core/spec/controllers/gaku/notes_controller_spec.rb +143 -0
- data/core/spec/controllers/gaku/syllabuses_controller_spec.rb +140 -0
- data/core/spec/requests/admin/achievements/achievements_spec.rb +1 -1
- data/core/spec/requests/admin/grading/grading_method_set_items_spec.rb +1 -1
- data/core/spec/requests/admin/grading/grading_method_sets_spec.rb +1 -1
- data/core/spec/requests/admin/grading/grading_methods_spec.rb +1 -1
- data/core/spec/requests/admin/roles_spec.rb +1 -1
- data/core/spec/requests/admin/school_years/school_years_spec.rb +1 -1
- data/core/spec/requests/admin/school_years/semesters_spec.rb +1 -1
- data/core/spec/requests/admin/schools/campuses/addresses_spec.rb +1 -1
- data/core/spec/requests/admin/schools/campuses/campuses_spec.rb +1 -1
- data/core/spec/requests/admin/schools/campuses/contacts_spec.rb +10 -22
- data/core/spec/requests/admin/schools/programs_spec.rb +1 -1
- data/core/spec/requests/admin/schools/school_levels_spec.rb +1 -1
- data/core/spec/requests/admin/schools/schools_spec.rb +1 -1
- data/core/spec/requests/admin/specialties_spec.rb +1 -1
- data/core/spec/requests/admin/templates_spec.rb +1 -1
- data/core/spec/requests/admin/types_and_methods/attendance_types_spec.rb +1 -1
- data/core/spec/requests/admin/types_and_methods/commute_method_types_spec.rb +1 -1
- data/core/spec/requests/admin/types_and_methods/contact_types_spec.rb +1 -1
- data/core/spec/requests/admin/types_and_methods/enrollment_statuses_spec.rb +1 -1
- data/core/spec/requests/admin/types_and_methods/states_spec.rb +1 -1
- data/core/spec/requests/admin/users_spec.rb +1 -1
- data/core/spec/requests/class_groups/class_groups_spec.rb +1 -1
- data/core/spec/requests/class_groups/notes_spec.rb +6 -13
- data/core/spec/requests/class_groups/semester_class_groups_spec.rb +1 -1
- data/core/spec/requests/course_groups/course_groups_spec.rb +1 -1
- data/core/spec/requests/courses/courses_spec.rb +1 -1
- data/core/spec/requests/courses/notes_spec.rb +6 -11
- data/core/spec/requests/courses/semester_courses_spec.rb +1 -1
- data/core/spec/requests/exams/exam_portions/attachments_spec.rb +1 -1
- data/core/spec/requests/exams/notes_spec.rb +6 -11
- data/core/spec/requests/students/achievements_spec.rb +1 -1
- data/core/spec/requests/students/contacts_spec.rb +7 -7
- data/core/spec/requests/students/guardians/contacts_spec.rb +9 -17
- data/core/spec/requests/students/notes_spec.rb +5 -9
- data/core/spec/requests/students/simple_grades_spec.rb +1 -1
- data/core/spec/requests/students/specialties_spec.rb +1 -1
- data/core/spec/requests/syllabuses/exams_spec.rb +5 -5
- data/core/spec/requests/syllabuses/notes_spec.rb +5 -10
- data/core/spec/requests/syllabuses/syllabuses_spec.rb +46 -85
- data/core/spec/requests/teachers/contacts_spec.rb +11 -19
- data/core/spec/requests/teachers/notes_spec.rb +5 -10
- data/core/spec/support/requests/shared_addresses_spec.rb +6 -2
- data/core/spec/support/requests/shared_contacts_spec.rb +19 -15
- data/core/spec/support/requests/shared_notes_spec.rb +36 -35
- data/gaku_dependencies.rb +1 -8
- metadata +9 -9
- data/core/app/controllers/gaku/assignments_controller.rb +0 -15
- data/core/spec/controllers/gaku/syllabuses/syllabuses_controller_spec.rb +0 -92
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5474503b8dd52288efd403fe8747063aeac22208
|
4
|
+
data.tar.gz: 5ee33d43e57e47d42fcbb4924639f579470c7962
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fcc49533fa2d448820ed37720eb52fe340004e478945104279071e44ae3c2fad2924258f92cd0707c96d180fd220704f6c62d8bceef4708e3f0ebdecedfe14c
|
7
|
+
data.tar.gz: 42de59feb61a93ca0e63ee97278ccd3694b8d3263798fd24085df3cf3b87fb54a70b698d34d034cb0784f8f908ca8e28070ae9d79dba457974bf1126fa09ea07
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/gaku.png)](http://badge.fury.io/rb/gaku)
|
1
2
|
[![Build Status](https://travis-ci.org/Genshin/gaku.png)](https://travis-ci.org/Genshin/gaku)
|
2
|
-
[![Code Climate](https://codeclimate.com/github/Genshin/gaku.png)](https://codeclimate.com/github/Genshin/gaku)
|
3
3
|
[![Coverage Status](https://coveralls.io/repos/Genshin/gaku/badge.png?branch=master)](https://coveralls.io/r/Genshin/gaku?branch=master)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/Genshin/gaku.png)](https://codeclimate.com/github/Genshin/gaku)
|
4
5
|
|
5
6
|
GAKU Engine [学園陣]
|
6
7
|
====================
|
@@ -63,12 +64,19 @@ Create a new Rails application:
|
|
63
64
|
$ rails _4.0.0_ new my_app
|
64
65
|
|
65
66
|
|
66
|
-
Then add GAKU to your Gemfile
|
67
|
+
Then add GAKU to your Gemfile:
|
68
|
+
```ruby
|
69
|
+
gem 'globalize3', github: 'globalize/globalize', branch: 'rails4', ref: '82b3b36308677745b261bd147dda00ed4560a25d'
|
70
|
+
gem 'gaku', '~> 0.0.2'
|
71
|
+
```
|
67
72
|
|
73
|
+
Or use the master branch:
|
68
74
|
```ruby
|
75
|
+
gem 'globalize3', github: 'globalize/globalize', branch: 'rails4', ref: '82b3b36308677745b261bd147dda00ed4560a25d'
|
69
76
|
gem 'gaku', github: 'Genshin/gaku'
|
70
77
|
```
|
71
78
|
|
79
|
+
|
72
80
|
Install dependencies:
|
73
81
|
|
74
82
|
$ bundle
|
@@ -85,10 +93,10 @@ Sample Data
|
|
85
93
|
-----------
|
86
94
|
If you want to populate sample data:
|
87
95
|
|
88
|
-
$ rake
|
96
|
+
$ rake db:sample
|
89
97
|
|
90
98
|
Defaults:
|
91
|
-
user: admin pass: 123456
|
99
|
+
user: admin / pass: 123456
|
92
100
|
|
93
101
|
|
94
102
|
Run
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
@@ -3,8 +3,7 @@ module EnrollmentsController
|
|
3
3
|
include Gaku::ClassNameDetector
|
4
4
|
|
5
5
|
def enroll_students
|
6
|
-
|
7
|
-
|
6
|
+
@selected_students = params[:selected_students].presence || []
|
8
7
|
enroll_selected_students
|
9
8
|
|
10
9
|
if params[:source] == class_name_underscored_plural
|
@@ -5,9 +5,9 @@ module Gaku
|
|
5
5
|
|
6
6
|
include PolymorphicResourceConcern
|
7
7
|
|
8
|
-
respond_to :js
|
8
|
+
respond_to :js
|
9
9
|
|
10
|
-
before_action :set_contact_types
|
10
|
+
before_action :set_contact_types, only: %i( new edit )
|
11
11
|
before_action :set_unscoped_contact, only: %i( recovery destroy )
|
12
12
|
before_action :set_contact, only: %i( edit update soft_delete make_primary )
|
13
13
|
before_action :set_polymorphic_resource
|
@@ -92,7 +92,7 @@ module Gaku
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def set_contact_types
|
95
|
-
@contact_types = ContactType.all
|
95
|
+
@contact_types = ContactType.all
|
96
96
|
end
|
97
97
|
|
98
98
|
def set_count
|
@@ -1,50 +1,51 @@
|
|
1
1
|
module Gaku
|
2
2
|
class NotesController < GakuController
|
3
3
|
|
4
|
-
load_and_authorize_resource :note, class: Gaku::Note
|
4
|
+
#load_and_authorize_resource :note, class: Gaku::Note
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
respond_to :js
|
6
|
+
before_action :set_notable
|
7
|
+
before_action :set_note, only: %i( edit update destroy )
|
8
|
+
respond_to :js
|
9
9
|
|
10
10
|
def new
|
11
|
-
@note =
|
12
|
-
|
11
|
+
@note = Note.new
|
12
|
+
respond_with @note
|
13
13
|
end
|
14
14
|
|
15
15
|
def create
|
16
16
|
@note = @notable.notes.new(note_params)
|
17
|
-
|
17
|
+
@note.save
|
18
|
+
set_count
|
19
|
+
respond_with @note
|
18
20
|
end
|
19
21
|
|
20
|
-
|
22
|
+
def edit
|
23
|
+
end
|
21
24
|
|
22
|
-
|
23
|
-
|
24
|
-
# @notable.notes
|
25
|
-
# end
|
25
|
+
def show
|
26
|
+
end
|
26
27
|
|
27
|
-
def
|
28
|
-
|
28
|
+
def update
|
29
|
+
@note.update(note_params)
|
30
|
+
respond_with @note
|
29
31
|
end
|
30
32
|
|
31
|
-
def
|
32
|
-
|
33
|
-
|
33
|
+
def destroy
|
34
|
+
@note.destroy
|
35
|
+
set_count
|
36
|
+
respond_with @note
|
34
37
|
end
|
35
38
|
|
36
39
|
private
|
37
40
|
|
38
|
-
def
|
39
|
-
|
41
|
+
def note_params
|
42
|
+
params.require(:note).permit(note_attr)
|
40
43
|
end
|
41
44
|
|
42
|
-
def
|
43
|
-
|
45
|
+
def note_attr
|
46
|
+
%i(title content)
|
44
47
|
end
|
45
48
|
|
46
|
-
private
|
47
|
-
|
48
49
|
def notable_klasses
|
49
50
|
[
|
50
51
|
Gaku::Student,
|
@@ -57,7 +58,15 @@ module Gaku
|
|
57
58
|
]
|
58
59
|
end
|
59
60
|
|
60
|
-
def
|
61
|
+
def set_count
|
62
|
+
@count = @notable.reload.notes_count
|
63
|
+
end
|
64
|
+
|
65
|
+
def set_note
|
66
|
+
@note = Note.find(params[:id])
|
67
|
+
end
|
68
|
+
|
69
|
+
def set_notable
|
61
70
|
unnamespaced_klass = ''
|
62
71
|
klass = notable_klasses.find do |c|
|
63
72
|
unnamespaced_klass = c.to_s.split('::')
|
@@ -1,43 +1,71 @@
|
|
1
1
|
module Gaku
|
2
2
|
class SyllabusesController < GakuController
|
3
3
|
|
4
|
-
load_and_authorize_resource class: Gaku::Syllabus
|
4
|
+
#load_and_authorize_resource class: Gaku::Syllabus
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
respond_to :js, only: %i( new create edit update destroy )
|
7
|
+
respond_to :html, only: %i( index edit show )
|
8
8
|
|
9
|
-
|
10
|
-
respond_to :js, :html
|
9
|
+
before_action :set_syllabus, only: %i( edit update destroy )
|
11
10
|
|
12
|
-
|
11
|
+
def new
|
12
|
+
@syllabus = Syllabus.new
|
13
|
+
respond_with @syllabus
|
14
|
+
end
|
15
|
+
|
16
|
+
def create
|
17
|
+
@syllabus = Syllabus.new(syllabus_params)
|
18
|
+
@syllabus.save
|
19
|
+
set_count
|
20
|
+
respond_with @syllabus
|
21
|
+
end
|
13
22
|
|
14
|
-
def
|
15
|
-
|
16
|
-
|
23
|
+
def index
|
24
|
+
@syllabuses = Syllabus.all
|
25
|
+
set_count
|
26
|
+
respond_with @syllabuses
|
27
|
+
end
|
28
|
+
|
29
|
+
def edit
|
30
|
+
set_grading_methods
|
31
|
+
set_notable
|
32
|
+
end
|
33
|
+
|
34
|
+
def update
|
35
|
+
@syllabus.update(syllabus_params)
|
36
|
+
respond_with @syllabus
|
37
|
+
end
|
38
|
+
|
39
|
+
def destroy
|
40
|
+
@syllabus.destroy
|
41
|
+
set_count
|
42
|
+
respond_with @syllabus
|
17
43
|
end
|
18
44
|
|
19
45
|
private
|
20
46
|
|
47
|
+
def syllabus_params
|
48
|
+
params.require(:syllabus).permit(syllabus_attr)
|
49
|
+
end
|
50
|
+
|
21
51
|
def syllabus_attr
|
22
|
-
%i(name code credits description)
|
52
|
+
%i( name code credits description )
|
23
53
|
end
|
24
54
|
|
25
|
-
def
|
55
|
+
def set_syllabus
|
26
56
|
@syllabus = Syllabus.find(params[:id])
|
27
57
|
end
|
28
58
|
|
29
|
-
def
|
59
|
+
def set_grading_methods
|
30
60
|
@grading_methods = GradingMethod.all
|
31
61
|
end
|
32
62
|
|
33
|
-
def
|
34
|
-
syllabus
|
63
|
+
def set_notable
|
35
64
|
@notable = @syllabus
|
36
65
|
@notable_resource = get_resource_name @notable
|
37
|
-
grading_methods
|
38
66
|
end
|
39
67
|
|
40
|
-
def
|
68
|
+
def set_count
|
41
69
|
@count = Syllabus.count
|
42
70
|
end
|
43
71
|
|
@@ -27,7 +27,7 @@ module Gaku
|
|
27
27
|
after_destroy :reset_counter_cache
|
28
28
|
|
29
29
|
def make_primary
|
30
|
-
addresses.where(
|
30
|
+
addresses.where.not(id: id).update_all(primary: false)
|
31
31
|
update_attribute(:primary, true)
|
32
32
|
update_primary_address_field
|
33
33
|
end
|
@@ -16,15 +16,16 @@ module Gaku
|
|
16
16
|
|
17
17
|
after_save :save_student_class_and_number
|
18
18
|
|
19
|
+
def class_and_number
|
20
|
+
"#{class_group} - ##{seat_number}"
|
21
|
+
end
|
22
|
+
|
19
23
|
private
|
20
24
|
|
21
25
|
def save_student_class_and_number
|
22
26
|
student.update_attribute(:class_and_number, class_and_number) if student
|
23
27
|
end
|
24
28
|
|
25
|
-
def class_and_number
|
26
|
-
"#{class_group} - ##{seat_number}"
|
27
|
-
end
|
28
29
|
|
29
30
|
end
|
30
31
|
end
|
@@ -48,7 +48,7 @@ module Gaku
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def make_primary
|
51
|
-
contacts.where(
|
51
|
+
contacts.where.not(id: id).update_all(primary: false)
|
52
52
|
update_attribute(:primary, true)
|
53
53
|
|
54
54
|
if contactable.has_attribute?(:primary_contact)
|
@@ -79,7 +79,7 @@ module Gaku
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def remove_other_primary
|
82
|
-
contacts.where(
|
82
|
+
contacts.where.not(id: id).update_all(primary: false) if primary?
|
83
83
|
end
|
84
84
|
|
85
85
|
def ensure_first_is_primary
|
@@ -9,7 +9,7 @@ module Gaku
|
|
9
9
|
before_save :ensure_first_is_primary, on: :create
|
10
10
|
|
11
11
|
def make_primary
|
12
|
-
GradingMethodSet.where(
|
12
|
+
GradingMethodSet.where.not(id: id).update_all({ primary: false })
|
13
13
|
update_attribute(:primary, true)
|
14
14
|
end
|
15
15
|
|
@@ -9,3 +9,9 @@ $('.class-group-enrollments-count').html('<%= print_count(@count, t_student_list
|
|
9
9
|
|
10
10
|
$('#student-modal').modal('hide');
|
11
11
|
showNotice("<%= render_flash %>");
|
12
|
+
|
13
|
+
var enrollments = <%= raw @enrollments.map {|e| [e.student_id, e.class_and_number ]}.to_json %>
|
14
|
+
enrollments.forEach(function(enrollment) {
|
15
|
+
$('#student-' + enrollment[0] + ' td:eq(5)' ).html(enrollment[1])
|
16
|
+
})
|
17
|
+
|
@@ -1,6 +1,6 @@
|
|
1
1
|
.row-fluid
|
2
2
|
.span6
|
3
|
-
= f.select :contact_type_id,
|
3
|
+
= f.select :contact_type_id, options_from_collection_for_select(@contact_types, :id, :name), {prompt: t(:'contact_type.choose')}, label: t(:'contact_type.plural')
|
4
4
|
.span6
|
5
5
|
= f.text_field :data, label: t(:'contact.data')
|
6
6
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
$('#<%= @notable_resource %>-notes-index tbody').append('<%=
|
1
|
+
$('#<%= @notable_resource %>-notes-index tbody').append('<%= j render("note", {note: @note}) %>');
|
2
2
|
$('#new-<%= @notable_resource %>-note form').each(function() {
|
3
3
|
this.reset();
|
4
4
|
});
|
@@ -6,6 +6,6 @@ $('#new-<%= @notable_resource %>-note form').each(function() {
|
|
6
6
|
$('#new-<%= @notable_resource %>-note').slide();
|
7
7
|
$('#new-<%= @notable_resource %>-note-link').show();
|
8
8
|
|
9
|
-
$('#<%= @notable_resource %>-notes-tab-link').html("<%= print_count(@
|
10
|
-
$('.<%= @notable_resource %>-notes-count').html("<%= print_count(@
|
9
|
+
$('#<%= @notable_resource %>-notes-tab-link').html("<%= print_count(@count, t('note.plural')) %>");
|
10
|
+
$('.<%= @notable_resource %>-notes-count').html("<%= print_count(@count, t('note.list')) %>");
|
11
11
|
showNotice("<%= render_flash %>");
|
@@ -1,4 +1,4 @@
|
|
1
|
-
$('#new-<%= @notable_resource %>-note-tab-link').html("<%= print_count(@
|
2
|
-
$('.<%= @notable_resource %>-notes-count').html("<%= print_count(@
|
3
|
-
$('#<%= @notable_resource %>-notes-tab-link').html("<%= print_count(@
|
1
|
+
$('#new-<%= @notable_resource %>-note-tab-link').html("<%= print_count(@count, t('note.plural')) %>");
|
2
|
+
$('.<%= @notable_resource %>-notes-count').html("<%= print_count(@count, t('note.list')) %>");
|
3
|
+
$('#<%= @notable_resource %>-notes-tab-link').html("<%= print_count(@count, t('note.plural')) %>");
|
4
4
|
showNotice("<%= render_flash %>");
|
@@ -1,4 +1,4 @@
|
|
1
|
-
$('tr#note-<%= @note.id %>').html('<%=
|
2
|
-
$('tr#note-<%= @note.id %>').append('<%=
|
1
|
+
$('tr#note-<%= @note.id %>').html('<%= j render("gaku/notes/fields", {note: @note}) %>');
|
2
|
+
$('tr#note-<%= @note.id %>').append('<%= j render("buttons", {note: @note}) %>');
|
3
3
|
$("#edit-note-modal").modal('hide');
|
4
4
|
showNotice("<%= render_flash %>");
|
@@ -1,6 +1,7 @@
|
|
1
|
-
|
1
|
+
showNotice("<%= render_flash %>");
|
2
|
+
|
3
|
+
$('table#syllabuses-index tbody').append('<%= j render("syllabus", {syllabus: @syllabus}) %>');
|
2
4
|
$('#new-syllabus form')[0].reset();
|
3
5
|
$('#new-syllabus').slide();
|
4
6
|
$('#new-syllabus-link').show();
|
5
|
-
$('.syllabuses-count').html('<%= print_count(@count
|
6
|
-
showNotice("<%= render_flash %>");
|
7
|
+
$('.syllabuses-count').html('<%= print_count(@count, t_syllabus_list) %>');
|
@@ -1,2 +1,2 @@
|
|
1
1
|
showNotice("<%= render_flash %>");
|
2
|
-
$('.syllabuses-count').html('<%= print_count(@count
|
2
|
+
$('.syllabuses-count').html('<%= print_count(@count, t_syllabus_list) %>');
|
File without changes
|