enju_biblio 0.4.0.beta.1 → 0.4.0.beta.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 25f3dd27c99737a4cfbba700c0963f4352b7e237bf30bdea0bf9c446208906be
4
- data.tar.gz: 544ee9521de65fb2cc918332e4c15ca88a89b346a021f7ca9a0bdabdb66841d5
3
+ metadata.gz: d1cdac00c9fb0f997f28937e780c89f0ca4d25c7d387afd33744410579f5f6e0
4
+ data.tar.gz: a5fc966b6ece6ad34d394f60664fa4661a9d9457b61360e5d8c50ad8e36c6d26
5
5
  SHA512:
6
- metadata.gz: 139f55a88e3958bfe75f687fac126219a964d15485bde0e66e264f54244cd550c4b44d284130582026090267de93693fbdcbaf2cf117166e34c0b2c62ccddc54
7
- data.tar.gz: 895a8713dea2a69800fd2aa0edf8842ef20f9c9ebae86c92aff7d6c014fb5f5f90f1e689471f13918ed671f304f09fa933027bf7752bcac765aed7c3b209f28c
6
+ metadata.gz: e6e3b600fc6d80533135caf4899abd643ff4074bf6721524370c0fccc05f693e5a38d858560cf985f327f1241b428541b4e9eb1d1cf517bf146f4eea3a717e54
7
+ data.tar.gz: c6e051a2096a87b167c15ba90c596dbccedb4e7d3afb195abfcb85c9a9fd9b989adb4476c0cbdfcffc8db92f844511c319ddecc5f31a777fb43802c8760dab8f
@@ -272,7 +272,7 @@ class ItemsController < ApplicationController
272
272
  :acquired_at, :bookstore_id, :missing_since, :budget_type_id,
273
273
  :lock_version, :manifestation_id, :library_id, :required_role_id,
274
274
  :binding_item_identifier, :binding_call_number, :binded_at,
275
- :use_restriction_id,
275
+ :use_restriction_id, :memo,
276
276
  item_has_use_restriction_attributes: :use_restriction_id # EnjuCirculation
277
277
  )
278
278
  end
@@ -489,7 +489,7 @@ class ManifestationsController < ApplicationController
489
489
  :valid_until, :date_submitted, :date_accepted, :date_captured,
490
490
  :ndl_bib_id, :pub_date, :edition_string, :volume_number, :issue_number,
491
491
  :serial_number, :content_type_id, :attachment, :lock_version,
492
- :dimensions, :fulltext_content, :extent,
492
+ :dimensions, :fulltext_content, :extent, :memo,
493
493
  :parent_id,
494
494
  :serial, :statement_of_responsibility,
