enju_subject 0.1.0.pre13 → 0.1.0.pre14

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 (49) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/subjects_controller.rb +3 -45
  3. data/app/models/enju_subject/ability.rb +4 -12
  4. data/app/models/subject.rb +4 -10
  5. data/app/models/subject_heading_type.rb +1 -3
  6. data/app/models/subject_sweeper.rb +1 -4
  7. data/app/views/manifestations/_subject_detail.html.erb +1 -1
  8. data/app/views/subjects/_form.html.erb +4 -14
  9. data/app/views/subjects/index.html.erb +44 -5
  10. data/app/views/subjects/show.html.erb +6 -36
  11. data/config/locales/translation_en.yml +0 -16
  12. data/config/locales/translation_ja.yml +1 -17
  13. data/config/routes.rb +4 -31
  14. data/db/migrate/20130504195916_add_subject_heading_type_id_to_subject.rb +5 -0
  15. data/lib/enju_subject/version.rb +1 -1
  16. data/lib/generators/enju_subject/setup/templates/db/fixtures/subject_heading_types.yml +31 -0
  17. data/spec/controllers/subjects_controller_spec.rb +0 -17
  18. data/spec/dummy/app/models/ability.rb +4 -12
  19. data/spec/dummy/db/development.sqlite3 +0 -0
  20. data/spec/dummy/db/schema.rb +5 -26
  21. data/spec/dummy/db/test.sqlite3 +0 -0
  22. data/spec/dummy/solr/data/test/index/segments.gen +0 -0
  23. data/spec/dummy/solr/data/test/index/segments_1ss +0 -0
  24. data/spec/fixtures/subjects.yml +5 -0
  25. data/spec/routing/subjects_routing_spec.rb +0 -4
  26. metadata +10 -37
  27. data/app/controllers/subject_heading_type_has_subjects_controller.rb +0 -80
  28. data/app/controllers/work_has_subjects_controller.rb +0 -107
  29. data/app/models/subject_heading_type_has_subject.rb +0 -22
  30. data/app/models/work_has_subject.rb +0 -32
  31. data/app/views/subjects/_index.html.erb +0 -48
  32. data/app/views/subjects/_index_work.html.erb +0 -60
  33. data/app/views/subjects/_show_work_list.html.erb +0 -15
  34. data/app/views/subjects/show.js.erb +0 -1
  35. data/app/views/work_has_subjects/_form.html.erb +0 -24
  36. data/app/views/work_has_subjects/edit.html.erb +0 -29
  37. data/app/views/work_has_subjects/index.html.erb +0 -31
  38. data/app/views/work_has_subjects/new.html.erb +0 -42
  39. data/app/views/work_has_subjects/show.html.erb +0 -25
  40. data/db/migrate/20080606052544_create_work_has_subjects.rb +0 -18
  41. data/db/migrate/20090208044541_create_subject_heading_type_has_subjects.rb +0 -16
  42. data/spec/controllers/subject_heading_type_has_subjects_controller_spec.rb +0 -447
  43. data/spec/controllers/work_has_subjects_controller_spec.rb +0 -439
  44. data/spec/dummy/solr/data/test/index/segments_1n5 +0 -0
  45. data/spec/factories/work_has_subject.rb +0 -6
  46. data/spec/fixtures/subject_heading_type_has_subjects.yml +0 -24
  47. data/spec/fixtures/work_has_subjects.yml +0 -33
  48. data/spec/models/subject_heading_type_has_subject_spec.rb +0 -20
  49. data/spec/models/work_has_subject_spec.rb +0 -21
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended to check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(:version => 20130504143515) do
14
+ ActiveRecord::Schema.define(:version => 20130504195916) do
15
15
 
16
16
  create_table "accepts", :force => true do |t|
17
17
  t.integer "basket_id"
@@ -734,16 +734,6 @@ ActiveRecord::Schema.define(:version => 20130504143515) do
734
734
 
735
735
  add_index "shelves", ["library_id"], :name => "index_shelves_on_library_id"
736
736
 
737
- create_table "subject_heading_type_has_subjects", :force => true do |t|
738
- t.integer "subject_id", :null => false
739
- t.string "subject_type"
740
- t.integer "subject_heading_type_id", :null => false
741
- t.datetime "created_at", :null => false
742
- t.datetime "updated_at", :null => false
743
- end
744
-
745
- add_index "subject_heading_type_has_subjects", ["subject_id"], :name => "index_subject_heading_type_has_subjects_on_subject_id"
746
-
747
737
  create_table "subject_heading_types", :force => true do |t|
