enju_library 0.3.3 → 0.3.4
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.
- checksums.yaml +4 -4
- data/app/controllers/accepts_controller.rb +1 -1
- data/app/controllers/bookstores_controller.rb +1 -1
- data/app/controllers/budget_types_controller.rb +1 -1
- data/app/controllers/libraries_controller.rb +1 -1
- data/app/controllers/library_groups_controller.rb +1 -1
- data/app/controllers/request_status_types_controller.rb +1 -1
- data/app/controllers/request_types_controller.rb +1 -1
- data/app/controllers/search_engines_controller.rb +1 -1
- data/app/controllers/shelves_controller.rb +2 -2
- data/app/controllers/subscribes_controller.rb +1 -1
- data/app/controllers/user_export_files_controller.rb +1 -1
- data/app/controllers/user_groups_controller.rb +1 -1
- data/app/controllers/user_import_files_controller.rb +1 -1
- data/app/controllers/withdraws_controller.rb +1 -1
- data/app/jobs/user_export_file_job.rb +1 -1
- data/app/jobs/user_import_file_job.rb +1 -1
- data/app/models/accept.rb +1 -1
- data/app/models/basket.rb +1 -1
- data/app/models/bookstore.rb +1 -1
- data/app/models/budget_type.rb +1 -1
- data/app/models/color.rb +1 -1
- data/app/models/library.rb +1 -1
- data/app/models/library_group.rb +1 -1
- data/app/models/request_status_type.rb +1 -1
- data/app/models/request_type.rb +1 -1
- data/app/models/search_engine.rb +1 -1
- data/app/models/shelf.rb +4 -2
- data/app/models/subscribe.rb +1 -1
- data/app/models/subscription.rb +1 -1
- data/app/models/user_export_file.rb +1 -1
- data/app/models/user_export_file_transition.rb +1 -1
- data/app/models/user_group.rb +3 -3
- data/app/models/user_import_file.rb +2 -2
- data/app/models/user_import_file_transition.rb +1 -1
- data/app/models/user_import_result.rb +1 -1
- data/app/models/withdraw.rb +1 -1
- data/app/views/libraries/_map.html+phone.erb +1 -1
- data/app/views/libraries/_map.html.erb +1 -1
- data/lib/enju_library/version.rb +1 -1
- data/lib/generators/enju_library/setup/templates/db/fixtures/user_groups.yml +6 -0
- data/lib/tasks/enju_library_tasks.rake +2 -0
- data/spec/controllers/budget_types_controller_spec.rb +2 -2
- data/spec/dummy/app/jobs/application_job.rb +7 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/models/user.rb +2 -1
- data/spec/dummy/db/migrate/032_create_checkins.rb +3 -6
- data/spec/dummy/db/migrate/033_create_checkouts.rb +5 -10
- data/spec/dummy/db/migrate/035_create_reserves.rb +4 -9
- data/spec/dummy/db/migrate/121_create_checked_items.rb +3 -4
- data/spec/dummy/db/migrate/129_create_item_has_use_restrictions.rb +2 -4
- data/spec/dummy/db/migrate/20081030023518_create_user_group_has_checkout_types.rb +2 -4
- data/spec/dummy/db/migrate/20081030023615_create_carrier_type_has_checkout_types.rb +2 -3
- data/spec/dummy/db/migrate/20081212075554_create_checkout_stat_has_manifestations.rb +2 -2
- data/spec/dummy/db/migrate/20081215094955_create_checkout_stat_has_users.rb +2 -4
- data/spec/dummy/db/migrate/20081216190517_create_reserve_stat_has_manifestations.rb +2 -2
- data/spec/dummy/db/migrate/20081220034117_create_reserve_stat_has_users.rb +2 -4
- data/spec/dummy/db/migrate/20090831220301_create_lending_policies.rb +2 -2
- data/spec/dummy/db/migrate/20100606065209_create_user_has_roles.rb +2 -4
- data/spec/dummy/db/migrate/20110627122938_add_number_of_day_to_notify_overdue_to_user_group.rb +2 -2
- data/spec/dummy/db/migrate/20120424103932_add_librarian_id_to_checked_item.rb +1 -1
- data/spec/dummy/db/migrate/20140122054321_create_profiles.rb +4 -5
- data/spec/dummy/db/migrate/20140810061942_add_user_id_to_user_checkout_stat.rb +4 -8
- data/spec/dummy/db/migrate/20141014065831_add_shelf_id_to_checkout.rb +1 -2
- data/spec/dummy/db/migrate/20141020120523_add_library_id_to_checkout.rb +1 -2
- data/spec/dummy/db/migrate/20150106001709_create_demands.rb +3 -6
- data/spec/dummy/db/migrate/20150421023923_create_identities.rb +1 -2
- data/spec/dummy/db/migrate/20180107161035_add_constraints_to_most_recent_for_reserve_transitions.rb +13 -0
- data/spec/dummy/db/migrate/20180107161311_add_constraints_to_most_recent_for_agent_import_file_transitions.rb +13 -0
- data/spec/dummy/db/migrate/20180107161331_add_constraints_to_most_recent_for_resource_import_file_transitions.rb +13 -0
- data/spec/dummy/db/migrate/20180107161347_add_constraints_to_most_recent_for_resource_export_file_transitions.rb +13 -0
- data/spec/dummy/db/migrate/20180107161410_add_constraints_to_most_recent_for_import_request_transitions.rb +13 -0
- data/spec/dummy/db/migrate/20180107161951_add_constraints_to_most_recent_for_user_checkout_stat_transitions.rb +13 -0
- data/spec/dummy/db/migrate/20180107162009_add_constraints_to_most_recent_for_user_reserve_stat_transitions.rb +13 -0
- data/spec/dummy/db/migrate/20180107162029_add_constraints_to_most_recent_for_manifestation_checkout_stat_transitions.rb +13 -0
- data/spec/dummy/db/migrate/20180107162048_add_constraints_to_most_recent_for_manifestation_reserve_stat_transitions.rb +13 -0
- data/spec/dummy/db/schema.rb +29 -16
- data/spec/fixtures/items.yml +1 -1
- data/spec/fixtures/reserve_transitions.yml +15 -0
- data/spec/fixtures/user_groups.yml +2 -2
- data/spec/models/user_group_spec.rb +2 -2
- metadata +421 -370
- data/app/views/libraries/_map.html+phone.slim +0 -4
- data/lib/generators/enju_library/setup/templates/db/fixtures/shelves.yml +0 -15
- data/spec/libraries_spec.rb +0 -46
- data/spec/shelves_spec.rb +0 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fb21f17b1dd4ad3e311123992f5359ff191470046c394268e51376453ef6995
|
4
|
+
data.tar.gz: 22a9b2ed2af70d276aad8323e53782f22f5a8794cd4b632c4043e43a5b19b4e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 392a2f02f6860a7f7da0a1ff67d4a6d276748385c4763bcd1bd1001fef9967add797390c491098974422cc8b3d47d86f87092fa05f5ad0b63730d42131e7a242
|
7
|
+
data.tar.gz: c22d984693895223120424adad3231c84ce959bd6f88a3196e9398134b04295ecd1ab42343de0f8339759685d589a8e3cc7c65776bf8099d50e414b5e12bc706
|
@@ -99,7 +99,7 @@ class AcceptsController < ApplicationController
|
|
99
99
|
# PUT /accepts/1.json
|
100
100
|
def update
|
101
101
|
respond_to do |format|
|
102
|
-
if @accept.
|
102
|
+
if @accept.update(accept_params)
|
103
103
|
format.html { redirect_to @accept, notice: t('controller.successfully_updated', model: t('activerecord.models.accept')) }
|
104
104
|
format.json { head :no_content }
|
105
105
|
else
|
@@ -62,7 +62,7 @@ class BookstoresController < ApplicationController
|
|
62
62
|
end
|
63
63
|
|
64
64
|
respond_to do |format|
|
65
|
-
if @bookstore.
|
65
|
+
if @bookstore.update(bookstore_params)
|
66
66
|
format.html { redirect_to @bookstore, notice: t('controller.successfully_updated', model: t('activerecord.models.bookstore')) }
|
67
67
|
format.json { head :no_content }
|
68
68
|
else
|
@@ -62,7 +62,7 @@ class BudgetTypesController < ApplicationController
|
|
62
62
|
end
|
63
63
|
|
64
64
|
respond_to do |format|
|
65
|
-
if @budget_type.
|
65
|
+
if @budget_type.update(budget_type_params)
|
66
66
|
format.html { redirect_to @budget_type, notice: t('controller.successfully_updated', model: t('activerecord.models.budget_type')) }
|
67
67
|
format.json { head :no_content }
|
68
68
|
else
|
@@ -94,7 +94,7 @@ class LibrariesController < ApplicationController
|
|
94
94
|
end
|
95
95
|
|
96
96
|
respond_to do |format|
|
97
|
-
if @library.
|
97
|
+
if @library.update(library_params)
|
98
98
|
format.html { redirect_to @library, notice: t('controller.successfully_updated', model: t('activerecord.models.library')) }
|
99
99
|
format.json { head :no_content }
|
100
100
|
else
|
@@ -44,7 +44,7 @@ class LibraryGroupsController < ApplicationController
|
|
44
44
|
# PUT /library_groups/1.json
|
45
45
|
def update
|
46
46
|
respond_to do |format|
|
47
|
-
if @library_group.
|
47
|
+
if @library_group.update(library_group_params)
|
48
48
|
if @library_group.delete_header_logo == '1'
|
49
49
|
@library_group.header_logo.destroy
|
50
50
|
end
|
@@ -62,7 +62,7 @@ class RequestStatusTypesController < ApplicationController
|
|
62
62
|
end
|
63
63
|
|
64
64
|
respond_to do |format|
|
65
|
-
if @request_status_type.
|
65
|
+
if @request_status_type.update(request_status_type_params)
|
66
66
|
format.html { redirect_to @request_status_type, notice: t('controller.successfully_updated', model: t('activerecord.models.request_status_type')) }
|
67
67
|
format.json { head :no_content }
|
68
68
|
else
|
@@ -62,7 +62,7 @@ class RequestTypesController < ApplicationController
|
|
62
62
|
end
|
63
63
|
|
64
64
|
respond_to do |format|
|
65
|
-
if @request_type.
|
65
|
+
if @request_type.update(request_type_params)
|
66
66
|
format.html { redirect_to @request_type, notice: t('controller.successfully_updated', model: t('activerecord.models.request_type')) }
|
67
67
|
format.json { head :no_content }
|
68
68
|
else
|
@@ -62,7 +62,7 @@ class SearchEnginesController < ApplicationController
|
|
62
62
|
end
|
63
63
|
|
64
64
|
respond_to do |format|
|
65
|
-
if @search_engine.
|
65
|
+
if @search_engine.update(search_engine_params)
|
66
66
|
format.html { redirect_to @search_engine, notice: t('controller.successfully_updated', model: t('activerecord.models.search_engine')) }
|
67
67
|
format.json { head :no_content }
|
68
68
|
else
|
@@ -16,7 +16,7 @@ class ShelvesController < ApplicationController
|
|
16
16
|
render partial: 'select_form'
|
17
17
|
return
|
18
18
|
else
|
19
|
-
sort = {sort_by: '
|
19
|
+
sort = {sort_by: 'shelf_name', order: 'asc'}
|
20
20
|
# case params[:sort_by]
|
21
21
|
# when 'name'
|
22
22
|
# sort[:sort_by] = 'name'
|
@@ -114,7 +114,7 @@ class ShelvesController < ApplicationController
|
|
114
114
|
end
|
115
115
|
|
116
116
|
respond_to do |format|
|
117
|
-
if @shelf.
|
117
|
+
if @shelf.update(shelf_params)
|
118
118
|
format.html { redirect_to @shelf, notice: t('controller.successfully_updated', model: t('activerecord.models.shelf')) }
|
119
119
|
format.json { head :no_content }
|
120
120
|
else
|
@@ -60,7 +60,7 @@ class SubscribesController < ApplicationController
|
|
60
60
|
# PUT /subscribes/1.json
|
61
61
|
def update
|
62
62
|
respond_to do |format|
|
63
|
-
if @subscribe.
|
63
|
+
if @subscribe.update(subscribe_params)
|
64
64
|
format.html { redirect_to @subscribe, notice: t('controller.successfully_updated', model: t('activerecord.models.subscribe')) }
|
65
65
|
format.json { head :no_content }
|
66
66
|
else
|
@@ -76,7 +76,7 @@ class UserExportFilesController < ApplicationController
|
|
76
76
|
# PUT /user_export_files/1.json
|
77
77
|
def update
|
78
78
|
respond_to do |format|
|
79
|
-
if @user_export_file.
|
79
|
+
if @user_export_file.update(user_export_file_params)
|
80
80
|
if @user_export_file.mode == 'export'
|
81
81
|
UserExportFileJob.perform_later(@user_export_file)
|
82
82
|
end
|
@@ -63,7 +63,7 @@ class UserGroupsController < ApplicationController
|
|
63
63
|
end
|
64
64
|
|
65
65
|
respond_to do |format|
|
66
|
-
if @user_group.
|
66
|
+
if @user_group.update(user_group_params)
|
67
67
|
format.html { redirect_to @user_group, notice: t('controller.successfully_updated', model: t('activerecord.models.user_group')) }
|
68
68
|
format.json { head :no_content }
|
69
69
|
else
|
@@ -80,7 +80,7 @@ class UserImportFilesController < ApplicationController
|
|
80
80
|
# PUT /user_import_files/1.json
|
81
81
|
def update
|
82
82
|
respond_to do |format|
|
83
|
-
if @user_import_file.
|
83
|
+
if @user_import_file.update(user_import_file_params)
|
84
84
|
if @user_import_file.mode == 'import'
|
85
85
|
UserImportFileJob.perform_later(@user_import_file)
|
86
86
|
end
|
@@ -100,7 +100,7 @@ class WithdrawsController < ApplicationController
|
|
100
100
|
# PUT /withdraws/1.json
|
101
101
|
def update
|
102
102
|
respond_to do |format|
|
103
|
-
if @withdraw.
|
103
|
+
if @withdraw.update(withdraw_params)
|
104
104
|
format.html { redirect_to @withdraw, notice: t('controller.successfully_updated', model: t('activerecord.models.withdraw')) }
|
105
105
|
format.json { head :no_content }
|
106
106
|
else
|
data/app/models/accept.rb
CHANGED
data/app/models/basket.rb
CHANGED
data/app/models/bookstore.rb
CHANGED
data/app/models/budget_type.rb
CHANGED
data/app/models/color.rb
CHANGED
data/app/models/library.rb
CHANGED
data/app/models/library_group.rb
CHANGED
data/app/models/request_type.rb
CHANGED
data/app/models/search_engine.rb
CHANGED
data/app/models/shelf.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
class Shelf <
|
1
|
+
class Shelf < ApplicationRecord
|
2
2
|
include MasterModel
|
3
3
|
scope :real, -> { where('library_id != 1') }
|
4
4
|
belongs_to :library, validate: true
|
@@ -14,7 +14,9 @@ class Shelf < ActiveRecord::Base
|
|
14
14
|
acts_as_list scope: :library
|
15
15
|
|
16
16
|
searchable do
|
17
|
-
string :
|
17
|
+
string :shelf_name do
|
18
|
+
name
|
19
|
+
end
|
18
20
|
string :library do
|
19
21
|
library.name
|
20
22
|
end
|
data/app/models/subscribe.rb
CHANGED
data/app/models/subscription.rb
CHANGED
data/app/models/user_group.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
class UserGroup <
|
1
|
+
class UserGroup < ApplicationRecord
|
2
2
|
include MasterModel
|
3
3
|
has_many :profiles
|
4
4
|
|
@@ -23,7 +23,7 @@ end
|
|
23
23
|
# deleted_at :datetime
|
24
24
|
# valid_period_for_new_user :integer default(0), not null
|
25
25
|
# expired_at :datetime
|
26
|
-
# number_of_day_to_notify_overdue :integer default(
|
27
|
-
# number_of_day_to_notify_due_date :integer default(
|
26
|
+
# number_of_day_to_notify_overdue :integer default(7), not null
|
27
|
+
# number_of_day_to_notify_due_date :integer default(3), not null
|
28
28
|
# number_of_time_to_notify_overdue :integer default(3), not null
|
29
29
|
#
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class UserImportFile <
|
1
|
+
class UserImportFile < ApplicationRecord
|
2
2
|
include Statesman::Adapters::ActiveRecordQueries
|
3
3
|
include ImportFile
|
4
4
|
default_scope {order('user_import_files.id DESC')}
|
@@ -192,7 +192,7 @@ class UserImportFile < ActiveRecord::Base
|
|
192
192
|
rows.each do |row|
|
193
193
|
row_num += 1
|
194
194
|
username = row['username'].to_s.strip
|
195
|
-
remove_user = User.
|
195
|
+
remove_user = User.find_by(username: username)
|
196
196
|
if remove_user.try(:deletable_by?, user)
|
197
197
|
UserImportFile.transaction do
|
198
198
|
remove_user.destroy
|
data/app/models/withdraw.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
<script type="text/javascript" src="
|
1
|
+
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
|
2
2
|
<script type="text/javascript">
|
3
3
|
google.maps.event.addDomListener(window, 'load', function() {
|
4
4
|
var latlng = new google.maps.LatLng(<%= library.latitude %>, <%= library.longitude %>);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<script type="text/javascript" src="
|
1
|
+
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
|
2
2
|
<script type="text/javascript">
|
3
3
|
google.maps.event.addDomListener(window, 'load', function() {
|
4
4
|
var latlng = new google.maps.LatLng(<%= library.latitude %>, <%= library.longitude %>);
|
data/lib/enju_library/version.rb
CHANGED
@@ -13,6 +13,8 @@ namespace :enju_library do
|
|
13
13
|
next if basename == 'library_groups'
|
14
14
|
ActiveRecord::FixtureSet.create_fixtures('db/fixtures/enju_library', basename)
|
15
15
|
end
|
16
|
+
Shelf.create!(name: 'web', library: Library.find_by(name: 'web'))
|
17
|
+
Shelf.create!(name: 'first_shelf', library: Library.find_by(name: 'yours'))
|
16
18
|
end
|
17
19
|
|
18
20
|
desc "upgrade enju_library"
|
@@ -103,9 +103,9 @@ describe BudgetTypesController do
|
|
103
103
|
budget_type = BudgetType.create! valid_attributes
|
104
104
|
# Assuming there are no other budget_types in the database, this
|
105
105
|
# specifies that the BudgetType created on the previous line
|
106
|
-
# receives the :
|
106
|
+
# receives the :update message with whatever params are
|
107
107
|
# submitted in the request.
|
108
|
-
BudgetType.any_instance.should_receive(:
|
108
|
+
BudgetType.any_instance.should_receive(:update).with('note' => 'test')
|
109
109
|
put :update, params: { id: budget_type.id, budget_type: { note: 'test' } }
|
110
110
|
end
|
111
111
|
|
@@ -0,0 +1,7 @@
|
|
1
|
+
class ApplicationJob < ActiveJob::Base
|
2
|
+
# Automatically retry jobs that encountered a deadlock
|
3
|
+
# retry_on ActiveRecord::Deadlocked
|
4
|
+
|
5
|
+
# Most jobs are safe to ignore if the underlying records are no longer available
|
6
|
+
# discard_on ActiveJob::DeserializationError
|
7
|
+
end
|
@@ -1,10 +1,11 @@
|
|
1
|
-
class User <
|
1
|
+
class User < ApplicationRecord
|
2
2
|
devise :database_authenticatable, #:registerable,
|
3
3
|
:recoverable, :rememberable, :trackable, #, :validatable
|
4
4
|
:lockable, lock_strategy: :none, unlock_strategy: :none
|
5
5
|
|
6
6
|
include EnjuSeed::EnjuUser
|
7
7
|
include EnjuCirculation::EnjuUser
|
8
|
+
has_one :profile, dependent: :nullify
|
8
9
|
end
|
9
10
|
|
10
11
|
Accept.include(EnjuCirculation::EnjuAccept)
|
@@ -1,14 +1,11 @@
|
|
1
1
|
class CreateCheckins < ActiveRecord::Migration[4.2]
|
2
2
|
def self.up
|
3
3
|
create_table :checkins do |t|
|
4
|
-
t.
|
5
|
-
t.
|
6
|
-
t.
|
4
|
+
t.references :item, index: true, foreign_key: true, null: false
|
5
|
+
t.references :librarian, index: true
|
6
|
+
t.references :basket, index: true
|
7
7
|
t.timestamps
|
8
8
|
end
|
9
|
-
add_index :checkins, :item_id
|
10
|
-
add_index :checkins, :librarian_id
|
11
|
-
add_index :checkins, :basket_id
|
12
9
|
end
|
13
10
|
|
14
11
|
def self.down
|
@@ -1,22 +1,17 @@
|
|
1
1
|
class CreateCheckouts < ActiveRecord::Migration[4.2]
|
2
2
|
def self.up
|
3
3
|
create_table :checkouts do |t|
|
4
|
-
t.
|
5
|
-
t.
|
6
|
-
t.
|
7
|
-
t.
|
8
|
-
t.
|
4
|
+
t.references :user, index: true, foreign_key: true
|
5
|
+
t.references :item, index: true, foreign_key: true, null: false
|
6
|
+
t.references :checkin, index: true, foreign_key: true
|
7
|
+
t.references :librarian, index: true
|
8
|
+
t.references :basket, index: true
|
9
9
|
t.datetime :due_date
|
10
10
|
t.integer :checkout_renewal_count, default: 0, null: false
|
11
11
|
t.integer :lock_version, default: 0, null: false
|
12
12
|
t.timestamps
|
13
13
|
end
|
14
|
-
add_index :checkouts, :user_id
|
15
|
-
add_index :checkouts, :item_id
|
16
|
-
add_index :checkouts, :basket_id
|
17
14
|
add_index :checkouts, [:item_id, :basket_id], unique: true
|
18
|
-
add_index :checkouts, :librarian_id
|
19
|
-
add_index :checkouts, :checkin_id
|
20
15
|
end
|
21
16
|
|
22
17
|
def self.down
|