enju_subject 0.1.0.pre12 → 0.1.0.pre13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/subjects_controller.rb +3 -9
  3. data/app/models/classification.rb +6 -17
  4. data/app/models/classification_type.rb +2 -2
  5. data/app/models/enju_subject/ability.rb +0 -5
  6. data/app/models/subject.rb +7 -7
  7. data/app/models/subject_heading_type.rb +2 -2
  8. data/app/models/subject_heading_type_has_subject.rb +2 -2
  9. data/app/models/subject_sweeper.rb +2 -10
  10. data/app/models/subject_type.rb +2 -2
  11. data/app/models/work_has_subject.rb +2 -2
  12. data/app/views/classifications/index.html.erb +51 -4
  13. data/app/views/manifestations/_classification_detail.html.erb +14 -0
  14. data/app/views/manifestations/_subject_detail.html.erb +14 -0
  15. data/app/views/subjects/index.html.erb +1 -3
  16. data/app/views/subjects/show.html.erb +2 -6
  17. data/db/migrate/20130504133816_add_manifestation_id_to_subject.rb +6 -0
  18. data/db/migrate/20130504143515_add_manifestation_id_to_classification.rb +6 -0
  19. data/lib/enju_subject/manifestation.rb +5 -9
  20. data/lib/enju_subject/version.rb +1 -1
  21. data/lib/generators/enju_subject/setup/templates/db/fixtures/classification_types.yml +8 -2
  22. data/spec/dummy/app/models/ability.rb +0 -5
  23. data/spec/dummy/db/development.sqlite3 +0 -0
  24. data/spec/dummy/db/migrate/20130421093852_add_periodical_to_manifestation.rb +5 -0
  25. data/spec/dummy/db/migrate/20130421155019_add_creator_string_to_series_statement.rb +7 -0
  26. data/spec/dummy/db/migrate/20130421164124_add_series_master_to_series_statement.rb +5 -0
  27. data/spec/dummy/db/schema.rb +21 -27
  28. data/spec/dummy/db/test.sqlite3 +0 -0
  29. data/spec/dummy/solr/data/test/index/segments.gen +0 -0
  30. data/spec/dummy/solr/data/test/index/segments_1n5 +0 -0
  31. data/spec/fixtures/classification_types.yml +2 -2
  32. data/spec/fixtures/classifications.yml +3 -2
  33. data/spec/fixtures/subject_heading_type_has_subjects.yml +2 -2
  34. data/spec/fixtures/subject_heading_types.yml +2 -2
  35. data/spec/fixtures/subject_types.yml +2 -2
  36. data/spec/fixtures/subjects.yml +3 -0
  37. data/spec/fixtures/work_has_subjects.yml +2 -2
  38. data/spec/models/classification_spec.rb +3 -2
  39. data/spec/models/classification_type_spec.rb +2 -2
  40. data/spec/models/subject_heading_type_has_subject_spec.rb +2 -2
  41. data/spec/models/subject_heading_type_spec.rb +2 -2
  42. data/spec/models/subject_spec.rb +2 -0
  43. data/spec/models/subject_type_spec.rb +2 -2
  44. data/spec/models/work_has_subject_spec.rb +2 -2
  45. metadata +33 -29
  46. data/app/controllers/subject_has_classifications_controller.rb +0 -97
  47. data/app/models/subject_has_classification.rb +0 -37
  48. data/app/views/classifications/_index.html.erb +0 -52
  49. data/app/views/classifications/_index_subject.html.erb +0 -62
  50. data/app/views/subject_has_classifications/edit.html.erb +0 -30
  51. data/app/views/subject_has_classifications/index.html.erb +0 -38
  52. data/app/views/subject_has_classifications/new.html.erb +0 -32
  53. data/app/views/subject_has_classifications/show.html.erb +0 -22
  54. data/app/views/subjects/_index_classification.html.erb +0 -57
  55. data/db/migrate/143_create_subject_has_classifications.rb +0 -16
  56. data/spec/controllers/subject_has_classifications_controller_spec.rb +0 -443
  57. data/spec/dummy/db/migrate/20110918161853_rename_series_statement_manifestation_id_to_root_manifestation_id.rb +0 -13
  58. data/spec/dummy/solr/data/test/index/segments_19e +0 -0
  59. data/spec/factories/subject_has_classification.rb +0 -6
  60. data/spec/fixtures/subject_has_classifications.yml +0 -74
  61. data/spec/models/subject_has_classification_spec.rb +0 -20
