diff --git a/app/views/locations/holding_locations/index.html.erb b/app/views/locations/holding_locations/index.html.erb index b43ca5c..e642204 100644 --- a/app/views/locations/holding_locations/index.html.erb +++ b/app/views/locations/holding_locations/index.html.erb @@ -7,6 +7,7 @@ Label Library Holding Library + Remote Storage Hours Location Aeon Location ReCAP EDD @@ -26,6 +27,7 @@ <%= holding_location.label %> <%= link_to holding_location.library.code, holding_location.library %> <%= holding_library_render holding_location %> + <%= holding_location.remote_storage %> <%= hours_render holding_location %> <%= holding_location.aeon_location %> <%= holding_location.recap_electronic_delivery_location %> diff --git a/app/views/locations/holding_locations/json_partials/_show_fields.json.jbuilder b/app/views/locations/holding_locations/json_partials/_show_fields.json.jbuilder index 0ea79f7..7c1d753 100644 --- a/app/views/locations/holding_locations/json_partials/_show_fields.json.jbuilder +++ b/app/views/locations/holding_locations/json_partials/_show_fields.json.jbuilder @@ -1,3 +1,3 @@ json.extract! holding_location, :label, :code, :aeon_location, :recap_electronic_delivery_location, :open, :requestable, - :always_requestable, :circulates + :always_requestable, :circulates, :remote_storage diff --git a/app/views/locations/holding_locations/show.html.erb b/app/views/locations/holding_locations/show.html.erb index f723bd3..7193425 100644 --- a/app/views/locations/holding_locations/show.html.erb +++ b/app/views/locations/holding_locations/show.html.erb @@ -18,6 +18,11 @@ <%= holding_library_render @holding_location %>

+

+ Remote Storage: + <%= @holding_location.remote_storage %> +

+

