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.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/my_accounts_controller.rb +4 -4
  3. data/app/models/concerns/enju_seed/enju_user.rb +1 -1
  4. data/app/models/concerns/master_model.rb +1 -11
  5. data/app/models/identity.rb +1 -1
  6. data/app/models/profile.rb +6 -8
  7. data/app/models/role.rb +10 -27
  8. data/app/models/user_has_role.rb +2 -2
  9. data/app/policies/user_export_file_policy.rb +21 -0
  10. data/app/policies/user_import_file_policy.rb +21 -0
  11. data/app/policies/user_import_result_policy.rb +21 -0
  12. data/app/views/my_accounts/_edit_credential.html.slim +6 -6
  13. data/app/views/my_accounts/show.html.slim +1 -1
  14. data/app/views/profiles/_edit_credential.html.erb +6 -6
  15. data/app/views/profiles/_edit_credential.html.slim +6 -6
  16. data/app/views/profiles/new.html.slim +3 -3
  17. data/app/views/roles/index.html.slim +1 -1
  18. data/app/views/roles/show.html.slim +1 -1
  19. data/db/migrate/041_create_roles.rb +5 -6
  20. data/db/migrate/20100606065209_create_user_has_roles.rb +3 -3
  21. data/db/migrate/20140122054321_create_profiles.rb +5 -13
  22. data/db/migrate/20140811031145_add_expired_at_to_profile.rb +1 -1
  23. data/db/migrate/20141003181336_add_full_name_transcription_to_profile.rb +1 -1
  24. data/db/migrate/20141003182825_add_date_of_birth_to_profile.rb +1 -1
  25. data/db/migrate/20150421023923_create_identities.rb +4 -6
  26. data/db/migrate/20151126005552_add_provider_to_identity.rb +2 -2
  27. data/db/migrate/20170114174536_add_profile_id_to_user.rb +5 -0
  28. data/lib/enju_seed/engine.rb +2 -0
  29. data/lib/enju_seed/version.rb +1 -1
  30. data/spec/controllers/my_accounts_controller_spec.rb +0 -12
  31. data/spec/controllers/profiles_controller_spec.rb +24 -21
  32. data/spec/controllers/roles_controller_spec.rb +1 -1
  33. data/spec/dummy/db/migrate/005_create_manifestations.rb +12 -13
  34. data/spec/dummy/db/migrate/006_create_items.rb +7 -8
  35. data/spec/dummy/db/migrate/012_create_owns.rb +3 -5
  36. data/spec/dummy/db/migrate/015_create_creates.rb +3 -5
  37. data/spec/dummy/db/migrate/047_create_produces.rb +3 -5
  38. data/spec/dummy/db/migrate/059_create_libraries.rb +9 -10
  39. data/spec/dummy/db/migrate/069_create_shelves.rb +5 -6
  40. data/spec/dummy/db/migrate/073_create_carrier_types.rb +3 -3
  41. data/spec/dummy/db/migrate/077_create_user_groups.rb +4 -4
  42. data/spec/dummy/db/migrate/080_create_library_groups.rb +6 -7
  43. data/spec/dummy/db/migrate/112_create_frequencies.rb +3 -3
  44. data/spec/dummy/db/migrate/117_create_form_of_works.rb +3 -3
  45. data/spec/dummy/db/migrate/120_create_baskets.rb +3 -4
  46. data/spec/dummy/db/migrate/124_create_bookstores.rb +3 -3
  47. data/spec/dummy/db/migrate/130_create_request_status_types.rb +3 -3
  48. data/spec/dummy/db/migrate/131_create_request_types.rb +3 -3
  49. data/spec/dummy/db/migrate/20080830154109_create_realizes.rb +3 -5
  50. data/spec/dummy/db/migrate/20080830172106_create_exemplifies.rb +2 -4
  51. data/spec/dummy/db/migrate/20081006090811_create_subscriptions.rb +4 -5
  52. data/spec/dummy/db/migrate/20081006093246_create_subscribes.rb +5 -7
  53. data/spec/dummy/db/migrate/20090720091106_create_medium_of_performances.rb +3 -3
  54. data/spec/dummy/db/migrate/20090720091429_create_content_types.rb +3 -3
  55. data/spec/dummy/db/migrate/20100129142347_create_import_requests.rb +4 -7
  56. data/spec/dummy/db/migrate/20100211105551_add_admin_networks_to_library_group.rb +1 -1
  57. data/spec/dummy/db/migrate/20100525124311_create_manifestation_relationships.rb +4 -6
  58. data/spec/dummy/db/migrate/20120319173203_create_accepts.rb +3 -6
  59. data/spec/dummy/db/migrate/20130506175834_create_identifiers.rb +4 -5
  60. data/spec/dummy/db/migrate/20140110122216_create_user_import_files.rb +2 -2
  61. data/spec/dummy/db/migrate/20140110131010_create_user_import_results.rb +2 -2
  62. data/spec/dummy/db/migrate/20140524074813_create_user_import_file_transitions.rb +5 -4
  63. data/spec/dummy/db/migrate/20140529014410_create_item_transitions.rb +15 -0
  64. data/spec/dummy/db/migrate/20140709113413_create_user_export_files.rb +1 -1
  65. data/spec/dummy/db/migrate/20140709113905_create_user_export_file_transitions.rb +5 -5
  66. data/spec/dummy/db/migrate/20140720170714_add_default_library_id_to_user_import_file.rb +1 -1
  67. data/spec/dummy/db/migrate/20140720170735_add_default_user_group_id_to_user_import_file.rb +1 -1
  68. data/spec/dummy/db/migrate/20140802082007_add_manifestation_id_to_item.rb +2 -3
  69. data/spec/dummy/db/migrate/20141029131633_create_periodicals.rb +2 -2
  70. data/spec/dummy/db/migrate/20150924115059_create_withdraws.rb +3 -5
  71. data/spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +2 -2
  72. data/spec/dummy/db/migrate/20151216123621_create_doi_records.rb +4 -4
  73. data/spec/dummy/db/migrate/20160319144230_create_issn_records.rb +4 -4
  74. data/spec/dummy/db/migrate/20160506144040_create_isbn_records.rb +4 -4
  75. data/spec/dummy/db/schema.rb +173 -144
  76. data/spec/factories/profile.rb +4 -4
  77. data/spec/factories/user.rb +3 -0
  78. data/spec/fixtures/libraries.yml +37 -37
  79. data/spec/fixtures/library_groups.yml +27 -20
  80. data/spec/fixtures/profiles.yml +27 -35
  81. data/spec/fixtures/roles.yml +12 -12
  82. data/spec/fixtures/user_groups.yml +20 -10
  83. data/spec/fixtures/user_has_roles.yml +2 -2
  84. data/spec/fixtures/users.yml +7 -0
  85. data/spec/models/profile_spec.rb +7 -9
  86. data/spec/models/role_spec.rb +10 -11
  87. data/spec/models/user_has_role_spec.rb +3 -4
  88. data/spec/models/user_spec.rb +0 -1
  89. metadata +33 -20
  90. data/db/migrate/20140610123439_drop_email_unique_constraint_enju_leaf_rc10.rb +0 -11
  91. data/spec/dummy/db/migrate/20150117111136_add_foreign_key_to_items_referencing_manifestations.rb +0 -5
  92. data/spec/dummy/db/migrate/20150124152756_add_foreign_key_to_shelves_referencing_libraries.rb +0 -6
  93. 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: 48b31d26672c8844701cfdbec37fc2675a81a78c
