enju_biblio 0.1.0.pre36 → 0.1.0.pre37

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/scaffold.css +56 -0
  3. data/app/controllers/manifestations_controller.rb +18 -22
  4. data/app/controllers/series_statements_controller.rb +6 -35
  5. data/app/models/enju_biblio/ability.rb +2 -4
  6. data/app/models/manifestation.rb +75 -92
  7. data/app/models/series_statement.rb +13 -18
  8. data/app/views/manifestations/_edit_detail.html.erb +10 -0
  9. data/app/views/manifestations/_form.html.erb +49 -34
  10. data/app/views/manifestations/_manifestation.html.erb +2 -12
  11. data/app/views/manifestations/_show_detail_librarian.html.erb +3 -33
  12. data/app/views/manifestations/_show_detail_user.html.erb +3 -18
  13. data/app/views/manifestations/_show_parent.html.erb +0 -12
  14. data/app/views/manifestations/_show_series_detail.html.erb +26 -0
  15. data/app/views/manifestations/show.html.erb +1 -27
  16. data/app/views/series_statements/_form.html.erb +1 -1
  17. data/app/views/series_statements/_index.html.erb +3 -11
  18. data/app/views/series_statements/show.html.erb +22 -30
  19. data/config/locales/translation_en.yml +2 -0
  20. data/config/locales/translation_ja.yml +2 -0
  21. data/config/routes.rb +3 -7
  22. data/db/migrate/005_create_manifestations.rb +4 -3
  23. data/db/migrate/20081028083142_create_patron_import_files.rb +1 -1
  24. data/db/migrate/20081028083208_create_resource_import_files.rb +1 -1
  25. data/lib/enju_biblio/biblio_helper.rb +1 -1
  26. data/lib/enju_biblio/version.rb +1 -1
  27. data/spec/controllers/import_requests_controller_spec.rb +1 -1
  28. data/spec/controllers/manifestations_controller_spec.rb +0 -6
  29. data/spec/controllers/series_statements_controller_spec.rb +4 -4
  30. data/spec/dummy/app/controllers/application_controller.rb +1 -0
  31. data/spec/dummy/app/models/ability.rb +2 -4
  32. data/spec/dummy/config/application.rb +1 -0
  33. data/spec/dummy/db/development.sqlite3 +0 -0
  34. data/spec/dummy/db/migrate/029_create_subjects.rb +27 -0
  35. data/spec/dummy/db/migrate/142_create_classifications.rb +19 -0
  36. data/spec/dummy/db/migrate/144_create_classification_types.rb +16 -0
  37. data/spec/dummy/db/migrate/145_create_subject_heading_types.rb +16 -0
  38. data/spec/dummy/db/migrate/146_create_subject_types.rb +16 -0
  39. data/spec/dummy/db/migrate/20080606052544_create_work_has_subjects.rb +18 -0
  40. data/spec/dummy/db/migrate/20090208044541_create_subject_heading_type_has_subjects.rb +16 -0
  41. data/spec/dummy/db/migrate/20110913120629_add_lft_and_rgt_to_classification.rb +11 -0
  42. data/spec/dummy/db/migrate/20120406020752_add_url_to_subject.rb +5 -0
  43. data/spec/dummy/db/migrate/20130504133816_add_manifestation_id_to_subject.rb +6 -0
  44. data/spec/dummy/db/migrate/20130504143515_add_manifestation_id_to_classification.rb +6 -0
  45. data/spec/dummy/db/schema.rb +92 -9
  46. data/spec/dummy/db/test.sqlite3 +0 -0
  47. data/spec/dummy/solr/data/test/index/segments.gen +0 -0
  48. data/spec/dummy/solr/data/test/index/segments_l8s +0 -0
  49. data/spec/dummy/tmp/cache/4AD/470/country_all +0 -0
  50. data/spec/fixtures/manifestations.yml +66 -70
  51. data/spec/fixtures/series_statements.yml +1 -1
  52. data/spec/fixtures/subject_types.yml +28 -0
  53. data/spec/models/import_request_spec.rb +2 -0
  54. data/spec/models/manifestation_spec.rb +66 -70
  55. data/spec/models/series_statement_spec.rb +1 -0
  56. metadata +35 -37
  57. data/app/controllers/series_statement_relationships_controller.rb +0 -20
  58. data/app/models/series_statement_relationship.rb +0 -30
  59. data/app/views/series_statement_relationships/_form.html.erb +0 -27
  60. data/app/views/series_statement_relationships/edit.html.erb +0 -15
  61. data/app/views/series_statement_relationships/index.html.erb +0 -34
  62. data/app/views/series_statement_relationships/new.html.erb +0 -14
  63. data/app/views/series_statement_relationships/show.html.erb +0 -24
  64. data/app/views/series_statements/_index_parent.html.erb +0 -53
  65. data/app/views/series_statements/_manifestation_list.html.erb +0 -17
  66. data/db/migrate/20110916053430_rename_manifestation_number_list_to_number_string.rb +0 -13
  67. data/db/migrate/20120415060308_rename_resource_import_file_imported_at_to_executed_at.rb +0 -9
  68. data/db/migrate/20120415060323_rename_patron_import_file_imported_at_to_executed_at.rb +0 -9
  69. data/db/migrate/20120728204337_create_series_statement_relationships.rb +0 -11
  70. data/spec/controllers/series_statement_relationships_controller_spec.rb +0 -179
  71. data/spec/dummy/solr/data/test/index/segments_iwe +0 -0
  72. data/spec/models/series_statement_relationship_spec.rb +0 -17
  73. data/spec/requests/series_statement_relationships_spec.rb +0 -11
  74. data/spec/routing/series_statement_relationships_routing_spec.rb +0 -35
  75. data/spec/views/series_statement_relationships/edit.html.erb_spec.rb +0 -20
  76. data/spec/views/series_statement_relationships/index.html.erb_spec.rb +0 -23
  77. data/spec/views/series_statement_relationships/new.html.erb_spec.rb +0 -20
  78. data/spec/views/series_statement_relationships/show.html.erb_spec.rb +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5caef6f3a30d5dcd1d31fbee67731c0c51473db1