748
738
  t.string "name", :null => false
749
739
  t.text "display_name"
@@ -767,16 +757,17 @@ ActiveRecord::Schema.define(:version => 20130504143515) do
767
757
  t.integer "use_term_id"
768
758
  t.string "term"
769
759
  t.text "term_transcription"
770
- t.integer "subject_type_id", :null => false
760
+ t.integer "subject_type_id", :null => false
771
761
  t.text "scope_note"
772
762
  t.text "note"
773
- t.integer "required_role_id", :default => 1, :null => false
774
- t.integer "lock_version", :default => 0, :null => false
763
+ t.integer "required_role_id", :default => 1, :null => false
764
+ t.integer "lock_version", :default => 0, :null => false
775
765
  t.datetime "created_at"
776
766
  t.datetime "updated_at"
777
767
  t.datetime "deleted_at"
778
768
  t.string "url"
779
769
  t.integer "manifestation_id"
770
+ t.integer "subject_heading_type_id"
780
771
  end
781
772
 
782
773
  add_index "subjects", ["manifestation_id"], :name => "index_subjects_on_manifestation_id"
@@ -874,16 +865,4 @@ ActiveRecord::Schema.define(:version => 20130504143515) do
874
865
 
875
866
  add_index "versions", ["item_type", "item_id"], :name => "index_versions_on_item_type_and_item_id"
876
867
 
877
- create_table "work_has_subjects", :force => true do |t|
878
- t.integer "subject_id"
879
- t.string "subject_type"
880
- t.integer "work_id"
881
- t.integer "position"
882
- t.datetime "created_at", :null => false
883
- t.datetime "updated_at", :null => false
884
- end
885
-
886
- add_index "work_has_subjects", ["subject_id"], :name => "index_work_has_subjects_on_subject_id"
887
- add_index "work_has_subjects", ["work_id"], :name => "index_work_has_subjects_on_work_id"
888
-
889
868
  end
Binary file
@@ -10,6 +10,7 @@ subject_00001:
10
10
  parent_id:
11
11
  created_at: 2008-03-01 17:53:06.118389 +09:00
12
12
  manifestation_id: 1
13
+ subject_heading_type_id: 1
13
14
  subject_00002:
14
15
  updated_at: 2008-03-02 03:19:57.946759 +09:00
15
16
  term: test2
@@ -20,6 +21,7 @@ subject_00002:
20
21
  note:
21
22
  parent_id:
22
23
  created_at: 2008-03-01 17:50:34.658349 +09:00
24
+ subject_heading_type_id: 1
23
25
  subject_00003:
24
26
  updated_at: 2008-03-02 03:19:58.048475 +09:00
25
27
  term: test3
@@ -30,6 +32,7 @@ subject_00003:
30
32
  note:
31
33
  parent_id:
32
34
  created_at: 2008-03-01 17:51:39.448430 +09:00
35
+ subject_heading_type_id: 2
33
36
  subject_00004:
34
37
  updated_at: 2008-03-02 03:19:58.048475 +09:00
35
38
  term: test4
@@ -40,6 +43,7 @@ subject_00004:
40
43
  note:
41
44
  parent_id:
42
45
  created_at: 2008-03-01 17:51:39.448430 +09:00
46
+ subject_heading_type_id: 2
43
47
  subject_00005:
44
48
  updated_at: 2008-03-02 03:19:58.048475 +09:00
45
49
  term: test5
@@ -50,6 +54,7 @@ subject_00005:
50
54
  note:
51
55
  parent_id:
52
56
  created_at: 2008-03-01 17:51:39.448430 +09:00
57
+ subject_heading_type_id: 2
53
58
 
54
59
  # == Schema Information
55
60
  #
@@ -7,10 +7,6 @@ describe SubjectsController do
7
7
  { :get => "/subjects" }.should route_to(:controller => "subjects", :action => "index")
8
8
  end
9
9
 
10
- it "recognizes and generates #index" do
11
- { :get => "/works/1/subjects" }.should route_to(:controller => "subjects", :action => "index", :work_id => "1")
12
- end
13
-
14
10
  it "recognizes and generates #new" do