@@ -57,7 +57,7 @@ classification_type_00002:
57
57
  # display_name :text
58
58
  # note :text
59
59
  # position :integer
60
- # created_at :datetime
61
- # updated_at :datetime
60
+ # created_at :datetime not null
61
+ # updated_at :datetime not null
62
62
  #
63
63
 
@@ -109,9 +109,10 @@ classification_00005:
109
109
  # category :string(255) not null
110
110
  # note :text
111
111
  # classification_type_id :integer not null
112
- # created_at :datetime
113
- # updated_at :datetime
112
+ # created_at :datetime not null
113
+ # updated_at :datetime not null
114
114
  # lft :integer
115
115
  # rgt :integer
116
+ # manifestation_id :integer
116
117
  #
117
118
 
@@ -18,7 +18,7 @@ two:
18
18
  # subject_id :integer not null
19
19
  # subject_type :string(255)
20
20
  # subject_heading_type_id :integer not null
21
- # created_at :datetime
22
- # updated_at :datetime
21
+ # created_at :datetime not null
22
+ # updated_at :datetime not null
23
23
  #
24
24
 
@@ -25,7 +25,7 @@ subject_heading_type_00002:
25
25
  # display_name :text
26
26
  # note :text
27
27
  # position :integer
28
- # created_at :datetime
29
- # updated_at :datetime
28
+ # created_at :datetime not null
29
+ # updated_at :datetime not null
30
30
  #
31
31
 
@@ -36,7 +36,7 @@ subject_type_00004:
36
36
  # display_name :text
37
37
  # note :text
38
38
  # position :integer
39
- # created_at :datetime
40
- # updated_at :datetime
39
+ # created_at :datetime not null
40
+ # updated_at :datetime not null
41
41
  #
42
42
 
@@ -9,6 +9,7 @@ subject_00001:
9
9
  note:
10
10
  parent_id:
11
11
  created_at: 2008-03-01 17:53:06.118389 +09:00
12
+ manifestation_id: 1
12
13
  subject_00002:
13
14
  updated_at: 2008-03-02 03:19:57.946759 +09:00
14
15
  term: test2
@@ -67,5 +68,7 @@ subject_00005:
67
68
  # created_at :datetime
68
69
  # updated_at :datetime
69
70
  # deleted_at :datetime
71
+ # url :string(255)
72
+ # manifestation_id :integer
70
73
  #
71
74
 
@@ -27,7 +27,7 @@ work_has_subject_00003:
27
27
  # subject_type :string(255)
28
28
  # work_id :integer
29
29
  # position :integer
30
- # created_at :datetime
31
- # updated_at :datetime
30
+ # created_at :datetime not null
31
+ # updated_at :datetime not null
32
32
  #
33
33
 
@@ -15,9 +15,10 @@ end
15
15
  # category :string(255) not null
16
16
  # note :text
17
17
  # classification_type_id :integer not null
18
- # created_at :datetime
19
- # updated_at :datetime
18
+ # created_at :datetime not null
19
+ # updated_at :datetime not null
20
20
  # lft :integer
21
21
  # rgt :integer
22
+ # manifestation_id :integer
22
23
  #
23
24
 
@@ -15,7 +15,7 @@ end
15
15
  # display_name :text
16
16
  # note :text
17
17
  # position :integer
18
- # created_at :datetime
19
- # updated_at :datetime
18
+ # created_at :datetime not null
19
+ # updated_at :datetime not null
20
20
  #
21
21
 
@@ -14,7 +14,7 @@ end
14
14
  # subject_id :integer not null
15
15
  # subject_type :string(255)
16
16
  # subject_heading_type_id :integer not null
17
- # created_at :datetime
18
- # updated_at :datetime
17
+ # created_at :datetime not null
18
+ # updated_at :datetime not null
19
19
  #