4
- data.tar.gz: 3ec65c71e7689f0b8fad787a469e003dd47c15e3
3
+ metadata.gz: 41a6675a780e68eea3ee082220ebb165f09b927b
4
+ data.tar.gz: af7fbb006e722aacad738bca1f303755629a317e
5
5
  SHA512:
6
- metadata.gz: 3fe4d121fff219e8a6b2205a0b300d3c4e4b65be960beaab3df2701e4db24330e33e42ba144ddb24a8493f18f54c24998686845f472d886cfa6be875ebe9bcdd
7
- data.tar.gz: 5f64907e365a4bad74e5e5174c64d3741e3dbb6e9cd611e4caf8bccf9ef5af2b09974a145a1fb9ea65a27084abe5b08eb4d1da6d14ec9fcfc8d54a848353f8f0
6
+ metadata.gz: f73678cf486d992ce16bab6427e91982fe5be32e87986dc5c1caec236154b8d14c6609a6808eb5c3c13d0f80fc77bbf7a727922af6be211c0f406c4af2868ebb
7
+ data.tar.gz: e296e9fa6733baffa7363734cfc2b63f2b8a15be0269edb60a94231e88ea5a0a163c684cff8e9cfeb72bf931bccaa196727213fca04064a1e7c12c78a00ed77a
@@ -0,0 +1,56 @@
1
+ body { background-color: #fff; color: #333; }
2
+
3
+ body, p, ol, ul, td {
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ }
8
+
9
+ pre {
10
+ background-color: #eee;
11
+ padding: 10px;
12
+ font-size: 11px;
13
+ }
14
+
15
+ a { color: #000; }
16
+ a:visited { color: #666; }
17
+ a:hover { color: #fff; background-color:#000; }
18
+
19
+ div.field, div.actions {
20
+ margin-bottom: 10px;
21
+ }
22
+
23
+ #notice {
24
+ color: green;
25
+ }
26
+
27
+ .field_with_errors {
28
+ padding: 2px;
29
+ background-color: red;
30
+ display: table;
31
+ }
32
+
33
+ #error_explanation {
34
+ width: 450px;
35
+ border: 2px solid red;
36
+ padding: 7px;
37
+ padding-bottom: 0;
38
+ margin-bottom: 20px;
39
+ background-color: #f0f0f0;
40
+ }
41
+
42
+ #error_explanation h2 {
43
+ text-align: left;
44
+ font-weight: bold;
45
+ padding: 5px 5px 5px 15px;
46
+ font-size: 12px;
47
+ margin: -7px;
48
+ margin-bottom: 0px;
49
+ background-color: #c00;
50
+ color: #fff;
51
+ }
52
+
53
+ #error_explanation ul li {
54
+ font-size: 12px;
55
+ list-style: square;
56
+ }
@@ -125,7 +125,6 @@ class ManifestationsController < ApplicationController
125
125
  with(:creator_ids).equal_to patron[:creator].id if patron[:creator]