15
11
  { :get => "/subjects/new" }.should route_to(:controller => "subjects", :action => "new")
16
12
  end
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.pre13
4
+ version: 0.1.0.pre14
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-05-04 00:00:00.000000000 Z
11
+ date: 2013-05-05 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.pre36
117
+ version: 0.1.0.pre37
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.pre36
124
+ version: 0.1.0.pre37
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.pre21
131
+ version: 0.1.0.pre22
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.pre21
138
+ version: 0.1.0.pre22
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: sunspot_solr
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -173,20 +173,16 @@ extra_rdoc_files: []
173
173
  files:
174
174
  - app/controllers/classification_types_controller.rb
175
175
  - app/controllers/classifications_controller.rb
176
- - app/controllers/subject_heading_type_has_subjects_controller.rb
177
176
  - app/controllers/subject_heading_types_controller.rb
178
177
  - app/controllers/subject_types_controller.rb
179
178
  - app/controllers/subjects_controller.rb
180
- - app/controllers/work_has_subjects_controller.rb
181
179
  - app/models/classification.rb
182
180
  - app/models/classification_type.rb
183
181
  - app/models/enju_subject/ability.rb
184
182
  - app/models/subject.rb
185
183
  - app/models/subject_heading_type.rb
186
- - app/models/subject_heading_type_has_subject.rb
187
184
  - app/models/subject_sweeper.rb
188
185
  - app/models/subject_type.rb
189
- - app/models/work_has_subject.rb
190
186
  - app/views/classification_types/_form.html.erb
191
187
  - app/views/classification_types/edit.html.erb
192
188
  - app/views/classification_types/index.html.erb
@@ -215,21 +211,12 @@ files:
215
211
  - app/views/subject_types/new.html.erb
216
212
  - app/views/subject_types/show.html.erb
217
213
  - app/views/subjects/_form.html.erb
218
- - app/views/subjects/_index.html.erb
219
- - app/views/subjects/_index_work.html.erb
220
- - app/views/subjects/_show_work_list.html.erb
221
214
  - app/views/subjects/edit.html.erb
222
215
  - app/views/subjects/index.atom.builder
223
216
  - app/views/subjects/index.html.erb
224
217
  - app/views/subjects/index.rss.builder
225
218
  - app/views/subjects/new.html.erb
226
219
  - app/views/subjects/show.html.erb
227
- - app/views/subjects/show.js.erb
228
- - app/views/work_has_subjects/_form.html.erb
229
- - app/views/work_has_subjects/edit.html.erb
230
- - app/views/work_has_subjects/index.html.erb
231
- - app/views/work_has_subjects/new.html.erb
232
- - app/views/work_has_subjects/show.html.erb
233
220
  - config/locales/translation_en.yml
234
221
  - config/locales/translation_ja.yml
235
222
  - config/routes.rb
@@ -240,12 +227,11 @@ files:
240
227
  - db/migrate/144_create_classification_types.rb
241
228
  - db/migrate/145_create_subject_heading_types.rb
242
229
  - db/migrate/146_create_subject_types.rb
243
- - db/migrate/20080606052544_create_work_has_subjects.rb
244
- - db/migrate/20090208044541_create_subject_heading_type_has_subjects.rb
245
230
  - db/migrate/20110913120629_add_lft_and_rgt_to_classification.rb
246
231
  - db/migrate/20120406020752_add_url_to_subject.rb
247
232
  - db/migrate/20130504133816_add_manifestation_id_to_subject.rb
248
233
  - db/migrate/20130504143515_add_manifestation_id_to_classification.rb
234
+ - db/migrate/20130504195916_add_subject_heading_type_id_to_subject.rb
249
235
  - lib/enju_subject/engine.rb
250
236
  - lib/enju_subject/expire_editable_fragment.rb
251
237
  - lib/enju_subject/manifestation.rb
@@ -255,6 +241,7 @@ files:
255
241
  - lib/enju_subject.rb
256
242
  - lib/generators/enju_subject/setup/setup_generator.rb
257
243
  - lib/generators/enju_subject/setup/templates/db/fixtures/classification_types.yml
