enju_seed 0.3.2 → 0.3.3
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/README.md +28 -0
- data/app/controllers/profiles_controller.rb +1 -1
- data/app/controllers/roles_controller.rb +1 -1
- data/app/models/identity.rb +1 -1
- data/app/models/profile.rb +1 -1
- data/app/models/role.rb +1 -1
- data/app/models/user_has_role.rb +1 -4
- data/app/views/roles/show.html.erb +0 -5
- data/lib/enju_seed/version.rb +1 -1
- data/lib/generators/enju_seed/setup/setup_generator.rb +9 -0
- data/lib/generators/enju_seed/setup/templates/db/fixtures/roles.yml +38 -0
- data/lib/tasks/enju_seed_tasks.rake +8 -4
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/models/user.rb +1 -1
- data/spec/dummy/config/application.rb +1 -1
- data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +0 -8
- data/spec/dummy/db/migrate/20160319144230_create_issn_records.rb +11 -0
- data/spec/dummy/db/migrate/20160506144040_create_isbn_records.rb +11 -0
- data/spec/dummy/db/migrate/20160801080612_add_most_recent_to_import_request_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20160801080619_add_most_recent_to_resource_import_file_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20160801080637_add_most_recent_to_resource_export_file_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20160801080643_add_most_recent_to_agent_import_file_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20160811102604_add_picture_width_to_picture_file.rb +6 -0
- data/spec/dummy/db/migrate/20160814165332_add_most_recent_to_message_request_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20160820004638_add_attachment_attachment_to_carrier_types.rb +11 -0
- data/spec/dummy/db/migrate/20170116134107_create_issn_record_and_manifestations.rb +11 -0
- data/spec/dummy/db/migrate/20170116134120_create_isbn_record_and_manifestations.rb +11 -0
- data/spec/dummy/db/migrate/20171119051258_set_not_null_to_manifestation_id_on_items.rb +5 -0
- data/spec/dummy/db/migrate/20180107160726_add_constraints_to_most_recent_for_user_import_file_transitions.rb +13 -0
- data/spec/dummy/db/migrate/20180107160740_add_constraints_to_most_recent_for_user_export_file_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/20180107162659_add_constraints_to_most_recent_for_message_transitions.rb +13 -0
- data/spec/dummy/db/migrate/20180107162711_add_constraints_to_most_recent_for_message_request_transitions.rb +13 -0
- data/spec/dummy/db/migrate/20181026064038_add_login_banner_to_library_group.rb +6 -0
- data/spec/dummy/db/migrate/20181030072731_add_not_null_to_position_on_carrier_type.rb +14 -0
- data/spec/dummy/db/migrate/20181030074920_add_not_null_to_position_on_library.rb +14 -0
- data/spec/dummy/db/migrate/20190208135957_create_active_storage_tables.active_storage.rb +27 -0
- data/spec/dummy/db/migrate/20190311154610_create_periodicals.rb +10 -0
- data/spec/dummy/db/migrate/20190314151124_add_full_name_translations_to_create.rb +7 -0
- data/spec/dummy/db/schema.rb +116 -25
- data/spec/models/user_has_role_spec.rb +0 -1
- data/spec/views/profiles/show.html.erb_spec.rb +1 -1
- data/spec/views/roles/edit.html.erb_spec.rb +18 -0
- data/spec/views/roles/index.html.erb_spec.rb +14 -0
- data/spec/views/roles/new.html.erb_spec.rb +18 -0
- data/spec/views/roles/show.html.erb_spec.rb +14 -0
- metadata +321 -243
- data/README.rdoc +0 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0b5d4b5e670279c1d6e48e488585f167928ea1ae564a63bd40d873b4c00d6c83
|
|
4
|
+
data.tar.gz: 57b3afe3052d84eeca383536c8cfd7099e7d44262328791448d10032e599de3c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 80d86dd10500be037306e39a879547fe4d04b38053aa0c0516bf5669b3d069e2f57003663d2ab048f4f16e0d087080fa00d656d42d684fa8eb5ede830873aef0
|
|
7
|
+
data.tar.gz: 9dc73692ebcae34d1b8060acf9ca8cb3e4baa7f781cd9e0c3f8465e54781e61f6737892b2b387f9eaabeb2dbc5f6464f1b139f4c7f434296efeb84dc77f620d4
|
data/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# EnjuSeed
|
|
2
|
+
Short description and motivation.
|
|
3
|
+
|
|
4
|
+
## Usage
|
|
5
|
+
How to use my plugin.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
Add this line to your application's Gemfile:
|
|
9
|
+
|
|
10
|
+
```ruby
|
|
11
|
+
gem 'enju_seed'
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
And then execute:
|
|
15
|
+
```bash
|
|
16
|
+
$ bundle
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
```bash
|
|
21
|
+
$ gem install enju_seed
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Contributing
|
|
25
|
+
Contribution directions go here.
|
|
26
|
+
|
|
27
|
+
## License
|
|
28
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
@@ -132,7 +132,7 @@ class ProfilesController < ApplicationController
|
|
|
132
132
|
# PUT /profiles/1
|
|
133
133
|
# PUT /profiles/1.json
|
|
134
134
|
def update
|
|
135
|
-
@profile.
|
|
135
|
+
@profile.update(profile_update_params)
|
|
136
136
|
if @profile.user
|
|
137
137
|
if @profile.user.auto_generated_password == "1"
|
|
138
138
|
password = @profile.user.set_auto_generated_password
|
|
@@ -35,7 +35,7 @@ class RolesController < ApplicationController
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
respond_to do |format|
|
|
38
|
-
if @role.
|
|
38
|
+
if @role.update(role_params)
|
|
39
39
|
format.html { redirect_to @role, notice: t('controller.successfully_updated', model: t('activerecord.models.role')) }
|
|
40
40
|
format.json { head :no_content }
|
|
41
41
|
else
|
data/app/models/identity.rb
CHANGED
data/app/models/profile.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class Profile <
|
|
1
|
+
class Profile < ApplicationRecord
|
|
2
2
|
scope :administrators, -> { joins(user: :role).where('roles.name = ?', 'Administrator') }
|
|
3
3
|
scope :librarians, -> { joins(user: :role).where('roles.name = ? OR roles.name = ?', 'Administrator', 'Librarian') }
|
|
4
4
|
belongs_to :user, dependent: :destroy, optional: true
|
data/app/models/role.rb
CHANGED
data/app/models/user_has_role.rb
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
class UserHasRole <
|
|
1
|
+
class UserHasRole < ApplicationRecord
|
|
2
2
|
belongs_to :user
|
|
3
3
|
belongs_to :role
|
|
4
4
|
accepts_nested_attributes_for :role
|
|
5
|
-
|
|
6
|
-
# validates_uniqueness_of :role_id, scope: :user_id
|
|
7
|
-
# validates_presence_of :role_id, :user_id
|
|
8
5
|
end
|
|
9
6
|
|
|
10
7
|
# == Schema Information
|
|
@@ -13,11 +13,6 @@
|
|
|
13
13
|
<%= @role.display_name.localize -%>
|
|
14
14
|
</p>
|
|
15
15
|
|
|
16
|
-
<p>
|
|
17
|
-
<strong><%= t('activerecord.attributes.role.score') -%>:</strong>
|
|
18
|
-
<%= @role.score -%>
|
|
19
|
-
</p>
|
|
20
|
-
|
|
21
16
|
<p>
|
|
22
17
|
<strong><%= t('activerecord.attributes.role.note') -%>:</strong>
|
|
23
18
|
<%= @role.note -%>
|
data/lib/enju_seed/version.rb
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
class EnjuSeed::SetupGenerator < Rails::Generators::Base
|
|
2
|
+
source_root File.expand_path('../templates', __FILE__)
|
|
3
|
+
desc "Create a setup file for Next-L Enju"
|
|
4
|
+
|
|
5
|
+
def copy_setup_files
|
|
6
|
+
directory("db/fixtures", "db/fixtures/enju_seed")
|
|
7
|
+
rake("enju_seed_engine:install:migrations")
|
|
8
|
+
end
|
|
9
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
role_00001:
|
|
3
|
+
name: Guest
|
|
4
|
+
display_name: Guest
|
|
5
|
+
id: 1
|
|
6
|
+
note:
|
|
7
|
+
position: 1
|
|
8
|
+
role_00002:
|
|
9
|
+
name: User
|
|
10
|
+
display_name: User
|
|
11
|
+
id: 2
|
|
12
|
+
note:
|
|
13
|
+
position: 2
|
|
14
|
+
role_00003:
|
|
15
|
+
name: Librarian
|
|
16
|
+
display_name: Librarian
|
|
17
|
+
id: 3
|
|
18
|
+
note:
|
|
19
|
+
position: 3
|
|
20
|
+
role_00004:
|
|
21
|
+
name: Administrator
|
|
22
|
+
display_name: Administrator
|
|
23
|
+
id: 4
|
|
24
|
+
note:
|
|
25
|
+
position: 4
|
|
26
|
+
|
|
27
|
+
# == Schema Information
|
|
28
|
+
#
|
|
29
|
+
# Table name: roles
|
|
30
|
+
#
|
|
31
|
+
# id :bigint(8) not null, primary key
|
|
32
|
+
# name :string not null
|
|
33
|
+
# display_name_translations :jsonb not null
|
|
34
|
+
# note :text
|
|
35
|
+
# position :integer
|
|
36
|
+
# created_at :datetime not null
|
|
37
|
+
# updated_at :datetime not null
|
|
38
|
+
#
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
namespace :enju_seed do
|
|
2
|
+
desc "create initial records for enju_seed"
|
|
3
|
+
task setup: :environment do
|
|
4
|
+
Dir.glob(Rails.root.to_s + '/db/fixtures/enju_seed/*.yml').each do |file|
|
|
5
|
+
ActiveRecord::FixtureSet.create_fixtures('db/fixtures/enju_seed', File.basename(file, '.*'))
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
end
|
|
@@ -9,7 +9,7 @@ require "enju_leaf"
|
|
|
9
9
|
module Dummy
|
|
10
10
|
class Application < Rails::Application
|
|
11
11
|
# Initialize configuration defaults for originally generated Rails version.
|
|
12
|
-
config.load_defaults 5.
|
|
12
|
+
config.load_defaults 5.2
|
|
13
13
|
|
|
14
14
|
# Settings in config/environments/* take precedence over those specified here.
|
|
15
15
|
# Application configuration should go into files in config/initializers
|
|
@@ -8,19 +8,11 @@ class AddTranslationTableToLibraryGroup < ActiveRecord::Migration[4.2]
|
|
|
8
8
|
migrate_data: true
|
|
9
9
|
})
|
|
10
10
|
end
|
|
11
|
-
|
|
12
|
-
if defined?(AwesomeHstoreTranslate)
|
|
13
|
-
add_column :library_groups, :login_banner, :hstore
|
|
14
|
-
end
|
|
15
11
|
end
|
|
16
12
|
|
|
17
13
|
def down
|
|
18
14
|
if defined?(Globalize)
|
|
19
15
|
LibraryGroup.drop_translation_table! migrate_data: true
|
|
20
16
|
end
|
|
21
|
-
|
|
22
|
-
if defined?(AwesomeHstoreTranslate)
|
|
23
|
-
remove_column :library_groups, :login_banner
|
|
24
|
-
end
|
|
25
17
|
end
|
|
26
18
|
end
|
data/spec/dummy/db/migrate/20160801080619_add_most_recent_to_resource_import_file_transitions.rb
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
class AddMostRecentToResourceImportFileTransitions < ActiveRecord::Migration[4.2]
|
|
2
|
+
def up
|
|
3
|
+
add_column :resource_import_file_transitions, :most_recent, :boolean, null: true
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
def down
|
|
7
|
+
remove_column :resource_import_file_transitions, :most_recent
|
|
8
|
+
end
|
|
9
|
+
end
|
data/spec/dummy/db/migrate/20160801080637_add_most_recent_to_resource_export_file_transitions.rb
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
class AddMostRecentToResourceExportFileTransitions < ActiveRecord::Migration[4.2]
|
|
2
|
+
def up
|
|
3
|
+
add_column :resource_export_file_transitions, :most_recent, :boolean, null: true
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
def down
|
|
7
|
+
remove_column :resource_export_file_transitions, :most_recent
|
|
8
|
+
end
|
|
9
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
class CreateIssnRecordAndManifestations < ActiveRecord::Migration[5.2]
|
|
2
|
+
def change
|
|
3
|
+
create_table :issn_record_and_manifestations do |t|
|
|
4
|
+
t.references :issn_record, foreign_key: true, on_delete: :cascade, null: false
|
|
5
|
+
t.references :manifestation, foreign_key: true, on_delete: :cascade, null: false
|
|
6
|
+
t.integer :position
|
|
7
|
+
|
|
8
|
+
t.timestamps
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
class CreateIsbnRecordAndManifestations < ActiveRecord::Migration[5.2]
|
|
2
|
+
def change
|
|
3
|
+
create_table :isbn_record_and_manifestations do |t|
|
|
4
|
+
t.references :isbn_record, foreign_key: true, on_delete: :cascade, null: false
|
|
5
|
+
t.references :manifestation, foreign_key: true, null: false, on_delete: :cascade
|
|
6
|
+
t.integer :position
|
|
7
|
+
|
|
8
|
+
t.timestamps
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class AddConstraintsToMostRecentForUserImportFileTransitions < ActiveRecord::Migration[4.2]
|
|
2
|
+
disable_ddl_transaction!
|
|
3
|
+
|
|
4
|
+
def up
|
|
5
|
+
add_index :user_import_file_transitions, [:user_import_file_id, :most_recent], unique: true, where: "most_recent", name: "index_user_import_file_transitions_parent_most_recent" #, algorithm: :concurrently
|
|
6
|
+
change_column_null :user_import_file_transitions, :most_recent, false
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def down
|
|
10
|
+
remove_index :user_import_file_transitions, name: "index_user_import_file_transitions_parent_most_recent"
|
|
11
|
+
change_column_null :user_import_file_transitions, :most_recent, true
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class AddConstraintsToMostRecentForUserExportFileTransitions < ActiveRecord::Migration[4.2]
|
|
2
|
+
disable_ddl_transaction!
|
|
3
|
+
|
|
4
|
+
def up
|
|
5
|
+
add_index :user_export_file_transitions, [:user_export_file_id, :most_recent], unique: true, where: "most_recent", name: "index_user_export_file_transitions_parent_most_recent" #, algorithm: :concurrently
|
|
6
|
+
change_column_null :user_export_file_transitions, :most_recent, false
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def down
|
|
10
|
+
remove_index :user_export_file_transitions, name: "index_user_export_file_transitions_parent_most_recent"
|
|
11
|
+
change_column_null :user_export_file_transitions, :most_recent, true
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class AddConstraintsToMostRecentForAgentImportFileTransitions < ActiveRecord::Migration[4.2]
|
|
2
|
+
disable_ddl_transaction!
|
|
3
|
+
|
|
4
|
+
def up
|
|
5
|
+
add_index :agent_import_file_transitions, [:agent_import_file_id, :most_recent], unique: true, where: "most_recent", name: "index_agent_import_file_transitions_parent_most_recent" #, algorithm: :concurrently
|
|
6
|
+
change_column_null :agent_import_file_transitions, :most_recent, false
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def down
|
|
10
|
+
remove_index :agent_import_file_transitions, name: "index_agent_import_file_transitions_parent_most_recent"
|
|
11
|
+
change_column_null :agent_import_file_transitions, :most_recent, true
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class AddConstraintsToMostRecentForResourceImportFileTransitions < ActiveRecord::Migration[4.2]
|
|
2
|
+
disable_ddl_transaction!
|
|
3
|
+
|
|
4
|
+
def up
|
|
5
|
+
add_index :resource_import_file_transitions, [:resource_import_file_id, :most_recent], unique: true, where: "most_recent", name: "index_resource_import_file_transitions_parent_most_recent" #, algorithm: :concurrently
|
|
6
|
+
change_column_null :resource_import_file_transitions, :most_recent, false
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def down
|
|
10
|
+
remove_index :resource_import_file_transitions, name: "index_resource_import_file_transitions_parent_most_recent"
|
|
11
|
+
change_column_null :resource_import_file_transitions, :most_recent, true
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class AddConstraintsToMostRecentForResourceExportFileTransitions < ActiveRecord::Migration[4.2]
|
|
2
|
+
disable_ddl_transaction!
|
|
3
|
+
|
|
4
|
+
def up
|
|
5
|
+
add_index :resource_export_file_transitions, [:resource_export_file_id, :most_recent], unique: true, where: "most_recent", name: "index_resource_export_file_transitions_parent_most_recent" #, algorithm: :concurrently
|
|
6
|
+
change_column_null :resource_export_file_transitions, :most_recent, false
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def down
|
|
10
|
+
remove_index :resource_export_file_transitions, name: "index_resource_export_file_transitions_parent_most_recent"
|
|
11
|
+
change_column_null :resource_export_file_transitions, :most_recent, true
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class AddConstraintsToMostRecentForImportRequestTransitions < ActiveRecord::Migration[4.2]
|
|
2
|
+
disable_ddl_transaction!
|
|
3
|
+
|
|
4
|
+
def up
|
|
5
|
+
add_index :import_request_transitions, [:import_request_id, :most_recent], unique: true, where: "most_recent", name: "index_import_request_transitions_parent_most_recent" #, algorithm: :concurrently
|
|
6
|
+
change_column_null :import_request_transitions, :most_recent, false
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def down
|
|
10
|
+
remove_index :import_request_transitions, name: "index_import_request_transitions_parent_most_recent"
|
|
11
|
+
change_column_null :import_request_transitions, :most_recent, true
|
|
12
|
+
end
|
|
13
|
+
end
|
data/spec/dummy/db/migrate/20180107162659_add_constraints_to_most_recent_for_message_transitions.rb
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class AddConstraintsToMostRecentForMessageTransitions < ActiveRecord::Migration[5.2]
|
|
2
|
+
disable_ddl_transaction!
|
|
3
|
+
|
|
4
|
+
def up
|
|
5
|
+
add_index :message_transitions, [:message_id, :most_recent], unique: true, where: "most_recent", name: "index_message_transitions_parent_most_recent" # , algorithm: :concurrently
|
|
6
|
+
change_column_null :message_transitions, :most_recent, false
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def down
|
|
10
|
+
remove_index :message_transitions, name: "index_message_transitions_parent_most_recent"
|
|
11
|
+
change_column_null :message_transitions, :most_recent, true
|
|
12
|
+
end
|
|
13
|
+
end
|