126
126
  with(:contributor_ids).equal_to patron[:contributor].id if patron[:contributor]
127
127
  with(:publisher_ids).equal_to patron[:publisher].id if patron[:publisher]
128
- with(:original_manifestation_ids).equal_to manifestation.id if manifestation
129
128
  with(:series_statement_ids).equal_to series_statement.id if series_statement
130
129
  with(:parent_ids).equal_to parent.id if parent
131
130
  end
@@ -153,7 +152,7 @@ class ManifestationsController < ApplicationController
153
152
  #end
154
153
  else
155
154
  if mode != 'add'
156
- with(:periodical).equal_to false
155
+ with(:resource_master).equal_to true
157
156
  end
158
157
  end
159
158
  end
@@ -182,7 +181,8 @@ class ManifestationsController < ApplicationController
182
181
  :issue_number,
183
182
  :serial_number,
184
183
  :edition_string,
185
- :edition
184
+ :edition,
185
+ :periodical
186
186
  ] if params[:format] == 'html' or params[:format].nil?
187
187
  all_result = search.execute
188
188
  @count[:query_result] = all_result.total
@@ -447,7 +447,6 @@ class ManifestationsController < ApplicationController
447
447
  @manifestation.original_title = parent.original_title
448
448
  @manifestation.title_transcription = parent.title_transcription
449
449
  @manifestation.periodical = true if parent.periodical
450
- @manifestation.series_statements.new(:original_title => parent.root_series_statement.original_title)
451
450
  end
452
451
 
453
452
  respond_to do |format|
@@ -463,9 +462,6 @@ class ManifestationsController < ApplicationController
463
462
  access_denied; return
464
463
  end
465
464
  end
466
- if defined?(EnjuSubject)
467
- @classification_types = ClassificationType.select(:display_name)
468
- end
469
465
  if defined?(EnjuBookmark)
470
466
  if params[:mode] == 'tag_edit'
471
467
  @bookmark = current_user.bookmarks.where(:manifestation_id => @manifestation.id).first if @manifestation rescue nil
@@ -485,9 +481,12 @@ class ManifestationsController < ApplicationController
485
481
  end
486
482
 
487
483
  respond_to do |format|
488
- set_patrons
489
484
  if @manifestation.save
490
- parent.derived_manifestations << @manifestation if parent
485
+ if parent
486
+ parent.derived_manifestations << @manifestation
487
+ parent.index
488
+ @manifestation.index
489
+ end
491
490
  Sunspot.commit
492
491
 
493
492
  format.html { redirect_to @manifestation, :notice => t('controller.successfully_created', :model => t('activerecord.models.manifestation')) }
@@ -505,7 +504,6 @@ class ManifestationsController < ApplicationController
505
504
  def update
506
505
  respond_to do |format|
507
506
  if @manifestation.update_attributes(params[:manifestation])
508
- set_patrons
509
507
  Sunspot.commit
510
508
  format.html { redirect_to @manifestation, :notice => t('controller.successfully_updated', :model => t('activerecord.models.manifestation')) }
511
509
  format.json { head :no_content }
@@ -676,12 +674,16 @@ class ManifestationsController < ApplicationController
676
674
  end
677
675
 
678
676
  def prepare_options
679
- @carrier_types = CarrierType.all
680
- @content_types = ContentType.all
681
- @roles = Role.all
682
- @languages = Language.all_cache
683
- @frequencies = Frequency.all
684
- @nii_types = NiiType.all if defined?(EnjuNii)
677
+ @carrier_types = CarrierType.select([:id, :display_name, :position])
678
+ @content_types = ContentType.select([:id, :display_name, :position])
679
+ @roles = Role.select([:id, :display_name, :position])
680
+ @languages = Language.select([:id, :display_name, :position])
681
+ @frequencies = Frequency.select([:id, :display_name, :position])
682
+ @nii_types = NiiType.select([:id, :display_name, :position]) if defined?(EnjuNii)
683
+ if defined?(EnjuSubject)
684
+ @subject_types = SubjectType.select([:id, :display_name, :position])
685
+ @classification_types = ClassificationType.select([:id, :display_name, :position])
686
+ end
685
687
  end