244
+ - lib/generators/enju_subject/setup/templates/db/fixtures/subject_heading_types.yml
258
245
  - lib/generators/enju_subject/setup/templates/db/fixtures/subject_types.yml
259
246
  - lib/generators/enju_subject/setup/USAGE
260
247
  - lib/tasks/enju_subject_tasks.rake
@@ -263,11 +250,9 @@ files:
263
250
  - README.rdoc
264
251
  - spec/controllers/classification_types_controller_spec.rb
265
252
  - spec/controllers/classifications_controller_spec.rb
266
- - spec/controllers/subject_heading_type_has_subjects_controller_spec.rb
267
253
  - spec/controllers/subject_heading_types_controller_spec.rb
268
254
  - spec/controllers/subject_types_controller_spec.rb
269
255
  - spec/controllers/subjects_controller_spec.rb
270
- - spec/controllers/work_has_subjects_controller_spec.rb
271
256
  - spec/dummy/app/assets/javascripts/application.js
272
257
  - spec/dummy/app/assets/stylesheets/application.css
273
258
  - spec/dummy/app/controllers/application_controller.rb
@@ -418,7 +403,7 @@ files:
418
403
  - spec/dummy/solr/conf/stopwords.txt
419
404
  - spec/dummy/solr/conf/synonyms.txt
420
405
  - spec/dummy/solr/data/test/index/segments.gen
421
- - spec/dummy/solr/data/test/index/segments_1n5
406
+ - spec/dummy/solr/data/test/index/segments_1ss
422
407
  - spec/dummy/solr/data/test/spellchecker/segments.gen
423
408
  - spec/dummy/solr/data/test/spellchecker/segments_1
424
409
  - spec/dummy/spec/fixtures/subjects.yml
@@ -437,7 +422,6 @@ files:
437
422
  - spec/factories/subject_heading_type_has_subject.rb
438
423
  - spec/factories/subject_type.rb
439
424
  - spec/factories/user.rb
440
- - spec/factories/work_has_subject.rb
441
425
  - spec/fixtures/carrier_types.yml
442
426
  - spec/fixtures/classification_types.yml
443
427
  - spec/fixtures/classifications.yml
@@ -447,21 +431,17 @@ files:
447
431
  - spec/fixtures/patron_types.yml
448
432
  - spec/fixtures/patrons.yml
449
433
  - spec/fixtures/roles.yml
450
- - spec/fixtures/subject_heading_type_has_subjects.yml
451
434
  - spec/fixtures/subject_heading_types.yml
452
435
  - spec/fixtures/subject_types.yml
453
436
  - spec/fixtures/subjects.yml
454
437
  - spec/fixtures/user_groups.yml
455
438
  - spec/fixtures/user_has_roles.yml
456
439
  - spec/fixtures/users.yml
457
- - spec/fixtures/work_has_subjects.yml
458
440
  - spec/models/classification_spec.rb
459
441
  - spec/models/classification_type_spec.rb
460
- - spec/models/subject_heading_type_has_subject_spec.rb
461
442
  - spec/models/subject_heading_type_spec.rb
462
443
  - spec/models/subject_spec.rb
463
444
  - spec/models/subject_type_spec.rb
464
- - spec/models/work_has_subject_spec.rb
465
445
  - spec/requests/subjects_spec.rb
466
446
  - spec/routing/subject_heading_types_routing_spec.rb
467
447
  - spec/routing/subject_types_routing_spec.rb
@@ -495,11 +475,9 @@ summary: enju_subject plugin
495
475
  test_files:
496
476
  - spec/controllers/classification_types_controller_spec.rb
497
477
  - spec/controllers/classifications_controller_spec.rb
498
- - spec/controllers/subject_heading_type_has_subjects_controller_spec.rb
499
478
  - spec/controllers/subject_heading_types_controller_spec.rb
500
479
  - spec/controllers/subject_types_controller_spec.rb
501
480
  - spec/controllers/subjects_controller_spec.rb
502
- - spec/controllers/work_has_subjects_controller_spec.rb
503
481
  - spec/dummy/app/assets/javascripts/application.js
504
482
  - spec/dummy/app/assets/stylesheets/application.css
505
483
  - spec/dummy/app/controllers/application_controller.rb
@@ -650,7 +628,7 @@ test_files:
650
628
  - spec/dummy/solr/conf/stopwords.txt