20
20
 
@@ -15,7 +15,7 @@ end
15
15
  # display_name :text
16
16
  # note :text
17
17
  # position :integer
18
- # created_at :datetime
19
- # updated_at :datetime
18
+ # created_at :datetime not null
19
+ # updated_at :datetime not null
20
20
  #
21
21
 
@@ -26,5 +26,7 @@ end
26
26
  # created_at :datetime
27
27
  # updated_at :datetime
28
28
  # deleted_at :datetime
29
+ # url :string(255)
30
+ # manifestation_id :integer
29
31
  #
30
32
 
@@ -15,7 +15,7 @@ end
15
15
  # display_name :text
16
16
  # note :text
17
17
  # position :integer
18
- # created_at :datetime
19
- # updated_at :datetime
18
+ # created_at :datetime not null
19
+ # updated_at :datetime not null
20
20
  #
21
21
 
@@ -15,7 +15,7 @@ end
15
15
  # subject_type :string(255)
16
16
  # work_id :integer
17
17
  # position :integer
18
- # created_at :datetime
19
- # updated_at :datetime
18
+ # created_at :datetime not null
19
+ # updated_at :datetime not null
20
20
  #
21
21
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enju_subject
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre12
4
+ version: 0.1.0.pre13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kosuke Tanabe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-17 00:00:00.000000000 Z
11
+ date: 2013-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: enju_core
@@ -114,28 +114,28 @@ dependencies:
114
114
  requirements:
115
115
  - - ~>
116
116
  - !ruby/object:Gem::Version
117
- version: 0.1.0.pre31
117
+ version: 0.1.0.pre36
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - ~>
123
123
  - !ruby/object:Gem::Version
124
- version: 0.1.0.pre31
124
+ version: 0.1.0.pre36
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: enju_library
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ~>
130
130
  - !ruby/object:Gem::Version
131
- version: 0.1.0.pre20
131
+ version: 0.1.0.pre21
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - ~>
137
137
  - !ruby/object:Gem::Version
138
- version: 0.1.0.pre20
138
+ version: 0.1.0.pre21
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: sunspot_solr
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -150,6 +150,20 @@ dependencies:
150
150
  - - ~>
151
151
  - !ruby/object:Gem::Version
152
152
  version: 2.0.0
153
+ - !ruby/object:Gem::Dependency
154
+ name: sunspot-rails-tester
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - '>='
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
153
167
  description: Subject and classification management for Next-L Enju
154
168
  email:
155
169
  - tanabe@mwr.mediacom.keio.ac.jp
@@ -159,7 +173,6 @@ extra_rdoc_files: []
159
173
  files:
160
174
  - app/controllers/classification_types_controller.rb
161
175
  - app/controllers/classifications_controller.rb
162
- - app/controllers/subject_has_classifications_controller.rb
163
176
  - app/controllers/subject_heading_type_has_subjects_controller.rb
164
177
  - app/controllers/subject_heading_types_controller.rb
165
178
  - app/controllers/subject_types_controller.rb
@@ -169,7 +182,6 @@ files:
169
182
  - app/models/classification_type.rb
170
183
  - app/models/enju_subject/ability.rb
171
184
  - app/models/subject.rb
172
- - app/models/subject_has_classification.rb
173
185
  - app/models/subject_heading_type.rb
174
186
  - app/models/subject_heading_type_has_subject.rb
175
187
  - app/models/subject_sweeper.rb
@@ -181,17 +193,13 @@ files:
181
193
  - app/views/classification_types/new.html.erb
182
194
  - app/views/classification_types/show.html.erb
183
195
  - app/views/classifications/_form.html.erb
184
- - app/views/classifications/_index.html.erb
185
- - app/views/classifications/_index_subject.html.erb
186
196
  - app/views/classifications/edit.html.erb
187
197
  - app/views/classifications/index.html.erb
188
198
  - app/views/classifications/new.html.erb
189
199
  - app/views/classifications/show.html.erb
200
+ - app/views/manifestations/_classification_detail.html.erb
201
+ - app/views/manifestations/_subject_detail.html.erb
190
202
  - app/views/manifestations/_subject_facet.html.erb