686
688
 
687
689
  def get_index_patron
@@ -769,10 +771,4 @@ class ManifestationsController < ApplicationController
769
771
  end
770
772
  query
771
773
  end
772
-
773
- def set_patrons
774
- @manifestation.set_creators(@manifestation.creators)
775
- @manifestation.set_contributors(@manifestation.contributors)
776
- @manifestation.set_publishers(@manifestation.publishers)
777
- end
778
774
  end
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  class SeriesStatementsController < ApplicationController
3
3
  load_and_authorize_resource
4
- before_filter :get_work, :get_manifestation, :get_parent_and_child, :except => [:create, :update, :destroy]
4
+ before_filter :get_manifestation, :except => [:create, :update, :destroy]
5
5
  cache_sweeper :page_sweeper, :only => [:create, :update, :destroy]
6
6
  after_filter :solr_commit, :only => [:create, :update, :destroy]
7
7
  if defined?(EnjuResourceMerge)
@@ -26,21 +26,10 @@ class SeriesStatementsController < ApplicationController
26
26
  end
27
27
  #work = @work
28
28
  manifestation = @manifestation
29
- parent = @parent
30
- child = @child
31
29
  series_statement_merge_list = @series_statement_merge_list
32
- unless params[:mode] == 'add'
33
- search.build do
34
- # with(:work_id).equal_to work.id if work
35
- with(:parent_ids).equal_to parent.id if parent
36
- with(:child_ids).equal_to child.id if child
37
- with(:manifestation_id).equal_to manifestation.id if manifestation
38
- with(:series_statement_merge_list_ids).equal_to series_statement_merge_list.id if series_statement_merge_list
39
- end
40
- else
41
- search.build do
42
- without(:parent_ids, parent.id) if parent
43
- end
30
+ search.build do
31
+ with(:manifestation_id).equal_to manifestation.id if manifestation
32
+ with(:series_statement_merge_list_ids).equal_to series_statement_merge_list.id if series_statement_merge_list
44
33
  end
45
34
  page = params[:page] || 1
46
35
  search.query.paginate(page.to_i, SeriesStatement.default_per_page)
@@ -56,18 +45,11 @@ class SeriesStatementsController < ApplicationController
56
45
  # GET /series_statements/1
57
46
  # GET /series_statements/1.json
58
47
  def show
59
- #@manifestations = @series_statement.manifestations.order('date_of_publication DESC').page(params[:manifestation_page]).per(Manifestation.default_per_page)
60
- #store_location
61
-
62
48
  respond_to do |format|
63
- format.html { # show.html.erb
64
- redirect_to series_statement_manifestations_url(@series_statement)
65
- }
49
+ format.html # show.html.erb
66
50
  format.json { render :json => @series_statement }
67
51
  #format.js
68
- format.mobile {
69
- redirect_to series_statement_manifestations_url(@series_statement)
70
- }
52
+ #format.mobile
71
53
  end
72
54
  end
73
55
 
@@ -75,8 +57,6 @@ class SeriesStatementsController < ApplicationController
75
57
  # GET /series_statements/new.json
76
58
  def new
77
59
  @series_statement = SeriesStatement.new
78
- @frequencies = Frequency.all
79
- @series_statement.parent = @parent_series_statement if @parent_series_statement
80
60
 
81
61
  respond_to do |format|
82
62
  format.html # new.html.erb
@@ -86,9 +66,6 @@ class SeriesStatementsController < ApplicationController
86
66
 
87
67
  # GET /series_statements/1/edit
88
68
  def edit
89
- @series_statement.work = @work if @work
90
- @frequencies = Frequency.all
91
- @series_statement.parent = @parent_series_statement if @parent_series_statement
92
69
  end
93
70
 
94
71
  # POST /series_statements
@@ -140,10 +117,4 @@ class SeriesStatementsController < ApplicationController
140
117
  format.json { head :no_content }
141
118
  end
142
119
  end
143
-
144
- private
145
- def get_parent_and_child
146
- @parent = SeriesStatement.find(params[:parent_id]) if params[:parent_id]
147
- @child = SeriesStatement.find(params[:child_id]) if params[:child_id]
148
- end
149
120
  end
@@ -36,8 +36,7 @@ module EnjuBiblio
36
36
  Realize,
37
37
  RealizeType,
38
38
  ResourceImportFile,