495
495
  {creators_attributes: [
@@ -185,11 +185,15 @@ class PictureFilesController < ApplicationController
185
185
  @attachable = @agent
186
186
  return
187
187
  end
188
- get_event
189
- if @event
190
- @attachable = @event
191
- return
188
+
189
+ if defined?(EnjuEvent)
190
+ get_event
191
+ if @event
192
+ @attachable = @event
193
+ return
194
+ end
192
195
  end
196
+
193
197
  get_shelf
194
198
  if @shelf
195
199
  @attachable = @shelf
@@ -1,5 +1,8 @@
1
1
  class AgentImportFile < ApplicationRecord
2
- include Statesman::Adapters::ActiveRecordQueries
2
+ include Statesman::Adapters::ActiveRecordQueries[
3
+ transition_class: AgentImportFileTransition,
4
+ initial_state: :pending
5
+ ]
3
6
  include ImportFile
4
7
  default_scope { order('agent_import_files.id DESC') }
5
8
  scope :not_imported, -> { in_state(:pending) }
@@ -1,5 +1,8 @@
1
1
  class ImportRequest < ApplicationRecord
2
- include Statesman::Adapters::ActiveRecordQueries
2
+ include Statesman::Adapters::ActiveRecordQueries[
3
+ transition_class: ImportRequestTransition,
4
+ initial_state: :pending
5
+ ]
3
6
  default_scope { order('import_requests.id DESC') }
4
7
  belongs_to :manifestation, optional: true
5
8
  belongs_to :user
data/app/models/item.rb CHANGED
@@ -125,4 +125,5 @@ end
125
125
  # binding_call_number :string
126
126
  # binded_at :datetime
127
127
  # manifestation_id :integer not null
128
+ # memo :text
128
129
  #
@@ -873,4 +873,5 @@ end
873
873
  # publication_place :text
874
874
  # extent :text
875
875
  # dimensions :text
876
+ # memo :text
876
877
  #
@@ -1,5 +1,8 @@
1
1
  class ResourceExportFile < ApplicationRecord
2
- include Statesman::Adapters::ActiveRecordQueries
2
+ include Statesman::Adapters::ActiveRecordQueries[
3
+ transition_class: ResourceExportFileTransition,
4
+ initial_state: :pending
5
+ ]
3
6
  include ExportFile
4
7
 
5
8
  if ENV['ENJU_STORAGE'] == 's3'
@@ -1,5 +1,8 @@
1
1
  class ResourceImportFile < ApplicationRecord
2
- include Statesman::Adapters::ActiveRecordQueries
2
+ include Statesman::Adapters::ActiveRecordQueries[
3
+ transition_class: ResourceImportFileTransition,
4
+ initial_state: :pending
5
+ ]
3
6
  include ImportFile
4
7
  default_scope { order('resource_import_files.id DESC') }
5
8
  scope :not_imported, -> { in_state(:pending) }
@@ -92,6 +92,11 @@
92
92
  <%= f.text_area :note, class: 'resource_textarea' -%>
93
93
  </div>
94
94
 
95
+ <div class="field">
96
+ <%= f.label :memo -%><br />
97
+ <%= f.text_area :memo, class: 'resource_textarea' -%>
98
+ </div>
99
+
95
100
  <div class="field">
96
101
  <%= f.label :item_identifier -%>
97
102
  <%= f.text_field :item_identifier, class: 'resource_identifier' -%>
@@ -54,14 +54,16 @@
54
54
  </p>
55
55
 
56
56
  <% if current_user.try(:has_role?, 'Librarian') %>
57
- <p>
58
- <strong><%= t('activerecord.models.use_restriction') -%>:</strong>
59
- <% if @item.use_restriction %>
60
- <ul>
61
- <li><%= @item.use_restriction.display_name %></li>
62
- </ul>
63
- <% end %>
64
- </p>
57
+ <% if defined?(EnjuCirculation) %>
58
+ <p>
59
+ <strong><%= t('activerecord.models.use_restriction') -%>:</strong>
60
+ <% if @item.use_restriction %>
61
+ <ul>
62
+ <li><%= @item.use_restriction.display_name %></li>
63
+ </ul>
64
+ <% end %>
65
+ </p>
66
+ <% end %>
65
67
 
66
68
  <p>
67
69
  <strong><%= t('activerecord.attributes.item.required_role_id') -%>:</strong>
@@ -109,6 +111,13 @@
109
111
  <%= simple_format(@item.note) %>
110
112
  </p>
111
113
 
114
+ <% if current_user.try(:has_role?, 'Librarian') %>
115
+ <p>
116
+ <strong><%= t('activerecord.attributes.item.memo') -%>:</strong>
117
+ <%= simple_format(@item.memo) %>
118
+ </p>
119
+ <% end %>
120
+
112
121
  <p>
113
122
  <strong><%= t('item.accepted_at') -%>:</strong>
114
123
  <%= l(@item.accept.created_at) if @item.accept -%>
@@ -197,6 +197,11 @@
197
197
  <%= f.text_area :note, class: 'resource_textarea' -%>
198
198
  </div>
199
199
 
200
+ <div class="field">
201
+ <%= f.label :memo -%><br />
202
+ <%= f.text_area :memo, class: 'resource_textarea' -%>
203
+ </div>
204
+
200
205
  <div class="actions">
201
206
  <%= f.hidden_field :parent_id %>
202
207
  <%= f.hidden_field :lock_version %>
@@ -107,6 +107,12 @@
107
107
  <%= raw simple_format(h(manifestation.note)) -%>
108
108
  </td>
109
109
  </tr>
110
+ <tr>
111
+ <td><%= t('activerecord.attributes.manifestation.memo') -%>:</td>
112
+ <td>
113
+ <%= simple_format(manifestation.memo) -%>
114
+ </td>
115
+ </tr>
110
116
  </table>
111
117
  <% end %>
112
118
  <% if defined?(EnjuCirculation) %>
@@ -75,6 +75,7 @@ en:
75
75
  edition: Edition (integer)
76
76
  edition_string: Edition
77
77
  note: Note
78
+ memo: Memo
78
79
  repository_content: Repository content
79
80
  lock_version: Lock version
80
81
  carrier_type: Manifestation form
@@ -110,6 +111,7 @@ en:
110
111
  deleted_at: Deleted at
111
112
  include_supplements: Include supplements
112
113
  note: Note
114
+ memo: Memo
113
115
  url: URL
114
116
  price: Price
115
117
  lock_version: Lock version
@@ -75,6 +75,7 @@ ja:
75
75
  edition: 版(数字)
76
76
  edition_string: 版
77
77
  note: 注記
78
+ memo: 業務メモ
78
79
  repository_content: リポジトリのコンテンツ
79
80
  lock_version: ロックバージョン
80
81
  carrier_type: 資料の形態
@@ -110,6 +111,7 @@ ja:
110
111
  deleted_at: 削除時刻
111
112
  include_supplements: 付録を含む
112
113
  note: 注記
114
+ memo: 業務メモ
113
115
  url: URL
114
116
  price: 購入価格
115
117
  lock_version: ロックバージョン
@@ -0,0 +1,5 @@
1
+ class AddMemoToManifestation < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :manifestations, :memo, :text
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddMemoToItem < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :items, :memo, :text
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module EnjuBiblio
2
- VERSION = "0.4.0.beta.1"
2
+ VERSION = "0.4.0.beta.2"
3
3
  end
@@ -24,8 +24,8 @@ namespace :enju_biblio do
24
24
  AgentImportFile.import
25
25
  end
26
26
 
27
- desc "upgrade enju_biblio"
28
- task upgrade: :environment do
27
+ desc "upgrade enju_biblio to 1.3"
28
+ task upgrade_to_13: :environment do
29
29
  Rake::Task['statesman:backfill_most_recent'].invoke('AgentImportFile')
30
30
  Rake::Task['statesman:backfill_most_recent'].invoke('ImportRequest')
31
31
  Rake::Task['statesman:backfill_most_recent'].invoke('ResourceExportFile')
@@ -33,4 +33,23 @@ namespace :enju_biblio do
33
33
  update_carrier_type
34
34
  puts 'enju_biblio: The upgrade completed successfully.'
35
35
  end
36
+
37
+ desc "upgrade enju_biblio to 2.0"
38
+ task upgrade: :environment do
39
+ class_names = [
40
+ AgentRelationshipType, AgentType, CarrierType, ContentType,
41
+ CreateType, FormOfWork, Frequency, Language, License,
42
+ ManifestationRelationshipType, MediumOfPerformance, ProduceType,
43
+ RealizeType
44
+ ]
45
+ class_names.each do |klass|
46
+ klass.find_each do |record|
47
+ I18n.available_locales.each do |locale|
48
+ next unless record.respond_to?("display_name_#{locale}")
49
+ record.update("display_name_#{locale}": YAML.safe_load(record[:display_name])[locale.to_s])
50
+ end
51
+ end
52
+ end
53
+ puts 'enju_biblio: The upgrade completed successfully.'
54
+ end
36
55
  end
@@ -3,7 +3,6 @@ class ApplicationController < ActionController::Base
3
3
 
4
4
  include EnjuLibrary::Controller
5
5
  include EnjuBiblio::Controller
6
- include EnjuEvent::Controller
7
6
  include EnjuSubject::Controller
8
7
  #include EnjuInventory::Controller
9
8
  before_action :set_paper_trail_whodunnit
@@ -6,6 +6,7 @@ Bundler.require(*Rails.groups)
6
6
  require "enju_biblio"
7
7
  require "enju_leaf"
8
8
  require "enju_manifestation_viewer"
9
+ require "enju_message"
9
10
  require "enju_ndl"
10
11
  require 'resque/server'
11
12
 
@@ -10,7 +10,7 @@
10
10
  #
11
11
  # It's strongly recommended that you check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema.define(version: 2019_07_12_163038) do
13
+ ActiveRecord::Schema.define(version: 2019_08_18_075628) do
14
14
 
15
15
  # These are extensions that must be enabled in order to support this database
16
16
  enable_extension "pgcrypto"
@@ -711,6 +711,7 @@ ActiveRecord::Schema.define(version: 2019_07_12_163038) do
711
711
  t.string "binding_call_number"
712
712
  t.datetime "binded_at"
713
713
  t.integer "manifestation_id", null: false
714
+ t.text "memo"
714
715
  t.index ["binding_item_identifier"], name: "index_items_on_binding_item_identifier"
715
716
  t.index ["bookstore_id"], name: "index_items_on_bookstore_id"
716
717
  t.index ["checkout_type_id"], name: "index_items_on_checkout_type_id"
@@ -965,6 +966,7 @@ ActiveRecord::Schema.define(version: 2019_07_12_163038) do
965
966
  t.text "publication_place"
966
967
  t.text "extent"
967
968
  t.text "dimensions"
969
+ t.text "memo"
968
970
  t.index ["access_address"], name: "index_manifestations_on_access_address"
969
971
  t.index ["date_of_publication"], name: "index_manifestations_on_date_of_publication"
970
972
  t.index ["manifestation_identifier"], name: "index_manifestations_on_manifestation_identifier"
@@ -304,4 +304,5 @@ item_00025:
304
304
  # binding_call_number :string
305
305
  # binded_at :datetime
306
306
  # manifestation_id :integer not null
307
+ # memo :text
307
308
  #
@@ -1890,4 +1890,5 @@ manifestation_00217:
1890
1890
  # publication_place :text
1891
1891
  # extent :text
1892
1892
  # dimensions :text
1893
+ # memo :text
1893
1894
  #
@@ -36,4 +36,5 @@ end
36
36
  # binding_call_number :string
37
37
  # binded_at :datetime
38
38
  # manifestation_id :integer not null
39
+ # memo :text
39
40
  #
@@ -366,4 +366,5 @@ end
366
366
  # publication_place :text
367
367
  # extent :text
368
368
  # dimensions :text
369
+ # memo :text
369
370
  #
@@ -0,0 +1,43 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe 'Manifestations', type: :system do
4
+ include Devise::Test::IntegrationHelpers
5
+ fixtures :all
6
+ before do
7
+ @item = FactoryBot.create(:item, shelf: shelves(:shelf_00002))
8
+ CarrierType.find_by(name: 'volume').update(attachment: File.open("#{Rails.root.to_s}/../../app/assets/images/icons/book.png"))
9
+ FactoryBot.create(:withdraw, item: @item)
10
+ end
11
+
12
+ describe 'When logged in as Librarian' do
13
+ before do
14
+ sign_in users(:librarian1)
15
+ end
16
+
17
+ it 'should show memo' do
18
+ @item.update(memo: 'memo')
19
+ visit item_path(@item.id, locale: :ja)
20
+ expect(page).to have_content @item.memo
21
+ end
22
+ end
23
+
24
+ describe 'When logged in as User' do
25
+ before do
26
+ sign_in users(:user1)
27
+ end
28
+
29
+ it 'should not show memo' do
30
+ @item.update(memo: 'memo')
31
+ visit item_path(@item.id, locale: :ja)
32
+ expect(page).not_to have_content @item.memo
33
+ end
34
+ end
35
+
36
+ describe 'When not logged in' do
37
+ it 'should not show memo' do
38
+ @item.update(memo: 'memo')
39
+ visit item_path(@item.id, locale: :ja)
40
+ expect(page).not_to have_content @item.memo
41
+ end
42
+ end
43
+ end
@@ -18,6 +18,12 @@ RSpec.describe 'Manifestations', type: :system do
18
18
  visit manifestation_path(@item.manifestation.id, locale: :ja)
19
19
  expect(page).to have_content @item.item_identifier
20
20
  end
21
+
22
+ it 'should show memo' do
23
+ @item.manifestation.update(memo: 'memo')
24
+ visit manifestation_path(@item.manifestation.id, locale: :ja)
25
+ expect(page).to have_content @item.manifestation.memo
26
+ end
21
27
  end
22
28
 
23
29
  describe 'When logged in as User' do
@@ -29,6 +35,12 @@ RSpec.describe 'Manifestations', type: :system do
29
35
  visit manifestation_path(@item.manifestation.id, locale: :ja)
30
36
  expect(page).to have_content @item.item_identifier
31
37
  end
38
+
39
+ it 'should not show memo' do
40
+ @item.manifestation.update(memo: 'memo')
41
+ visit manifestation_path(@item.manifestation.id, locale: :ja)
42
+ expect(page).not_to have_content @item.manifestation.memo
43
+ end
32
44
  end
33
45
 
34
46
  describe 'When not logged in' do
@@ -36,5 +48,11 @@ RSpec.describe 'Manifestations', type: :system do
36
48
  visit manifestation_path(@item.manifestation.id, locale: :ja)
37
49
  expect(page).to have_content @item.item_identifier
38
50
  end
51
+
52
+ it 'should not show memo' do
53
+ @item.manifestation.update(memo: 'memo')
54
+ visit manifestation_path(@item.manifestation.id, locale: :ja)
55
+ expect(page).not_to have_content @item.manifestation.memo
56
+ end
39
57
  end
40
58
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enju_biblio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0.beta.1
4
+ version: 0.4.0.beta.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kosuke Tanabe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-15 00:00:00.000000000 Z
11
+ date: 2019-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: enju_library
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.4.0.beta.1
19
+ version: 0.4.0.beta.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.4.0.beta.1
26
+ version: 0.4.0.beta.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: marc
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 1.4.0.beta.1
117
+ version: 2.0.0.beta.1
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: 1.4.0.beta.1
124
+ version: 2.0.0.beta.1
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: enju_manifestation_viewer
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: 0.4.0.beta.1
139
+ - !ruby/object:Gem::Dependency
140
+ name: enju_message
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 0.4.0.beta.1
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 0.4.0.beta.1
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: enju_subject
141
155
  requirement: !ruby/object:Gem::Requirement
@@ -982,6 +996,8 @@ files:
982
996
  - db/migrate/20190311154610_create_periodicals.rb
983
997
  - db/migrate/20190312033839_create_periodical_and_manifestations.rb
984
998
  - db/migrate/20190712163038_add_display_name_translations_to_carrier_type.rb
999
+ - db/migrate/20190818075603_add_memo_to_manifestation.rb
1000
+ - db/migrate/20190818075628_add_memo_to_item.rb
985
1001
  - lib/enju_biblio.rb
986
1002
  - lib/enju_biblio/engine.rb
987
1003
  - lib/enju_biblio/openurl.rb
@@ -1488,6 +1504,7 @@ files:
1488
1504
  - spec/support/controller_macros.rb
1489
1505
  - spec/support/devise.rb
1490
1506
  - spec/support/vcr.rb
1507
+ - spec/system/items_spec.rb
1491
1508
  - spec/system/manifestations_spec.rb
1492
1509
  - spec/views/agent_types/edit.html.erb_spec.rb
1493
1510
  - spec/views/agent_types/index.html.erb_spec.rb
@@ -1877,6 +1894,7 @@ test_files:
1877
1894
  - spec/requests/series_statement_merge_lists_spec.rb
1878
1895
  - spec/requests/items_spec.rb
1879
1896
  - spec/system/manifestations_spec.rb
1897
+ - spec/system/items_spec.rb
1880
1898
  - spec/support/controller_macros.rb
1881
1899
  - spec/support/vcr.rb
1882
1900
  - spec/support/devise.rb