enju_seed 0.3.0.beta.2 → 0.3.0.beta.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/my_accounts_controller.rb +4 -4
- data/app/models/concerns/enju_seed/enju_user.rb +1 -1
- data/app/models/concerns/master_model.rb +1 -11
- data/app/models/identity.rb +1 -1
- data/app/models/profile.rb +6 -8
- data/app/models/role.rb +10 -27
- data/app/models/user_has_role.rb +2 -2
- data/app/policies/user_export_file_policy.rb +21 -0
- data/app/policies/user_import_file_policy.rb +21 -0
- data/app/policies/user_import_result_policy.rb +21 -0
- data/app/views/my_accounts/_edit_credential.html.slim +6 -6
- data/app/views/my_accounts/show.html.slim +1 -1
- data/app/views/profiles/_edit_credential.html.erb +6 -6
- data/app/views/profiles/_edit_credential.html.slim +6 -6
- data/app/views/profiles/new.html.slim +3 -3
- data/app/views/roles/index.html.slim +1 -1
- data/app/views/roles/show.html.slim +1 -1
- data/db/migrate/041_create_roles.rb +5 -6
- data/db/migrate/20100606065209_create_user_has_roles.rb +3 -3
- data/db/migrate/20140122054321_create_profiles.rb +5 -13
- data/db/migrate/20140811031145_add_expired_at_to_profile.rb +1 -1
- data/db/migrate/20141003181336_add_full_name_transcription_to_profile.rb +1 -1
- data/db/migrate/20141003182825_add_date_of_birth_to_profile.rb +1 -1
- data/db/migrate/20150421023923_create_identities.rb +4 -6
- data/db/migrate/20151126005552_add_provider_to_identity.rb +2 -2
- data/db/migrate/20170114174536_add_profile_id_to_user.rb +5 -0
- data/lib/enju_seed/engine.rb +2 -0
- data/lib/enju_seed/version.rb +1 -1
- data/spec/controllers/my_accounts_controller_spec.rb +0 -12
- data/spec/controllers/profiles_controller_spec.rb +24 -21
- data/spec/controllers/roles_controller_spec.rb +1 -1
- data/spec/dummy/db/migrate/005_create_manifestations.rb +12 -13
- data/spec/dummy/db/migrate/006_create_items.rb +7 -8
- data/spec/dummy/db/migrate/012_create_owns.rb +3 -5
- data/spec/dummy/db/migrate/015_create_creates.rb +3 -5
- data/spec/dummy/db/migrate/047_create_produces.rb +3 -5
- data/spec/dummy/db/migrate/059_create_libraries.rb +9 -10
- data/spec/dummy/db/migrate/069_create_shelves.rb +5 -6
- data/spec/dummy/db/migrate/073_create_carrier_types.rb +3 -3
- data/spec/dummy/db/migrate/077_create_user_groups.rb +4 -4
- data/spec/dummy/db/migrate/080_create_library_groups.rb +6 -7
- data/spec/dummy/db/migrate/112_create_frequencies.rb +3 -3
- data/spec/dummy/db/migrate/117_create_form_of_works.rb +3 -3
- data/spec/dummy/db/migrate/120_create_baskets.rb +3 -4
- data/spec/dummy/db/migrate/124_create_bookstores.rb +3 -3
- data/spec/dummy/db/migrate/130_create_request_status_types.rb +3 -3
- data/spec/dummy/db/migrate/131_create_request_types.rb +3 -3
- data/spec/dummy/db/migrate/20080830154109_create_realizes.rb +3 -5
- data/spec/dummy/db/migrate/20080830172106_create_exemplifies.rb +2 -4
- data/spec/dummy/db/migrate/20081006090811_create_subscriptions.rb +4 -5
- data/spec/dummy/db/migrate/20081006093246_create_subscribes.rb +5 -7
- data/spec/dummy/db/migrate/20090720091106_create_medium_of_performances.rb +3 -3
- data/spec/dummy/db/migrate/20090720091429_create_content_types.rb +3 -3
- data/spec/dummy/db/migrate/20100129142347_create_import_requests.rb +4 -7
- data/spec/dummy/db/migrate/20100211105551_add_admin_networks_to_library_group.rb +1 -1
- data/spec/dummy/db/migrate/20100525124311_create_manifestation_relationships.rb +4 -6
- data/spec/dummy/db/migrate/20120319173203_create_accepts.rb +3 -6
- data/spec/dummy/db/migrate/20130506175834_create_identifiers.rb +4 -5
- data/spec/dummy/db/migrate/20140110122216_create_user_import_files.rb +2 -2
- data/spec/dummy/db/migrate/20140110131010_create_user_import_results.rb +2 -2
- data/spec/dummy/db/migrate/20140524074813_create_user_import_file_transitions.rb +5 -4
- data/spec/dummy/db/migrate/20140529014410_create_item_transitions.rb +15 -0
- data/spec/dummy/db/migrate/20140709113413_create_user_export_files.rb +1 -1
- data/spec/dummy/db/migrate/20140709113905_create_user_export_file_transitions.rb +5 -5
- data/spec/dummy/db/migrate/20140720170714_add_default_library_id_to_user_import_file.rb +1 -1
- data/spec/dummy/db/migrate/20140720170735_add_default_user_group_id_to_user_import_file.rb +1 -1
- data/spec/dummy/db/migrate/20140802082007_add_manifestation_id_to_item.rb +2 -3
- data/spec/dummy/db/migrate/20141029131633_create_periodicals.rb +2 -2
- data/spec/dummy/db/migrate/20150924115059_create_withdraws.rb +3 -5
- data/spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +2 -2
- data/spec/dummy/db/migrate/20151216123621_create_doi_records.rb +4 -4
- data/spec/dummy/db/migrate/20160319144230_create_issn_records.rb +4 -4
- data/spec/dummy/db/migrate/20160506144040_create_isbn_records.rb +4 -4
- data/spec/dummy/db/schema.rb +173 -144
- data/spec/factories/profile.rb +4 -4
- data/spec/factories/user.rb +3 -0
- data/spec/fixtures/libraries.yml +37 -37
- data/spec/fixtures/library_groups.yml +27 -20
- data/spec/fixtures/profiles.yml +27 -35
- data/spec/fixtures/roles.yml +12 -12
- data/spec/fixtures/user_groups.yml +20 -10
- data/spec/fixtures/user_has_roles.yml +2 -2
- data/spec/fixtures/users.yml +7 -0
- data/spec/models/profile_spec.rb +7 -9
- data/spec/models/role_spec.rb +10 -11
- data/spec/models/user_has_role_spec.rb +3 -4
- data/spec/models/user_spec.rb +0 -1
- metadata +33 -20
- data/db/migrate/20140610123439_drop_email_unique_constraint_enju_leaf_rc10.rb +0 -11
- data/spec/dummy/db/migrate/20150117111136_add_foreign_key_to_items_referencing_manifestations.rb +0 -5
- data/spec/dummy/db/migrate/20150124152756_add_foreign_key_to_shelves_referencing_libraries.rb +0 -6
- data/spec/dummy/db/migrate/20160703190209_add_foreign_key_on_manifestation_id_to_reserve.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ba893a5163fd2bb7eb4b681a7265c7fba70b8e3
|
4
|
+
data.tar.gz: c3b528b1fd10d49fed41d74fcd7224abe454b449
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c487ad5770413b2821716618cad27f5a24039ab7b798de925533cdb89695a456590a1573cbb9b3ada21a282d8e50d76391185e325724bc31244a36d3079c011a
|
7
|
+
data.tar.gz: ffa66d57221c9a9238a5b62128837ede6fe453581c67dcf6d57064e0d6bf876d37abc183e85171d586e4ea1e87cdbef79c71fc86566b7ed5561cd0372a7c09b3
|
@@ -86,9 +86,9 @@ class MyAccountsController < ApplicationController
|
|
86
86
|
@libraries = Library.order(:position)
|
87
87
|
@languages = Language.order(:position)
|
88
88
|
current_user.locked = if current_user.active_for_authentication?
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
89
|
+
'0'
|
90
|
+
else
|
91
|
+
'1'
|
92
|
+
end
|
93
93
|
end
|
94
94
|
end
|
@@ -6,13 +6,13 @@ module EnjuSeed
|
|
6
6
|
scope :administrators, -> { joins(:role).where('roles.name = ?', 'Administrator') }
|
7
7
|
scope :librarians, -> { joins(:role).where('roles.name = ? OR roles.name = ?', 'Administrator', 'Librarian') }
|
8
8
|
scope :suspended, -> { where('locked_at IS NOT NULL') }
|
9
|
-
has_one :profile
|
10
9
|
if defined?(EnjuBiblio)
|
11
10
|
has_many :import_requests
|
12
11
|
has_many :picture_files, as: :picture_attachable, dependent: :destroy
|
13
12
|
end
|
14
13
|
has_one :user_has_role, dependent: :destroy
|
15
14
|
has_one :role, through: :user_has_role
|
15
|
+
belongs_to :profile
|
16
16
|
belongs_to :user_group
|
17
17
|
belongs_to :library
|
18
18
|
belongs_to :required_role, class_name: 'Role', foreign_key: 'required_role_id'
|
@@ -3,14 +3,10 @@ module MasterModel
|
|
3
3
|
|
4
4
|
included do
|
5
5
|
acts_as_list
|
6
|
-
validates :name, uniqueness: { case_sensitive: false }
|
7
|
-
validates :name, presence: true
|
6
|
+
validates :name, presence: true, uniqueness: { case_sensitive: false }
|
8
7
|
validate :name do
|
9
8
|
valid_name?
|
10
9
|
end
|
11
|
-
validate :display_name do
|
12
|
-
valid_yaml?
|
13
|
-
end
|
14
10
|
validates :display_name, presence: true
|
15
11
|
before_validation :set_display_name, on: :create
|
16
12
|
strip_attributes only: :name
|
@@ -28,10 +24,4 @@ module MasterModel
|
|
28
24
|
errors.add(:name, I18n.t('page.only_lowercase_letters_and_numbers_are_allowed'))
|
29
25
|
end
|
30
26
|
end
|
31
|
-
|
32
|
-
def valid_yaml?
|
33
|
-
YAML.load(display_name)
|
34
|
-
rescue Psych::SyntaxError
|
35
|
-
errors.add(:display_name, I18n.t('page.cannot_parse_yaml_header'))
|
36
|
-
end
|
37
27
|
end
|
data/app/models/identity.rb
CHANGED
data/app/models/profile.rb
CHANGED
@@ -3,7 +3,7 @@ class Profile < ActiveRecord::Base
|
|
3
3
|
|
4
4
|
scope :administrators, -> { joins(user: :role).where('roles.name = ?', 'Administrator') }
|
5
5
|
scope :librarians, -> { joins(user: :role).where('roles.name = ? OR roles.name = ?', 'Administrator', 'Librarian') }
|
6
|
-
|
6
|
+
has_one :user
|
7
7
|
belongs_to :library, validate: true
|
8
8
|
belongs_to :user_group
|
9
9
|
belongs_to :required_role, class_name: 'Role', foreign_key: 'required_role_id' # , validate: true
|
@@ -15,7 +15,6 @@ class Profile < ActiveRecord::Base
|
|
15
15
|
validates_associated :user
|
16
16
|
validates :user_group, :library, :locale, presence: true # , :user_number
|
17
17
|
validates :user_number, uniqueness: true, format: { with: /\A[0-9A-Za-z_]+\z/ }, allow_blank: true
|
18
|
-
validates :user_id, uniqueness: true, allow_blank: true
|
19
18
|
validates :birth_date, format: { with: /\A\d{4}-\d{1,2}-\d{1,2}\z/ }, allow_blank: true
|
20
19
|
|
21
20
|
strip_attributes only: :user_number
|
@@ -79,18 +78,17 @@ end
|
|
79
78
|
#
|
80
79
|
# Table name: profiles
|
81
80
|
#
|
82
|
-
# id :
|
83
|
-
#
|
84
|
-
#
|
85
|
-
# library_id :integer
|
81
|
+
# id :uuid not null, primary key
|
82
|
+
# user_group_id :uuid
|
83
|
+
# library_id :uuid
|
86
84
|
# locale :string
|
87
85
|
# user_number :string
|
88
86
|
# full_name :text
|
89
87
|
# note :text
|
90
88
|
# keyword_list :text
|
91
89
|
# required_role_id :integer
|
92
|
-
# created_at :datetime
|
93
|
-
# updated_at :datetime
|
90
|
+
# created_at :datetime not null
|
91
|
+
# updated_at :datetime not null
|
94
92
|
# checkout_icalendar_token :string
|
95
93
|
# save_checkout_history :boolean default(FALSE), not null
|
96
94
|
# expired_at :datetime
|
data/app/models/role.rb
CHANGED
@@ -3,30 +3,13 @@ class Role < ActiveRecord::Base
|
|
3
3
|
validates :name, presence: true, format: { with: /\A[A-Za-z][a-z_,]*[a-z]\z/ }
|
4
4
|
has_many :user_has_roles
|
5
5
|
has_many :users, through: :user_has_roles
|
6
|
-
after_save :clear_all_cache
|
7
|
-
after_destroy :clear_all_cache
|
8
6
|
|
9
7
|
extend FriendlyId
|
10
8
|
friendly_id :name
|
11
|
-
|
12
|
-
def localized_name
|
13
|
-
display_name.localize
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.all_cache
|
17
|
-
if Rails.env == 'production'
|
18
|
-
Rails.cache.fetch('role_all') { Role.select(:name).all }
|
19
|
-
else
|
20
|
-
Role.select(:name)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def clear_all_cache
|
25
|
-
Rails.cache.delete('role_all')
|
26
|
-
end
|
9
|
+
translates :display_name
|
27
10
|
|
28
11
|
def self.default_role
|
29
|
-
Role.
|
12
|
+
Role.find_by(name: 'Guest')
|
30
13
|
end
|
31
14
|
|
32
15
|
private
|
@@ -40,12 +23,12 @@ end
|
|
40
23
|
#
|
41
24
|
# Table name: roles
|
42
25
|
#
|
43
|
-
# id
|
44
|
-
# name
|
45
|
-
#
|
46
|
-
# note
|
47
|
-
# created_at
|
48
|
-
# updated_at
|
49
|
-
# score
|
50
|
-
# position
|
26
|
+
# id :integer not null, primary key
|
27
|
+
# name :string not null
|
28
|
+
# display_name_translations :jsonb
|
29
|
+
# note :text
|
30
|
+
# created_at :datetime not null
|
31
|
+
# updated_at :datetime not null
|
32
|
+
# score :integer default(0), not null
|
33
|
+
# position :integer
|
51
34
|
#
|
data/app/models/user_has_role.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
class UserExportFilePolicy < ApplicationPolicy
|
2
|
+
def index?
|
3
|
+
true if user.try(:has_role?, 'Administrator')
|
4
|
+
end
|
5
|
+
|
6
|
+
def show?
|
7
|
+
true if user.try(:has_role?, 'Administrator')
|
8
|
+
end
|
9
|
+
|
10
|
+
def create?
|
11
|
+
true if user.try(:has_role?, 'Administrator')
|
12
|
+
end
|
13
|
+
|
14
|
+
def update?
|
15
|
+
true if user.try(:has_role?, 'Administrator')
|
16
|
+
end
|
17
|
+
|
18
|
+
def destroy?
|
19
|
+
true if user.try(:has_role?, 'Administrator')
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class UserImportFilePolicy < ApplicationPolicy
|
2
|
+
def index?
|
3
|
+
true if user.try(:has_role?, 'Librarian')
|
4
|
+
end
|
5
|
+
|
6
|
+
def show?
|
7
|
+
true if user.try(:has_role?, 'Librarian')
|
8
|
+
end
|
9
|
+
|
10
|
+
def create?
|
11
|
+
true if user.try(:has_role?, 'Librarian')
|
12
|
+
end
|
13
|
+
|
14
|
+
def update?
|
15
|
+
true if user.try(:has_role?, 'Librarian')
|
16
|
+
end
|
17
|
+
|
18
|
+
def destroy?
|
19
|
+
true if user.try(:has_role?, 'Librarian')
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class UserImportResultPolicy < ApplicationPolicy
|
2
|
+
def index?
|
3
|
+
true if user.try(:has_role?, 'Librarian')
|
4
|
+
end
|
5
|
+
|
6
|
+
def show?
|
7
|
+
true if user.try(:has_role?, 'Librarian')
|
8
|
+
end
|
9
|
+
|
10
|
+
def create?
|
11
|
+
false
|
12
|
+
end
|
13
|
+
|
14
|
+
def update?
|
15
|
+
false
|
16
|
+
end
|
17
|
+
|
18
|
+
def destroy?
|
19
|
+
false
|
20
|
+
end
|
21
|
+
end
|
@@ -24,9 +24,9 @@
|
|
24
24
|
br
|
25
25
|
= user_form.fields_for :user_has_role do |u|
|
26
26
|
- if current_user.has_role?('Administrator') and current_user != profile.user
|
27
|
-
= u.select(:role_id, @roles.collect{|r| [r.display_name
|
27
|
+
= u.select(:role_id, @roles.collect{|r| [r.display_name, r.id]}, {}, {class: 'form-control'})
|
28
28
|
- else
|
29
|
-
= u.select(:role_id, @roles.collect{|r| [r.display_name
|
29
|
+
= u.select(:role_id, @roles.collect{|r| [r.display_name, r.id]}, {}, {disabled: 'disabled', class: 'form-control'})
|
30
30
|
#right_pane_detail
|
31
31
|
.form-group
|
32
32
|
= f.label :full_name
|
@@ -40,7 +40,7 @@
|
|
40
40
|
.form-group
|
41
41
|
= f.label t('activerecord.models.user_group')
|
42
42
|
br
|
43
|
-
= f.select(:user_group_id, @user_groups.collect{|u| [u.display_name
|
43
|
+
= f.select(:user_group_id, @user_groups.collect{|u| [u.display_name, u.id]}, {}, {class: 'form-control'})
|
44
44
|
.form-group
|
45
45
|
= f.label :user_number
|
46
46
|
br
|
@@ -52,12 +52,12 @@
|
|
52
52
|
.form-group
|
53
53
|
= f.label t('activerecord.models.library')
|
54
54
|
br
|
55
|
-
= f.select(:library_id, @libraries.collect{|l| [l.display_name
|
55
|
+
= f.select(:library_id, @libraries.collect{|l| [l.display_name, l.id]}, {}, {class: 'form-control'})
|
56
56
|
.form-group
|
57
57
|
= f.label t('role.required_role')
|
58
58
|
br
|
59
|
-
= f.select(:required_role_id, @roles.collect{|r| [r.display_name
|
59
|
+
= f.select(:required_role_id, @roles.collect{|r| [r.display_name, r.id]}, {}, {class: 'form-control'})
|
60
60
|
.form-group
|
61
61
|
= f.label :locale
|
62
62
|
br
|
63
|
-
= f.select(:locale, @available_languages.collect{|language| [language.display_name
|
63
|
+
= f.select(:locale, @available_languages.collect{|language| [language.display_name, language.iso_639_1]}, {}, {class: 'form-control'})
|
@@ -8,7 +8,7 @@
|
|
8
8
|
ul.list-group
|
9
9
|
- current_user.profile.user_group.user_group_has_checkout_types.each do |available_checkout_type|
|
10
10
|
li.list-group-item
|
11
|
-
= available_checkout_type.checkout_type.display_name
|
11
|
+
= available_checkout_type.checkout_type.display_name
|
12
12
|
| :
|
13
13
|
= current_user.checked_item_count[:"#{available_checkout_type.checkout_type.name}"]
|
14
14
|
| /
|
@@ -34,9 +34,9 @@
|
|
34
34
|
<%= user_form.label t('activerecord.models.role') -%><br />
|
35
35
|
<%= user_form.fields_for :user_has_role do |u| %>
|
36
36
|
<%- if current_user.has_role?('Administrator') and current_user != profile.user -%>
|
37
|
-
<%= u.select :role_id, @roles.select{|r| r.name != 'Guest' }.collect{|r| [r.display_name
|
37
|
+
<%= u.select :role_id, @roles.select{|r| r.name != 'Guest' }.collect{|r| [r.display_name, r.id]} %>
|
38
38
|
<% else %>
|
39
|
-
<%= u.select :role_id, @roles.select{|r| r.name != 'Guest' }.collect{|r| [r.display_name
|
39
|
+
<%= u.select :role_id, @roles.select{|r| r.name != 'Guest' }.collect{|r| [r.display_name, r.id]}, {}, {disabled: 'disabled'} %>
|
40
40
|
<% end %>
|
41
41
|
<% end %>
|
42
42
|
</div>
|
@@ -56,7 +56,7 @@
|
|
56
56
|
<%- if current_user.has_role?('Librarian') -%>
|
57
57
|
<div class="field">
|
58
58
|
<%= f.label t('activerecord.models.user_group') -%><br />
|
59
|
-
<%= f.select(:user_group_id, @user_groups.collect{|u| [u.display_name
|
59
|
+
<%= f.select(:user_group_id, @user_groups.collect{|u| [u.display_name, u.id]}) -%>
|
60
60
|
</div>
|
61
61
|
<%- end -%>
|
62
62
|
|
@@ -72,17 +72,17 @@
|
|
72
72
|
<%- if current_user.has_role?('Librarian') -%>
|
73
73
|
<div class="field">
|
74
74
|
<%= f.label t('activerecord.models.library') -%><br />
|
75
|
-
<%= f.select(:library_id, @libraries.collect{|l| [l.display_name
|
75
|
+
<%= f.select(:library_id, @libraries.collect{|l| [l.display_name, l.id]}) -%>
|
76
76
|
</div>
|
77
77
|
|
78
78
|
<div class="field">
|
79
79
|
<%= f.label t('role.required_role') -%><br />
|
80
|
-
<%= f.select(:required_role_id, @roles.collect{|r| [r.display_name
|
80
|
+
<%= f.select(:required_role_id, @roles.collect{|r| [r.display_name, r.id]}) -%>
|
81
81
|
</div>
|
82
82
|
<%- end -%>
|
83
83
|
<div class="field">
|
84
84
|
<%= f.label :locale -%><br />
|
85
|
-
<%= f.select(:locale, @available_languages.collect{|language| [language.display_name
|
85
|
+
<%= f.select(:locale, @available_languages.collect{|language| [language.display_name, language.iso_639_1]}) -%>
|
86
86
|
</div>
|
87
87
|
</div>
|
88
88
|
<% end %>
|
@@ -28,9 +28,9 @@
|
|
28
28
|
br
|
29
29
|
= user_form.fields_for :user_has_role do |u|
|
30
30
|
- if current_user.has_role?('Administrator') and current_user != profile.user
|
31
|
-
= u.select(:role_id, @roles.collect{|r| [r.display_name
|
31
|
+
= u.select(:role_id, @roles.collect{|r| [r.display_name, r.id]}, {}, {class: 'form-control', disabled: 'disabled'})
|
32
32
|
- else
|
33
|
-
= u.select(:role_id, @roles.collect{|r| [r.display_name
|
33
|
+
= u.select(:role_id, @roles.collect{|r| [r.display_name, r.id]}, {}, {class: 'form-control', disabled: 'disabled'})
|
34
34
|
#right_pane_detail
|
35
35
|
.form-group
|
36
36
|
= f.label :full_name
|
@@ -44,7 +44,7 @@
|
|
44
44
|
.form-group
|
45
45
|
= f.label t('activerecord.models.user_group')
|
46
46
|
br
|
47
|
-
= f.select(:user_group_id, @user_groups.collect{|u| [u.display_name
|
47
|
+
= f.select(:user_group_id, @user_groups.collect{|u| [u.display_name, u.id]}, {}, {class: 'form-control'})
|
48
48
|
.form-group
|
49
49
|
= f.label :user_number
|
50
50
|
br
|
@@ -56,12 +56,12 @@
|
|
56
56
|
.form-group
|
57
57
|
= f.label t('activerecord.models.library')
|
58
58
|
br
|
59
|
-
= f.select(:library_id, @libraries.collect{|l| [l.display_name
|
59
|
+
= f.select(:library_id, @libraries.collect{|l| [l.display_name, l.id]}, {}, {class: 'form-control'})
|
60
60
|
.form-group
|
61
61
|
= f.label t('role.required_role')
|
62
62
|
br
|
63
|
-
= f.select(:required_role_id, @roles.collect{|r| [r.display_name
|
63
|
+
= f.select(:required_role_id, @roles.collect{|r| [r.display_name, r.id]}, {}, {class: 'form-control'})
|
64
64
|
.form-group
|
65
65
|
= f.label :locale
|
66
66
|
br
|
67
|
-
= f.select(:locale, @available_languages.collect{|language| [language.display_name
|
67
|
+
= f.select(:locale, @available_languages.collect{|language| [language.display_name, language.iso_639_1]}, {}, {class: 'form-control'})
|
@@ -38,13 +38,13 @@
|
|
38
38
|
= f.text_field :full_name_transcription, class: 'form-control'
|
39
39
|
.form-group
|
40
40
|
= f.label :user_group_id
|
41
|
-
= f.select(:user_group_id, @user_groups.collect{|u| [u.display_name
|
41
|
+
= f.select(:user_group_id, @user_groups.collect{|u| [u.display_name, u.id]})
|
42
42
|
.form-group
|
43
43
|
= f.label t('activerecord.models.library')
|
44
|
-
= f.select(:library_id, @libraries.collect{|l| [l.display_name
|
44
|
+
= f.select(:library_id, @libraries.collect{|l| [l.display_name, l.id]})
|
45
45
|
.form-group
|
46
46
|
= f.label :locale
|
47
|
-
= f.select(:locale, @available_languages.collect{|language| [language.display_name
|
47
|
+
= f.select(:locale, @available_languages.collect{|language| [language.display_name, language.iso_639_1]})
|
48
48
|
- if defined?(EnjuSearchLog)
|
49
49
|
.form-group
|
50
50
|
= f.label :save_search_history
|
@@ -21,7 +21,7 @@
|
|
21
21
|
td
|
22
22
|
= link_to role.name, role
|
23
23
|
td
|
24
|
-
= link_to role.display_name
|
24
|
+
= link_to role.display_name, role
|
25
25
|
td
|
26
26
|
= link_to t('page.edit'), edit_role_path(role)
|
27
27
|
= link_to t('page.destroy'), role, data: {confirm: t('page.are_you_sure')}, method: :delete
|
@@ -1,11 +1,10 @@
|
|
1
|
-
class CreateRoles < ActiveRecord::Migration
|
1
|
+
class CreateRoles < ActiveRecord::Migration[5.0]
|
2
2
|
def change
|
3
3
|
create_table 'roles' do |t|
|
4
|
-
t.
|
5
|
-
t.
|
6
|
-
t.
|
7
|
-
t.
|
8
|
-
t.column :updated_at, :datetime
|
4
|
+
t.string :name, null: false
|
5
|
+
t.jsonb :display_name_translations
|
6
|
+
t.text :note
|
7
|
+
t.timestamps
|
9
8
|
t.integer :score, default: 0, null: false
|
10
9
|
t.integer :position
|
11
10
|
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
class CreateUserHasRoles < ActiveRecord::Migration
|
1
|
+
class CreateUserHasRoles < ActiveRecord::Migration[5.0]
|
2
2
|
def change
|
3
3
|
create_table :user_has_roles do |t|
|
4
|
-
t.references :user,
|
5
|
-
t.references :role,
|
4
|
+
t.references :user, foreign_key: {on_delete: :cascade}, null: false
|
5
|
+
t.references :role, foreign_key: true, null: false
|
6
6
|
|
7
7
|
t.timestamps
|
8
8
|
end
|
@@ -1,16 +1,10 @@
|
|
1
|
-
class CreateProfiles < ActiveRecord::Migration
|
1
|
+
class CreateProfiles < ActiveRecord::Migration[5.0]
|
2
2
|
def change
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
options = {}
|
7
|
-
end
|
8
|
-
create_table :profiles, options do |t|
|
9
|
-
t.references :user, index: true, foreign_key: true
|
10
|
-
t.references :user_group, index: true
|
11
|
-
t.references :library, index: true
|
3
|
+
create_table :profiles, id: :uuid, default: 'gen_random_uuid()' do |t|
|
4
|
+
t.references :user_group, type: :uuid
|
5
|
+
t.references :library, type: :uuid
|
12
6
|
t.string :locale
|
13
|
-
t.string :user_number
|
7
|
+
t.string :user_number, index: {unique: true}
|
14
8
|
t.text :full_name
|
15
9
|
t.text :note
|
16
10
|
t.text :keyword_list
|
@@ -18,7 +12,5 @@ class CreateProfiles < ActiveRecord::Migration
|
|
18
12
|
|
19
13
|
t.timestamps
|
20
14
|
end
|
21
|
-
|
22
|
-
add_index :profiles, :user_number, unique: true
|
23
15
|
end
|
24
16
|
end
|