39
- SeriesStatement,
40
- SeriesStatementRelationship
39
+ SeriesStatement
41
40
  ]
42
41
  can :update, [
43
42
  ContentType,
@@ -95,8 +94,7 @@ module EnjuBiblio
95
94
  Produce,
96
95
  Realize,
97
96
  ResourceImportFile,
98
- SeriesStatement,
99
- SeriesStatementRelationship
97
+ SeriesStatement
100
98
  ]
101
99
  can :read, [
102
100
  CarrierType,
@@ -513,35 +513,22 @@ class Manifestation < ActiveRecord::Base
513
513
  }.compact
514
514
  end
515
515
 
516
- def set_creators(creators = [])
517
- self.creators = set_patrons(creators)
518
- end
519
-
520
- def set_contributors(contributors = [])
521
- self.contributors = set_patrons(contributors)
522
- end
523
-
524
- def set_publishers(publishers = [])
525
- self.publishers = set_patrons(publishers)
526
- end
527
-
528
516
  def self.import_isbn(isbn)
529
517
  manifestation = Manifestation.import_from_ndl_search(:isbn => isbn) if defined?(EnjuNdl)
530
518
  #manifestation = Manifestation.import_from_cinii_books(:isbn => isbn) if defined?(EnjuNii)
531
519
  manifestation
532
520
  end
533
521
 
534
- private
535
- def set_patrons(patrons)
536
- new_patrons = []
537
- patrons.each do |patron|
538
- if patron.full_name.present?
539
- new_patron = Patron.where(:full_name => patron.full_name).first
540
- new_patron = Patron.create(:full_name => patron.full_name) unless new_patron
541
- end
542
- new_patrons << new_patron if new_patron
522
+ def latest_issue
523
+ if series_master?
524
+ derived_manifestations.where('date_of_publication IS NOT NULL').order('date_of_publication DESC').first
525
+ end
526
+ end
527
+
528
+ def first_issue
529
+ if series_master?
530
+ derived_manifestations.where('date_of_publication IS NOT NULL').order('date_of_publication DESC').first
543
531
  end
544
- new_patrons
545
532
  end
546
533
  end
547
534
 
@@ -549,75 +536,71 @@ end
549
536
  #
550
537
  # Table name: manifestations
551
538
  #