651
629
  - spec/dummy/solr/conf/synonyms.txt
652
630
  - spec/dummy/solr/data/test/index/segments.gen
653
- - spec/dummy/solr/data/test/index/segments_1n5
631
+ - spec/dummy/solr/data/test/index/segments_1ss
654
632
  - spec/dummy/solr/data/test/spellchecker/segments.gen
655
633
  - spec/dummy/solr/data/test/spellchecker/segments_1
656
634
  - spec/dummy/spec/fixtures/subjects.yml
@@ -669,7 +647,6 @@ test_files:
669
647
  - spec/factories/subject_heading_type_has_subject.rb
670
648
  - spec/factories/subject_type.rb
671
649
  - spec/factories/user.rb
672
- - spec/factories/work_has_subject.rb
673
650
  - spec/fixtures/carrier_types.yml
674
651
  - spec/fixtures/classification_types.yml
675
652
  - spec/fixtures/classifications.yml
@@ -679,21 +656,17 @@ test_files:
679
656
  - spec/fixtures/patron_types.yml
680
657
  - spec/fixtures/patrons.yml
681
658
  - spec/fixtures/roles.yml
682
- - spec/fixtures/subject_heading_type_has_subjects.yml
683
659
  - spec/fixtures/subject_heading_types.yml
684
660
  - spec/fixtures/subject_types.yml
685
661
  - spec/fixtures/subjects.yml
686
662
  - spec/fixtures/user_groups.yml
687
663
  - spec/fixtures/user_has_roles.yml
688
664
  - spec/fixtures/users.yml
689
- - spec/fixtures/work_has_subjects.yml
690
665
  - spec/models/classification_spec.rb
691
666
  - spec/models/classification_type_spec.rb
692
- - spec/models/subject_heading_type_has_subject_spec.rb
693
667
  - spec/models/subject_heading_type_spec.rb
694
668
  - spec/models/subject_spec.rb
695
669
  - spec/models/subject_type_spec.rb
696
- - spec/models/work_has_subject_spec.rb
697
670
  - spec/requests/subjects_spec.rb
698
671
  - spec/routing/subject_heading_types_routing_spec.rb
699
672
  - spec/routing/subject_types_routing_spec.rb