191
- - app/views/subject_has_classifications/edit.html.erb
192
- - app/views/subject_has_classifications/index.html.erb
193
- - app/views/subject_has_classifications/new.html.erb
194
- - app/views/subject_has_classifications/show.html.erb
195
203
  - app/views/subject_heading_type_has_subjects/edit.html.erb
196
204
  - app/views/subject_heading_type_has_subjects/index.html.erb
197
205
  - app/views/subject_heading_type_has_subjects/new.html.erb
@@ -208,7 +216,6 @@ files:
208
216
  - app/views/subject_types/show.html.erb
209
217
  - app/views/subjects/_form.html.erb
210
218
  - app/views/subjects/_index.html.erb
211
- - app/views/subjects/_index_classification.html.erb
212
219
  - app/views/subjects/_index_work.html.erb
213
220
  - app/views/subjects/_show_work_list.html.erb
214
221
  - app/views/subjects/edit.html.erb
@@ -230,7 +237,6 @@ files:
230
237
  - db/fixtures/subject_types.yml
231
238
  - db/migrate/029_create_subjects.rb
232
239
  - db/migrate/142_create_classifications.rb
233
- - db/migrate/143_create_subject_has_classifications.rb
234
240
  - db/migrate/144_create_classification_types.rb
235
241
  - db/migrate/145_create_subject_heading_types.rb
236
242
  - db/migrate/146_create_subject_types.rb
@@ -238,6 +244,8 @@ files:
238
244
  - db/migrate/20090208044541_create_subject_heading_type_has_subjects.rb
239
245
  - db/migrate/20110913120629_add_lft_and_rgt_to_classification.rb
240
246
  - db/migrate/20120406020752_add_url_to_subject.rb
247
+ - db/migrate/20130504133816_add_manifestation_id_to_subject.rb
248
+ - db/migrate/20130504143515_add_manifestation_id_to_classification.rb
241
249
  - lib/enju_subject/engine.rb
242
250
  - lib/enju_subject/expire_editable_fragment.rb
243
251
  - lib/enju_subject/manifestation.rb
@@ -255,7 +263,6 @@ files:
255
263
  - README.rdoc
256
264
  - spec/controllers/classification_types_controller_spec.rb
257
265
  - spec/controllers/classifications_controller_spec.rb
258
- - spec/controllers/subject_has_classifications_controller_spec.rb
259
266
  - spec/controllers/subject_heading_type_has_subjects_controller_spec.rb
260
267
  - spec/controllers/subject_heading_types_controller_spec.rb
261
268
  - spec/controllers/subject_types_controller_spec.rb
@@ -359,7 +366,6 @@ files:
359
366
  - spec/dummy/db/migrate/20110916053430_rename_manifestation_number_list_to_number_string.rb
360
367
  - spec/dummy/db/migrate/20110916091020_add_volume_number_to_manifestation.rb
361
368
  - spec/dummy/db/migrate/20110916103953_add_manifestaiton_id_to_series_statement.rb
362
- - spec/dummy/db/migrate/20110918161853_rename_series_statement_manifestation_id_to_root_manifestation_id.rb
363
369
  - spec/dummy/db/migrate/20110918162329_add_note_to_series_statement.rb
364
370
  - spec/dummy/db/migrate/20111009183423_add_ndc_to_manifestation.rb
365
371
  - spec/dummy/db/migrate/20111124110059_create_create_types.rb
@@ -389,6 +395,9 @@ files:
389
395
  - spec/dummy/db/migrate/20120418081407_add_month_of_publication_to_manifestation.rb
390
396
  - spec/dummy/db/migrate/20120510140958_add_closed_to_shelf.rb
391
397
  - spec/dummy/db/migrate/20120602141129_add_edit_mode_to_patron_import_file.rb
398
+ - spec/dummy/db/migrate/20130421093852_add_periodical_to_manifestation.rb
399
+ - spec/dummy/db/migrate/20130421155019_add_creator_string_to_series_statement.rb
400
+ - spec/dummy/db/migrate/20130421164124_add_series_master_to_series_statement.rb
392
401
  - spec/dummy/db/schema.rb