552
- # id :integer not null, primary key
553
- # original_title :text not null
554
- # title_alternative :text
555
- # title_transcription :text
556
- # classification_number :string(255)
557
- # manifestation_identifier :string(255)
558
- # date_of_publication :datetime
559
- # date_copyrighted :datetime
560
- # created_at :datetime not null
561
- # updated_at :datetime not null
562
- # deleted_at :datetime
563
- # access_address :string(255)
564
- # language_id :integer default(1), not null
565
- # carrier_type_id :integer default(1), not null
566
- # extent_id :integer default(1), not null
567
- # start_page :integer
568
- # end_page :integer
569
- # height :integer
570
- # width :integer
571
- # depth :integer
572
- # isbn :string(255)
573
- # isbn10 :string(255)
574
- # wrong_isbn :string(255)
575
- # nbn :string(255)
576
- # lccn :string(255)
577
- # oclc_number :string(255)
578
- # issn :string(255)
579
- # price :integer
580
- # fulltext :text
581
- # volume_number_string :string(255)
582
- # issue_number_string :string(255)
583
- # serial_number_string :string(255)
584
- # edition :integer
585
- # note :text
586
- # repository_content :boolean default(FALSE), not null
587
- # lock_version :integer default(0), not null
588
- # required_role_id :integer default(1), not null
589
- # state :string(255)
590
- # required_score :integer default(0), not null
591
- # frequency_id :integer default(1), not null
592
- # subscription_master :boolean default(FALSE), not null
593
- # attachment_file_name :string(255)
594
- # attachment_content_type :string(255)
595
- # attachment_file_size :integer
596
- # attachment_updated_at :datetime
597
- # title_alternative_transcription :text
598
- # description :text
599
- # abstract :text
600
- # available_at :datetime
601
- # valid_until :datetime
602
- # date_submitted :datetime
603
- # date_accepted :datetime
604
- # date_caputured :datetime
605
- # pub_date :string(255)
606
- # edition_string :string(255)
607
- # volume_number :integer
608
- # issue_number :integer
609
- # serial_number :integer
610
- # ndc :string(255)
611
- # content_type_id :integer default(1)
612
- # year_of_publication :integer
613
- # attachment_meta :text
614
- # month_of_publication :integer
615
- # fulltext_content :boolean
616
- # doi :string(255)
617
- # periodical :boolean
618
- # series_original_title :text
619
- # series_title_transcription :text
620
- # series_title_creator_string :text
621
- # series_title_volume_number_string :text
539
+ # id :integer not null, primary key
540
+ # original_title :text not null
541
+ # title_alternative :text
542
+ # title_transcription :text
543
+ # classification_number :string(255)
544
+ # manifestation_identifier :string(255)
545
+ # date_of_publication :datetime
546
+ # date_copyrighted :datetime
547
+ # created_at :datetime not null
548
+ # updated_at :datetime not null
549
+ # deleted_at :datetime
550
+ # access_address :string(255)
551
+ # language_id :integer default(1), not null
552
+ # carrier_type_id :integer default(1), not null
553
+ # extent_id :integer default(1), not null
554
+ # start_page :integer
555
+ # end_page :integer
556
+ # height :integer
557
+ # width :integer
558
+ # depth :integer
559
+ # isbn :string(255)
560
+ # isbn10 :string(255)
561
+ # wrong_isbn :string(255)
562
+ # nbn :string(255)
563
+ # lccn :string(255)
564
+ # oclc_number :string(255)
565
+ # issn :string(255)
566
+ # price :integer
567
+ # fulltext :text
568
+ # volume_number_string :string(255)
569
+ # issue_number_string :string(255)
570
+ # serial_number_string :string(255)
571
+ # edition :integer
572
+ # note :text
573
+ # repository_content :boolean default(FALSE), not null
574
+ # lock_version :integer default(0), not null
575
+ # required_role_id :integer default(1), not null
576
+ # state :string(255)
577
+ # required_score :integer default(0), not null
578
+ # frequency_id :integer default(1), not null
579
+ # subscription_master :boolean default(FALSE), not null
580
+ # attachment_file_name :string(255)
581
+ # attachment_content_type :string(255)
582
+ # attachment_file_size :integer
583
+ # attachment_updated_at :datetime
584
+ # title_alternative_transcription :text
585
+ # description :text
586
+ # abstract :text
587
+ # available_at :datetime
588
+ # valid_until :datetime
589
+ # date_submitted :datetime
590
+ # date_accepted :datetime
591
+ # date_caputured :datetime
592
+ # pub_date :string(255)
593
+ # edition_string :string(255)
594
+ # volume_number :integer
595
+ # issue_number :integer
596
+ # serial_number :integer
597
+ # ndc :string(255)
598
+ # content_type_id :integer default(1)
599
+ # year_of_publication :integer
600
+ # attachment_meta :text
601
+ # month_of_publication :integer
602
+ # fulltext_content :boolean
603
+ # doi :string(255)
604
+ # periodical :boolean
622
605
  #
623
606
 
@@ -1,19 +1,15 @@
1
1
  class SeriesStatement < ActiveRecord::Base
2
2
  attr_accessible :original_title, :numbering, :title_subseries,
3
3
  :numbering_subseries, :title_transcription, :title_alternative,
4
- :series_statement_identifier, :note, :series_master,
5
- :root_manifestation_id,
4
+ :series_statement_identifier, :note,
5
+ :root_manifestation_id, :url,
6
6
  :title_subseries_transcription, :creator_string, :volume_number_string
7
- attr_accessible :url, :frequency_id
7
+ attr_accessible :series_master
8
8
 
9
9
  belongs_to :manifestation
10
10
  belongs_to :root_manifestation, :foreign_key => :root_manifestation_id, :class_name => 'Manifestation'
11
- has_many :child_relationships, :foreign_key => 'parent_id', :class_name => 'SeriesStatementRelationship', :dependent => :destroy
12
- has_many :parent_relationships, :foreign_key => 'child_id', :class_name => 'SeriesStatementRelationship', :dependent => :destroy
13
- has_many :children, :through => :child_relationships, :source => :child
14
- has_many :parents, :through => :parent_relationships, :source => :parent
15
- belongs_to :frequency
16
11
  validates_presence_of :original_title
12
+ before_save :create_root_series_statement
17
13
 
18
14
  acts_as_list
19
15
  searchable do
@@ -24,12 +20,6 @@ class SeriesStatement < ActiveRecord::Base
24
20
  integer :manifestation_id
25
21
  integer :position