4
- data.tar.gz: 7464aa8b393cce0ee2b65f25b23df7854dcbfe84
3
+ metadata.gz: 5ba893a5163fd2bb7eb4b681a7265c7fba70b8e3
4
+ data.tar.gz: c3b528b1fd10d49fed41d74fcd7224abe454b449
5
5
  SHA512:
6
- metadata.gz: af5c9d7deddcb3bc31ab7d907aaa9b8e8c2caee1aaef4dec4c2a18b58fab80390524358b066df1a881cba048c63f9318b206d301b1877b2f1047d8ad0e388e88
7
- data.tar.gz: 92acef3d30732debbfb63d4829f908a670c79cf6e037eb8e30b72e444912bb4482de8fe8b3013e17902356f379c807ea2f554088845ba607a1d241ce5f33759a
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
- '0'
90
- else
91
- '1'
92
- end
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
@@ -19,5 +19,5 @@ end
19
19
  # profile_id :integer
20
20
  # created_at :datetime not null
21
21
  # updated_at :datetime not null
22
- # provider :string
22
+ # provider :string not null
23
23
  #
@@ -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
- belongs_to :user, dependent: :destroy
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 :integer not null, primary key
83
- # user_id :integer
84
- # user_group_id :integer
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
@@ -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.where(name: 'Guest').first
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 :integer not null, primary key
44
- # name :string not null
45
- # display_name :string
46
- # note :text
47
- # created_at :datetime
48
- # updated_at :datetime
49
- # score :integer default(0), not null
50
- # position :integer
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
  #
@@ -14,6 +14,6 @@ end
14
14
  # id :integer not null, primary key
15
15
  # user_id :integer not null
16
16
  # role_id :integer not null
17
- # created_at :datetime
18
- # updated_at :datetime
17
+ # created_at :datetime not null
18
+ # updated_at :datetime not null
19
19
  #
@@ -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.localize, r.id]}, {}, {class: 'form-control'})
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.localize, r.id]}, {}, {disabled: 'disabled', class: 'form-control'})
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.localize, u.id]}, {}, {class: 'form-control'})
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.localize, l.id]}, {}, {class: 'form-control'})
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.localize, r.id]}, {}, {class: 'form-control'})
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.localize, language.iso_639_1]}, {}, {class: 'form-control'})
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.localize
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.localize, r.id]} %>
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.localize, r.id]}, {}, {disabled: 'disabled'} %>
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.localize, u.id]}) -%>
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.localize, l.id]}) -%>
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.localize, r.id]}) -%>
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.localize, language.iso_639_1]}) -%>
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.localize, r.id]}, {}, {class: 'form-control', disabled: 'disabled'})
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.localize, r.id]}, {}, {class: 'form-control', disabled: 'disabled'})
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.localize, u.id]}, {}, {class: 'form-control'})
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.localize, l.id]}, {}, {class: 'form-control'})
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.localize, r.id]}, {}, {class: 'form-control'})
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.localize, language.iso_639_1]}, {}, {class: 'form-control'})
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.localize, u.id]})
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.localize, l.id]})
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.localize, language.iso_639_1]})
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.localize, role
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
@@ -23,7 +23,7 @@
23
23
  strong
24
24
  = t('activerecord.attributes.role.display_name')
25
25
  | :
26
- = @role.display_name.localize
26
+ = @role.display_name
27
27
  p
28
28
  strong
29
29
  = t('activerecord.attributes.role.score')
@@ -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.column :name, :string, null: false
5
- t.column :display_name, :string
6
- t.column :note, :text
7
- t.column :created_at, :datetime
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, index: true, foreign_key: true, null: false
5
- t.references :role, index: true, foreign_key: true, null: false
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
- if ENV['ENJU_ID_TYPE'] == 'uuid'
4
- options = {id: :uuid, default: 'gen_random_uuid()'}
5
- else
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