393
402
  - spec/dummy/db/seeds.rb
394
403
  - spec/dummy/db/test.sqlite3
@@ -409,7 +418,7 @@ files:
409
418
  - spec/dummy/solr/conf/stopwords.txt
410
419
  - spec/dummy/solr/conf/synonyms.txt
411
420
  - spec/dummy/solr/data/test/index/segments.gen
412
- - spec/dummy/solr/data/test/index/segments_19e
421
+ - spec/dummy/solr/data/test/index/segments_1n5
413
422
  - spec/dummy/solr/data/test/spellchecker/segments.gen
414
423
  - spec/dummy/solr/data/test/spellchecker/segments_1
415
424
  - spec/dummy/spec/fixtures/subjects.yml
@@ -424,7 +433,6 @@ files:
424
433
  - spec/factories/classification_type.rb
425
434
  - spec/factories/manifestation.rb
426
435
  - spec/factories/subject.rb
427
- - spec/factories/subject_has_classification.rb
428
436
  - spec/factories/subject_heading_type.rb
429
437
  - spec/factories/subject_heading_type_has_subject.rb
430
438
  - spec/factories/subject_type.rb
@@ -439,7 +447,6 @@ files:
439
447
  - spec/fixtures/patron_types.yml
440
448
  - spec/fixtures/patrons.yml
441
449
  - spec/fixtures/roles.yml
442
- - spec/fixtures/subject_has_classifications.yml
443
450
  - spec/fixtures/subject_heading_type_has_subjects.yml
444
451
  - spec/fixtures/subject_heading_types.yml
445
452
  - spec/fixtures/subject_types.yml
@@ -450,7 +457,6 @@ files:
450
457
  - spec/fixtures/work_has_subjects.yml
451
458
  - spec/models/classification_spec.rb
452
459
  - spec/models/classification_type_spec.rb
453
- - spec/models/subject_has_classification_spec.rb
454
460
  - spec/models/subject_heading_type_has_subject_spec.rb
455
461
  - spec/models/subject_heading_type_spec.rb
456
462
  - spec/models/subject_spec.rb
@@ -482,14 +488,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
482
488
  version: 1.3.1
483
489
  requirements: []
484
490
  rubyforge_project:
485
- rubygems_version: 2.0.0
491
+ rubygems_version: 2.0.3
486
492
  signing_key:
487
493
  specification_version: 4
488
494
  summary: enju_subject plugin
489
495
  test_files:
490
496
  - spec/controllers/classification_types_controller_spec.rb
491
497
  - spec/controllers/classifications_controller_spec.rb
492
- - spec/controllers/subject_has_classifications_controller_spec.rb
493
498
  - spec/controllers/subject_heading_type_has_subjects_controller_spec.rb
494
499
  - spec/controllers/subject_heading_types_controller_spec.rb
495
500
  - spec/controllers/subject_types_controller_spec.rb
@@ -593,7 +598,6 @@ test_files:
593
598
  - spec/dummy/db/migrate/20110916053430_rename_manifestation_number_list_to_number_string.rb
594
599
  - spec/dummy/db/migrate/20110916091020_add_volume_number_to_manifestation.rb
595
600
  - spec/dummy/db/migrate/20110916103953_add_manifestaiton_id_to_series_statement.rb
596
- - spec/dummy/db/migrate/20110918161853_rename_series_statement_manifestation_id_to_root_manifestation_id.rb
597
601
  - spec/dummy/db/migrate/20110918162329_add_note_to_series_statement.rb
598
602
  - spec/dummy/db/migrate/20111009183423_add_ndc_to_manifestation.rb
599
603
  - spec/dummy/db/migrate/20111124110059_create_create_types.rb
@@ -623,6 +627,9 @@ test_files:
623
627
  - spec/dummy/db/migrate/20120418081407_add_month_of_publication_to_manifestation.rb
624
628
  - spec/dummy/db/migrate/20120510140958_add_closed_to_shelf.rb
625
629
  - spec/dummy/db/migrate/20120602141129_add_edit_mode_to_patron_import_file.rb