26
22
  integer :series_statement_merge_list_ids, :multiple => true if defined?(EnjuResourceMerge)
27
- integer :parent_ids, :multiple => true do
28
- parents.pluck('series_statements.id')
29
- end
30
- integer :child_ids, :multiple => true do
31
- children.pluck('series_statements.id')
32
- end
33
23
  end
34
24
 
35
25
  attr_accessor :selected
@@ -40,10 +30,14 @@ class SeriesStatement < ActiveRecord::Base
40
30
  def titles
41
31
  [
42
32
  original_title,
43
- title_transcription,
44
- parents.map{|parent| [parent.original_title, parent.title_transcription]},
45
- children.map{|child| [child.original_title, child.title_transcription]}
46
- ].flatten.compact
33
+ title_transcription
34
+ ]
35
+ end
36
+
37
+ def create_root_series_statement
38
+ if series_master? and root_manifestation.nil?
39
+ self.root_manifestation = manifestation
40
+ end
47
41
  end
48
42
 
49
43
  if defined?(EnjuResourceMerge)
@@ -74,5 +68,6 @@ end
74
68
  # volume_number_string :text
75
69
  # volume_number_transcription_string :text
76
70
  # series_master :boolean
71
+ # root_manifestation_id :integer
77
72
  #
78
73
 
@@ -0,0 +1,10 @@
1
+ <ul>
2
+ <li>
3
+ <%= link_to t('page.edit'), edit_manifestation_path(@manifestation) -%>
4
+ </li>
5
+ <li><%= link_to t('manifestation.edit_item'), manifestation_items_path(@manifestation) -%></li>
6
+ <li><%= link_to t('manifestation.add_derivation'), manifestations_path(:parent_id => @manifestation.id, :mode => 'add') -%></li>
7
+ <% if can? :delete, @manifestation %>
8
+ <li><%= link_to t('page.destroy'), @manifestation, :data => {:confirm => t('page.are_you_sure')}, :method => :delete -%></li>
9
+ <% end %>
10
+ </ul>
@@ -16,16 +16,38 @@
16
16
  </div>
17
17
 
18
18
  <div class="field">
19
- <%= f.label :periodical %><br />
19
+ <%= f.label :periodical %>
20
20
  <%= f.check_box :periodical %>
21
21
  </div>
22
22
 
23
+ <div class="field">
24
+ <%= f.label :edition_string -%>
25
+ <%= f.text_field :edition_string %>
26
+ <%= f.label :edition -%>
27
+ <%= f.text_field :edition, :class => 'resource_integer' -%>
28
+ <br />
29
+ <%= f.label :volume_number_string -%>
30
+ <%= f.text_field :volume_number_string %>
31
+ <%= f.label :volume_number -%>
32
+ <%= f.text_field :volume_number, :class => 'resource_integer' -%>
33
+ <br />
34
+ <%= f.label :issue_number_string -%>
35
+ <%= f.text_field :issue_number_string %>
36
+ <%= f.label :issue_number -%>
37
+ <%= f.text_field :issue_number, :class => 'resource_integer' -%>
38
+ <br />
39
+ <%= f.label :serial_number -%>
40
+ <%= f.text_field :serial_number, :class => 'resource_integer' -%>
41
+ </div>
42
+
23
43
  <div class="field">
24
44
  <%= f.label :series_statement_string -%><br />
25
45
  <%= f.fields_for :series_statements do |series_form| %>
26
46
  <%= f.label :original_title %><br />
27
- <%= series_form.text_field :original_title %>
47
+ <%= series_form.text_field :original_title, :class => 'resource_title' %>
28
48
  <%= series_form.link_to_remove t('page.remove'), :confirm => t('page.are_you_sure') %><br />
49
+ <%= f.label :title_transcription %><br />
50
+ <%= series_form.text_field :title_transcription, :class => 'resource_title' %><br />
29
51
  <%= f.label :volume_number_string %><br />
30
52
  <%= series_form.text_field :volume_number_string %><br />
31
53
  <%= f.label :creator_string %><br />
@@ -63,33 +85,20 @@
63
85
  <p><%= f.link_to_add t('page.add'), :publishers %></p>
64
86
  </div>
65
87
 