Hours Location: <%= hours_render @holding_location %> diff --git a/db/migrate/20210430201312_add_remote_storage_to_holding_location.rb b/db/migrate/20210430201312_add_remote_storage_to_holding_location.rb new file mode 100644 index 0000000..68a80d7 --- /dev/null +++ b/db/migrate/20210430201312_add_remote_storage_to_holding_location.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddRemoteStorageToHoldingLocation < ActiveRecord::Migration[5.2] + def change + add_column :locations_holding_locations, :remote_storage, :string + end +end diff --git a/lib/generators/locations/install_generator.rb b/lib/generators/locations/install_generator.rb index 14953ed..c880539 100644 --- a/lib/generators/locations/install_generator.rb +++ b/lib/generators/locations/install_generator.rb @@ -6,7 +6,6 @@ class InstallGenerator < Rails::Generators::Base def add_gems gem 'bootstrap-sass' - gem 'yaml_db', '~> 0.6' gem 'jquery-rails' Bundler.with_clean_env do run "bundle install" diff --git a/locations.gemspec b/locations.gemspec index d1cba6d..00c8bcd 100644 --- a/locations.gemspec +++ b/locations.gemspec @@ -17,17 +17,17 @@ Gem::Specification.new do |s| s.files = Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.md'] - s.add_dependency 'rails', '~> 5.1' + s.add_dependency 'rails', '~> 5.2.4' s.add_dependency 'bootstrap-sass', '~> 3.3' s.add_dependency 'friendly_id', '~> 5.1.0' - s.add_dependency 'yaml_db', '~> 0.6' + s.add_dependency 'yaml_db', '~> 0.7' s.add_dependency 'jquery-tablesorter', '~> 1.21' s.add_development_dependency 'sqlite3' s.add_development_dependency 'rspec-rails', '~> 3.1' - s.add_development_dependency 'engine_cart', '~> 1.2' + s.add_development_dependency 'engine_cart', '~> 2.1' s.add_development_dependency 'factory_girl_rails', '~> 4.5.0' - s.add_development_dependency 'faker', '~> 1.4.3' + s.add_development_dependency 'faker', '~> 1.9' s.add_development_dependency 'database_cleaner', '~> 1.3' s.add_development_dependency 'poltergeist' s.add_development_dependency 'coveralls' diff --git a/spec/factories/locations/holding_locations.rb b/spec/factories/locations/holding_locations.rb index 635ccbb..50ebf45 100644 --- a/spec/factories/locations/holding_locations.rb +++ b/spec/factories/locations/holding_locations.rb @@ -14,6 +14,7 @@ circulates [true, false].sample code library { build(:library, library_args) } + remote_storage 'recap_rmt' end factory :holding_location_locator, class: 'Locations::HoldingLocation' do @@ -30,6 +31,7 @@ circulates [true, false].sample code 'f' library { build(:library, library_args) } + remote_storage hours_location { build(:hours_location, hours_locations_args) } end @@ -46,5 +48,6 @@ circulates true code 'sciss' library { build(:library, library_args) } + remote_storage end end diff --git a/spec/models/locations/holding_location_spec.rb b/spec/models/locations/holding_location_spec.rb index a1a00df..7d1c7fa 100644 --- a/spec/models/locations/holding_location_spec.rb +++ b/spec/models/locations/holding_location_spec.rb @@ -23,6 +23,11 @@ module Locations expect(subject.valid?).to eq true end + it "is valid without a remote_storage" do + subject.send("remote_storage=", nil) + expect(subject.valid?).to eq true + end + it 'code must be unique' do expect { FactoryGirl.create(:holding_location, code: subject.code) diff --git a/spec/requests/locations/holding_locations_json_view_spec.rb b/spec/requests/locations/holding_locations_json_view_spec.rb index 3471a76..2471d88 100644 --- a/spec/requests/locations/holding_locations_json_view_spec.rb +++ b/spec/requests/locations/holding_locations_json_view_spec.rb @@ -24,6 +24,7 @@ module Locations requestable: holding_location.requestable, always_requestable: holding_location.always_requestable, circulates: holding_location.circulates, + remote_storage: holding_location.remote_storage, path: holding_location_path(holding_location, format: :json), library: { label: holding_location.library.label, @@ -49,6 +50,7 @@ module Locations requestable: holding_location.requestable, always_requestable: holding_location.always_requestable, circulates: holding_location.circulates, + remote_storage: holding_location.remote_storage, path: holding_location_path(holding_location, format: :json), library: { label: holding_location.library.label, @@ -68,7 +70,6 @@ module Locations expected << attrs get holding_locations_path, params: { format: :json } expect(response.body).to eq expected.sort_by{ |k| k[:code] }.to_json - end it "/holding_locations/{code} looks as we'd expect without hours_location" do @@ -90,6 +91,7 @@ module Locations requestable: holding_location.requestable, always_requestable: holding_location.always_requestable, circulates: holding_location.circulates, + remote_storage: holding_location.remote_storage, library: { label: holding_location.library.label, code: holding_location.library.code, @@ -136,6 +138,7 @@ module Locations requestable: holding_location.requestable, always_requestable: holding_location.always_requestable, circulates: holding_location.circulates, + remote_storage: holding_location.remote_storage, library: { label: holding_location.library.label, code: holding_location.library.code, @@ -184,6 +187,7 @@ module Locations requestable: holding_location.requestable, always_requestable: holding_location.always_requestable, circulates: holding_location.circulates, + remote_storage: holding_location.remote_storage, library: { label: holding_location.library.label, code: holding_location.library.code, @@ -239,6 +243,7 @@ module Locations holding_location.requestable, holding_location.always_requestable, holding_location.circulates, + holding_location.remote_storage, holding_location.library.code ] expected << attrs @@ -256,6 +261,7 @@ module Locations holding_location.requestable, holding_location.always_requestable, holding_location.circulates, + holding_location.remote_storage, holding_location.library.code, holding_location.hours_location.code ] @@ -286,6 +292,7 @@ module Locations holding_location.requestable, holding_location.always_requestable, holding_location.circulates, + holding_location.remote_storage, holding_location.library.code, holding_location.hours_location.code ] diff --git a/spec/test_app_templates/lib/generators/test_app_generator.rb b/spec/test_app_templates/lib/generators/test_app_generator.rb index 9dda397..6663f15 100644 --- a/spec/test_app_templates/lib/generators/test_app_generator.rb +++ b/spec/test_app_templates/lib/generators/test_app_generator.rb @@ -13,7 +13,7 @@ class TestAppGenerator < Rails::Generators::Base def add_gems gem 'factory_girl_rails', '~> 4.5.0', group: [:development, :test] - gem 'faker', '~> 1.4.3', group: [:development, :test] + gem 'faker', '~> 1.9', group: [:development, :test] end def install_engine