630
+ - spec/dummy/db/migrate/20130421093852_add_periodical_to_manifestation.rb
631
+ - spec/dummy/db/migrate/20130421155019_add_creator_string_to_series_statement.rb
632
+ - spec/dummy/db/migrate/20130421164124_add_series_master_to_series_statement.rb
626
633
  - spec/dummy/db/schema.rb
627
634
  - spec/dummy/db/seeds.rb
628
635
  - spec/dummy/db/test.sqlite3
@@ -643,7 +650,7 @@ test_files:
643
650
  - spec/dummy/solr/conf/stopwords.txt
644
651
  - spec/dummy/solr/conf/synonyms.txt
645
652
  - spec/dummy/solr/data/test/index/segments.gen
646
- - spec/dummy/solr/data/test/index/segments_19e
653
+ - spec/dummy/solr/data/test/index/segments_1n5
647
654
  - spec/dummy/solr/data/test/spellchecker/segments.gen
648
655
  - spec/dummy/solr/data/test/spellchecker/segments_1
649
656
  - spec/dummy/spec/fixtures/subjects.yml
@@ -658,7 +665,6 @@ test_files:
658
665
  - spec/factories/classification_type.rb
659
666
  - spec/factories/manifestation.rb
660
667
  - spec/factories/subject.rb
661
- - spec/factories/subject_has_classification.rb
662
668
  - spec/factories/subject_heading_type.rb
663
669
  - spec/factories/subject_heading_type_has_subject.rb
664
670
  - spec/factories/subject_type.rb
@@ -673,7 +679,6 @@ test_files:
673
679
  - spec/fixtures/patron_types.yml
674
680
  - spec/fixtures/patrons.yml
675
681
  - spec/fixtures/roles.yml
676
- - spec/fixtures/subject_has_classifications.yml
677
682
  - spec/fixtures/subject_heading_type_has_subjects.yml
678
683
  - spec/fixtures/subject_heading_types.yml
679
684
  - spec/fixtures/subject_types.yml
@@ -684,7 +689,6 @@ test_files:
684
689
  - spec/fixtures/work_has_subjects.yml
685
690
  - spec/models/classification_spec.rb
686
691
  - spec/models/classification_type_spec.rb
687
- - spec/models/subject_has_classification_spec.rb
688
692
  - spec/models/subject_heading_type_has_subject_spec.rb
689
693
  - spec/models/subject_heading_type_spec.rb
690
694
  - spec/models/subject_spec.rb