66
- <%- if @series_statement.try(:periodical?) -%>
67
- <%= render :partial => 'manifestations/serial_form', :locals => {:f => f, :manifestation => @manifestation} -%>
68
- <%- else -%>
69
- <div class="field">
70
- <%= f.label :edition_string -%>
71
- <%= f.text_field :edition_string %>
72
- <%= f.label :edition -%>
73
- <%= f.text_field :edition, :class => 'resource_integer' -%>
74
- <br />
75
- <%= f.label :volume_number_string -%>
76
- <%= f.text_field :volume_number_string %>
77
- <%= f.label :volume_number -%>
78
- <%= f.text_field :volume_number, :class => 'resource_integer' -%>
79
- </div>
80
- <% end %>
81
-
82
- <div class="field">
83
- <%= f.label t('page.file') -%><br />
88
+ <div class="field">
89
+ <%= f.label :pub_date -%>
90
+ <%= f.text_field :pub_date, :class => 'date_field', :placeholder => "#{t('page.example')}: 2011, 2011-04-12"-%>
91
+ </div>
92
+
93
+ <div class="field">
94
+ <%= f.label t('page.file') -%>
84
95
  <%= f.file_field :attachment -%>
85
96
  </div>
86
97
 
87
98
  <div class="field">
88
99
  <%= f.label t('activerecord.models.content_type') -%>
89
100
  <%= f.select(:content_type_id, @content_types.collect{|c| [c.display_name.localize, c.id]}) -%>
90
- </div>
91
101
 
92
- <div class="field">
93
102
  <%= f.label t('activerecord.models.carrier_type') -%>
94
103
  <%= f.select(:carrier_type_id, @carrier_types.collect{|c| [c.display_name.localize, c.id]}) -%>
95
104
  <!-- TODO: Formの切り替え時に入力項目をAjaxで書き換える -->
@@ -98,14 +107,7 @@
98
107
  <div class="field">
99
108
  <%= f.label t('activerecord.models.frequency') -%>
100
109
  <%= f.select(:frequency_id, @frequencies.collect{|frequency| [frequency.display_name.localize, frequency.id]}) -%>
101
- </div>
102
-
103
- <div class="field">
104
- <%= f.label :pub_date -%>
105
- <%= f.text_field :pub_date, :class => 'date_field', :placeholder => "#{t('page.example')}: 2011, 2011-04-12"-%>
106
- </div>
107
110
 
108
- <div class="field">
109
111
  <%= f.label t('activerecord.models.language') -%>
110
112
  <%= f.select(:language_id, @languages.collect{|language| [language.display_name.localize, language.id]}) -%>
111
113
  </div>
@@ -119,15 +121,28 @@
119
121
  <div class="field">
120
122
  <%= f.label :lccn -%>
121
123
  <%= f.text_field :lccn, :class => 'resource_isbn_issn', :style => 'ime-mode: disabled' -%>
122
- <%- if @series_statement.try(:periodical?) -%>
123
- <%= f.label :issn -%>
124
- <%= f.text_field :issn, :class => 'resource_isbn_issn', :style => 'ime-mode: disabled' -%>
124
+ <%= f.label :issn -%>
125
+ <%= f.text_field :issn, :class => 'resource_isbn_issn', :style => 'ime-mode: disabled' -%>
126
+ </div>
127
+
128
+ <div class="field">
129
+ <%= f.label :subject -%><br />
130
+ <%= f.fields_for :subjects do |subject_form| %>
131
+ <%= subject_form.text_field :term %>
132
+ <%= subject_form.select(:subject_type_id, @subject_types.collect{|s| [s.display_name.localize, s.id]}) %>
133
+ <%= subject_form.link_to_remove t('page.remove'), :confirm => t('page.are_you_sure') %>
125
134
  <% end %>
135
+ <p><%= f.link_to_add t('page.add'), :subjects %></p>
126
136
  </div>
127
137
 
128
138
  <div class="field">
129
- <%= f.label :classification_number -%><br />
130
- <%= f.text_area :classification_number, :class => 'resource_textarea' -%>
139
+ <%= f.label :classification -%><br />
140
+ <%= f.fields_for :classifications do |classification_form| %>
141
+ <%= classification_form.select(:classification_type_id, @classification_types.collect{|c| [c.display_name.localize, c.id]}) %>
142
+ <%= classification_form.text_field :category %>
143
+ <%= classification_form.link_to_remove t('page.remove'), :confirm => t('page.are_you_sure') %>
144
+ <% end %>
145
+ <p><%= f.link_to_add t('page.add'), :classifications %></p>
131
146
  </div>
132
147
 
133
148
  <div class="field">