@@ -1,80 +0,0 @@
1
- class SubjectHeadingTypeHasSubjectsController < ApplicationController
2
- load_and_authorize_resource
3
- cache_sweeper :subject_sweeper, :only => [:create, :update, :destroy]
4
-
5
- # GET /subject_heading_type_has_subjects
6
- # GET /subject_heading_type_has_subjects.json
7
- def index
8
- @subject_heading_type_has_subjects = SubjectHeadingTypeHasSubject.page(params[:page])
9
-
10
- respond_to do |format|
11
- format.html # index.html.erb
12
- format.json { render :json => @subject_heading_type_has_subjects }
13
- end
14
- end
15
-
16
- # GET /subject_heading_type_has_subjects/1
17
- # GET /subject_heading_type_has_subjects/1.json
18
- def show
19
- respond_to do |format|
20
- format.html # show.html.erb
21
- format.json { render :json => @subject_heading_type_has_subject }
22
- end
23
- end
24
-
25
- # GET /subject_heading_type_has_subjects/new
26
- # GET /subject_heading_type_has_subjects/new.json
27
- def new
28
- @subject_heading_type_has_subject = SubjectHeadingTypeHasSubject.new
29
-
30
- respond_to do |format|
31
- format.html # new.html.erb
32
- format.json { render :json => @subject_heading_type_has_subject }
33
- end
34
- end
35
-
36
- # GET /subject_heading_type_has_subjects/1/edit
37
- def edit
38
- end
39
-
40
- # POST /subject_heading_type_has_subjects
41
- # POST /subject_heading_type_has_subjects.json
42
- def create
43
- @subject_heading_type_has_subject = SubjectHeadingTypeHasSubject.new(params[:subject_heading_type_has_subject])
44
-
45
- respond_to do |format|
46
- if @subject_heading_type_has_subject.save
47
- format.html { redirect_to @subject_heading_type_has_subject, :notice => 'SubjectHeadingTypeHasSubject was successfully created.' }
48
- format.json { render :json => @subject_heading_type_has_subject, :status => :created, :location => @subject_heading_type_has_subject }
49
- else
50
- format.html { render :action => "new" }
51
- format.json { render :json => @subject_heading_type_has_subject.errors, :status => :unprocessable_entity }
52
- end
53
- end
54
- end
55
-
56
- # PUT /subject_heading_type_has_subjects/1
57
- # PUT /subject_heading_type_has_subjects/1.json
58
- def update
59
- respond_to do |format|
60
- if @subject_heading_type_has_subject.update_attributes(params[:subject_heading_type_has_subject])
61
- format.html { redirect_to @subject_heading_type_has_subject, :notice => 'SubjectHeadingTypeHasSubject was successfully updated.' }
62
- format.json { head :no_content }
63
- else
64
- format.html { render :action => "edit" }
65
- format.json { render :json => @subject_heading_type_has_subject.errors, :status => :unprocessable_entity }
66
- end
67
- end
68
- end
69
-
70
- # DELETE /subject_heading_type_has_subjects/1
71
- # DELETE /subject_heading_type_has_subjects/1.json
72
- def destroy
73
- @subject_heading_type_has_subject.destroy
74
-
75
- respond_to do |format|
76
- format.html { redirect_to subject_heading_type_has_subjects_url }
77
- format.json { head :no_content }
78
- end
79
- end
80
- end
@@ -1,107 +0,0 @@
1
- class WorkHasSubjectsController < ApplicationController
2
- load_and_authorize_resource
3
- helper_method :get_work, :get_subject
4
- after_filter :solr_commit, :only => [:create, :update, :destroy]
5
- cache_sweeper :subject_sweeper, :only => [:create, :update, :destroy]
6
-
7
- # GET /work_has_subjects
8
- # GET /work_has_subjects.json
9
- def index
10
- get_work; get_subject
11
- if @work
12
- @work_has_subjects = @work.work_has_subjects.page(params[:page])
13
- elsif @subject
14
- @work_has_subjects = @subject.work_has_subjects.page(params[:page])
15
- else
16
- @work_has_subjects = WorkHasSubject.page(params[:page])
17
- end
18
-
19
- respond_to do |format|
20
- format.html # index.html.erb
21
- format.json { render :json => @work_has_subjects }
22
- end
23
- end
24
-
25
- # GET /work_has_subjects/1
26
- # GET /work_has_subjects/1.json
27
- def show
28
- respond_to do |format|
29
- format.html # show.html.erb
30
- format.json { render :json => @work_has_subject }
31
- end
32
- end
33
-
34
- # GET /work_has_subjects/new
35
- # GET /work_has_subjects/new.json
36
- def new
37
- get_work; get_subject
38
- @work_has_subject = WorkHasSubject.new(:work => @work, :subject => @subject)
39
-
40
- respond_to do |format|
41
- format.html # new.html.erb
42
- format.json { render :json => @work_has_subject }
43
- end
44
- end
45
-
46
- # GET /work_has_subjects/1/edit
47
- def edit
48
- end
49
-
50
- # POST /work_has_subjects
51
- # POST /work_has_subjects.json
52
- def create
53
- @work_has_subject = WorkHasSubject.new(params[:work_has_subject])
54
-
55
- respond_to do |format|
56
- if @work_has_subject.save
57
- format.html { redirect_to @work_has_subject, :notice => t('controller.successfully_created', :model => t('activerecord.models.work_has_subject')) }
58
- format.json { render :json => @work_has_subject, :status => :created, :location => @work_has_subject }
59
- else
60
- format.html { render :action => "new" }
61
- format.json { render :json => @work_has_subject.errors, :status => :unprocessable_entity }
62
- end
63
- end
64
- end
65
-
66
- # PUT /work_has_subjects/1
67
- # PUT /work_has_subjects/1.json
68
- def update
69
- get_work
70
- if @work and params[:move]
71
- move_position(@work_has_subject, params[:move], false)
72
- redirect_to work_work_has_subjects_url(@work)
73
- return
74
- end
75
-
76
- respond_to do |format|
77
- if @work_has_subject.update_attributes(params[:work_has_subject])
78
- format.html { redirect_to @work_has_subject, :notice => t('controller.successfully_updated', :model => t('activerecord.models.work_has_subject')) }
79
- format.json { head :no_content }
80
- else
81
- format.html { render :action => "edit" }
82
- format.json { render :json => @work_has_subject.errors, :status => :unprocessable_entity }
83
- end
84
- end
85
- end
86
-
87
- # DELETE /work_has_subjects/1
88
- # DELETE /work_has_subjects/1.json
89
- def destroy
90
- get_work; get_subject
91
- @work_has_subject.destroy
92
-
93
- respond_to do |format|
94
- format.html {
95
- case
96
- when @work
97
- redirect_to work_work_has_subjects_url(@work)
98
- when @subject
99
- redirect_to subject_work_has_subjects_url(@subject)
100
- else
101
- redirect_to work_has_subjects_url
102
- end
103
- }
104
- format.json { head :no_content }
105
- end
106
- end
107
- end
@@ -1,22 +0,0 @@
1
- class SubjectHeadingTypeHasSubject < ActiveRecord::Base
2
- attr_accessible :subject_id, :subject_heading_type_id
3
- belongs_to :subject #, :polymorphic => true
4
- belongs_to :subject_heading_type
5
-
6
- validates_presence_of :subject, :subject_heading_type
7
- validates_associated :subject, :subject_heading_type
8
- validates_uniqueness_of :subject_id, :scope => :subject_heading_type_id
9
- end
10
-
11
- # == Schema Information
12
- #
13
- # Table name: subject_heading_type_has_subjects
14
- #
15
- # id :integer not null, primary key
16
- # subject_id :integer not null
17
- # subject_type :string(255)
18
- # subject_heading_type_id :integer not null
19
- # created_at :datetime not null
20
- # updated_at :datetime not null
21
- #
22
-
@@ -1,32 +0,0 @@
1
- class WorkHasSubject < ActiveRecord::Base
2
- attr_accessible :subject_id, :work_id, :position
3
- belongs_to :subject
4
- belongs_to :work, :class_name => 'Manifestation'
5
-
6
- validates_presence_of :work, :subject #, :subject_type
7
- validates_associated :work, :subject
8
- validates_uniqueness_of :subject_id, :scope => :work_id
9
- after_save :reindex
10
- after_destroy :reindex
11
-
12
- acts_as_list :scope => :work_id
13
-
14
- def reindex
15
- work.try(:index)
16
- subject.try(:index)
17
- end
18
- end
19
-
20
- # == Schema Information
21
- #
22
- # Table name: work_has_subjects
23
- #
24
- # id :integer not null, primary key
25
- # subject_id :integer
26
- # subject_type :string(255)
27
- # work_id :integer
28
- # position :integer
29
- # created_at :datetime not null
30
- # updated_at :datetime not null
31
- #
32
-
@@ -1,48 +0,0 @@
1
- <div id="content_detail" class="ui-corner-all">
2
- <h1 class="title"><%= t('page.listing', :model => t('activerecord.models.subject')) -%></h1>
3
- <div id="content_list">
4
-
5
- <div class="search_form">
6
- <%= form_for :subjects, :url => subjects_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.subject.term') -%></th>
17
- <th></th>
18
- </tr>
19
- <%- subjects.each do |subject| -%>
20
- <tr class="line<%= cycle("0", "1") -%>">
21
- <td><%= link_to subject.term, subject -%></td>
22
- <td>
23
- <%- if can? :update, subject -%>
24
- <%= link_to t('page.edit'), edit_subject_path(subject) -%>
25
- <%- end -%>
26
- <%- if can? :delete, subject -%>
27
- <%= link_to t('page.destroy'), subject, :data => {:confirm => t('page.are_you_sure')}, :method => :delete -%>
28
- <%- end -%>
29
- </td>
30
- </tr>
31
- <%- end -%>
32
- </table>
33
-
34
- <%= paginate(subjects) -%>
35
- </div>
36
- </div>
37
-
38
- <div id="submenu" class="ui-corner-all">
39
- <ul>
40
- <%- if can? :create, Subject -%>
41
- <%- if @subject_heading_type -%>
42
- <li><%= link_to t('page.new', :model => t('activerecord.models.subject')), new_subject_heading_type_subject_path(@subject_heading_type) -%></li>
43
- <%- else -%>
44
- <li><%= link_to t('page.new', :model => t('activerecord.models.subject')), new_subject_path -%></li>
45
- <%- end -%>
46
- <%- end -%>
47
- </ul>
48
- </div>