@@ -1,97 +0,0 @@
1
- class SubjectHasClassificationsController < ApplicationController
2
- load_and_authorize_resource
3
- before_filter :get_subject
4
- before_filter :get_classification
5
-
6
- # GET /subject_has_classifications
7
- # GET /subject_has_classifications.json
8
- def index
9
- case when @subject
10
- @subject_has_classifications = @subject.subject_has_classifications.page(params[:page])
11
- when @classification
12
- @subject_has_classifications = @classification.subject_has_classifications.page(params[:page])
13
- else
14
- @subject_has_classifications = SubjectHasClassification.page(params[:page])
15
- end
16
-
17
- respond_to do |format|
18
- format.html # index.html.erb
19
- format.json { render :json => @subject_has_classifications }
20
- end
21
- end
22
-
23
- # GET /subject_has_classifications/1
24
- # GET /subject_has_classifications/1.json
25
- def show
26
- respond_to do |format|
27
- format.html # show.html.erb
28
- format.json { render :json => @subject_has_classification }
29
- end
30
- end
31
-
32
- # GET /subject_has_classifications/new
33
- # GET /subject_has_classifications/new.json
34
- def new
35
- @subject_has_classification = SubjectHasClassification.new
36
- @subject_has_classification.subject = @subject
37
- @subject_has_classification.classification = @classification
38
-
39
- respond_to do |format|
40
- format.html # new.html.erb
41
- format.json { render :json => @subject_has_classification }
42
- end
43
- end
44
-
45
- # GET /subject_has_classifications/1/edit
46
- def edit
47
- end
48
-
49
- # POST /subject_has_classifications
50
- # POST /subject_has_classifications.json
51
- def create
52
- @subject_has_classification = SubjectHasClassification.new(params[:subject_has_classification])
53
-
54
- respond_to do |format|
55
- if @subject_has_classification.save
56
- format.html { redirect_to @subject_has_classification, :notice => t('controller.successfully_created', :model => t('activerecord.models.subject_has_classification')) }
57
- format.json { render :json => @subject_has_classification, :status => :created, :location => @subject_has_classification }
58
- else
59
- format.html { render :action => "new" }
60
- format.json { render :json => @subject_has_classification.errors, :status => :unprocessable_entity }
61
- end
62
- end
63
- end
64
-
65
- # PUT /subject_has_classifications/1
66
- # PUT /subject_has_classifications/1.json
67
- def update
68
- respond_to do |format|
69
- if @subject_has_classification.update_attributes(params[:subject_has_classification])
70
- format.html { redirect_to @subject_has_classification, :notice => t('controller.successfully_updated', :model => t('activerecord.models.subject_has_classification')) }
71
- format.json { head :no_content }
72
- else
73
- format.html { render :action => "edit" }
74
- format.json { render :json => @subject_has_classification.errors, :status => :unprocessable_entity }
75
- end
76
- end
77
- end
78
-
79
- # DELETE /subject_has_classifications/1
80
- # DELETE /subject_has_classifications/1.json
81
- def destroy
82
- @subject_has_classification.destroy
83
-
84
- respond_to do |format|
85
- format.html {
86
- if @subject
87
- redirect_to subject_subject_has_classifications_url(@subject)
88
- elsif @classification
89
- redirect_to classification_subject_has_classifications_url(@classification)
90
- else
91
- redirect_to subject_has_classifications_url
92
- end
93
- }
94
- format.json { head :no_content }
95
- end
96
- end
97
- end
@@ -1,37 +0,0 @@
1
- class SubjectHasClassification < ActiveRecord::Base
2
- attr_accessible :subject_id, :classification_id
3
- belongs_to :subject #, :polymorphic => true, :validate => true
4
- belongs_to :classification, :validate => true
5
-
6
- validates_associated :subject, :classification
7
- validates_presence_of :subject, :classification
8
- validates_uniqueness_of :classification_id, :scope => :subject_id
9
-
10
- #def after_save
11
- # if self.subject
12
- # self.subject.reload
13
- # self.subject.save
14
- # end
15
- # if self.classification
16
- # self.classification.reload
17
- # self.classification.save
18
- # end
19
- #end
20
-
21
- #def after_destroy
22
- # after_save
23
- #end
24
- end
25
-
26
- # == Schema Information
27
- #
28
- # Table name: subject_has_classifications
29
- #
30
- # id :integer not null, primary key
31
- # subject_id :integer
32
- # subject_type :string(255)
33
- # classification_id :integer not null
34
- # created_at :datetime
35
- # updated_at :datetime
36
- #
37
-
@@ -1,52 +0,0 @@
1
- <div id="content_detail" class="ui-corner-all">
2
- <h1 class="title"><%= t('page.listing', :model => t('activerecord.models.classification')) -%></h1>
3
- <div id="content_list">
4
-
5
- <div class="search_form">
6
- <%= form_for :classifications, :url => classifications_path, :html => {:method => 'get'} do -%>
7
- <p>
8
- <%= t('page.search_term') -%>: <%= search_field_tag 'query', h(@query), {:id => 'search_form_top', :class => 'search_form', :placeholder => t('page.search_term')} -%>
9
- <%= submit_tag t('page.search') -%>
10
- </p>
11
- <%- end -%>
12
- </div>
13
-
14
- <table class="table table-striped index">
15
- <tr>
16
- <th><%= t('activerecord.attributes.classification.category') -%></th>
17
- <th><%= t('activerecord.attributes.classification.note') -%></th>
18
- <th><%= t('activerecord.models.classification_type') -%></th>
19
- <th></th>
20
- </tr>
21
-
22
- <%- @classifications.each do |classification| -%>
23
- <tr class="line<%= cycle("0", "1") -%>">
24
- <td><%= link_to classification.category, classification -%></td>
25
- <td><%= classification.note -%></td>
26
- <td><%= link_to classification.classification_type.display_name.localize, classification.classification_type -%></td>
27
- <td>
28
- <%- if can? :delete, classification -%>
29
- <%= link_to t('page.edit'), edit_classification_path(classification) -%>
30
- <%= link_to t('page.destroy'), classification, :data => {:confirm => t('page.are_you_sure')}, :method => :delete -%>
31
- <%- end -%>
32
- </td>
33
- </tr>
34
- <%- end -%>
35
- </table>
36
-
37
- <%= paginate(@classifications) -%>
38
-
39
- </div>
40
- </div>
41
-
42
- <div id="submenu" class="ui-corner-all">
43
- <ul>
44
- <%- if can? :create, Classification -%>
45
- <%- if @classification_type -%>
46
- <li><%= link_to t('page.new', :model => t('activerecord.models.classification')), new_classification_type_classification_path(@classification_type) -%></li>
47
- <%- else -%>
48
- <li><%= link_to t('page.new', :model => t('activerecord.models.classification')), new_classification_path -%></li>
49
- <%- end -%>
50
- <%- end -%>
51
- </ul>
52
- </div>
@@ -1,62 +0,0 @@
1
- <div id="content_detail" class="ui-corner-all">
2
- <h1 class="title"><%= t('page.listing', :model => t('activerecord.models.classification')) -%></h1>
3
- <div id="content_list">
4
-
5
- <h2><%= link_to @subject.term, @subject -%></h2>
6
-
7
- <div class="search_form">
8
- <%= form_for :classifications, :url => subject_classifications_path(@subject), :html => {:method => 'get'} do -%>
9
- <p>
10
- <%= t('page.search_term') -%>: <%= search_field_tag 'query', h(@query), {:id => 'search_form_top', :class => 'search_form', :placeholder => t('page.search_term')} -%>
11
- <%= submit_tag t('page.search') -%>
12
- <%- if can? :create, SubjectHasClassification -%>
13
- <%= render 'page/add' %>
14
- <%- end -%>
15
- </p>
16
- <%- end -%>
17
- </div>
18
-
19
- <table class="table table-striped index">
20
- <tr>
21
- <th><%= t('activerecord.models.classification') -%></th>
22
- <th><%= t('activerecord.attributes.classification.note') -%></th>
23
- <th><%= t('activerecord.models.classification_type') -%></th>
24
- <th></th>
25
- <th></th>
26
- </tr>
27
-
28
- <%- @classifications.each do |classification| -%>
29
- <tr class="line<%= cycle("0", "1") -%>">
30
- <td><%= link_to classification.category, subject_classification_path(@subject, classification) -%></td>
31
- <td><%= classification.note -%></td>
32
- <td><%= classification.classification_type.display_name.localize -%></td>
33
- <td>
34
- <%- if can? :delete, classification -%>
35
- <%= link_to t('page.edit'), edit_classification_path(classification) -%>
36
- <% end %>
37
- </td>
38
- <td>
39
- <%- if can? :delete, classification -%>
40
- <%- if params[:mode] == 'add' -%>
41
- <%= link_to t('page.add'), new_subject_subject_has_classification_path(@subject, :classification_id => classification.id) unless @subject.classifications.include?(classification) -%>
42
- <%- else -%>
43
- <%- has_classification = @subject.subject_has_classifications.find_by_classification_id(classification) -%>
44
- <%= link_to t('page.destroy'), subject_subject_has_classification_path(@subject, has_classification), :data => {:confirm => t('page.are_you_sure')}, :method => :delete if has_classification -%>
45
- <%- end -%>
46
- <%- end -%>
47
- </td>
48
- </tr>
49
- <%- end -%>
50
- </table>
51
-
52
- <%= paginate(@classifications) -%>
53
- </div>
54
- </div>
55
-
56
- <div id="submenu" class="ui-corner-all">
57
- <ul>
58
- <%- if can? :create, Classification -%>
59
- <li><%= link_to t('page.new', :model => t('activerecord.models.classification')), new_classification_path -%></li>
60
- <%- end -%>
61
- </ul>
62
- </div>