enju_library 0.3.9 → 0.4.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (216) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -3
  3. data/app/controllers/concerns/enju_library/controller.rb +5 -5
  4. data/app/controllers/libraries_controller.rb +4 -1
  5. data/app/controllers/library_groups_controller.rb +7 -1
  6. data/app/controllers/request_status_types_controller.rb +6 -1
  7. data/app/controllers/request_types_controller.rb +6 -1
  8. data/app/controllers/shelves_controller.rb +4 -1
  9. data/app/controllers/user_groups_controller.rb +3 -0
  10. data/app/helpers/enju_library/application_helper.rb +18 -0
  11. data/app/models/budget_type.rb +9 -7
  12. data/app/models/concerns/enju_library/enju_user.rb +10 -0
  13. data/app/models/library.rb +29 -43
  14. data/app/models/library_group.rb +10 -11
  15. data/app/models/request_status_type.rb +9 -7
  16. data/app/models/request_type.rb +9 -7
  17. data/app/models/search_engine.rb +14 -18
  18. data/app/models/shelf.rb +13 -11
  19. data/app/models/user_export_file.rb +1 -1
  20. data/app/models/user_export_file_state_machine.rb +1 -1
  21. data/app/models/user_group.rb +2 -0
  22. data/app/models/user_import_file.rb +28 -27
  23. data/app/models/user_import_file_state_machine.rb +1 -1
  24. data/app/models/withdraw.rb +6 -0
  25. data/app/policies/shelf_policy.rb +1 -1
  26. data/app/views/accepts/_list.html.erb +2 -2
  27. data/app/views/accepts/index.html.erb +2 -2
  28. data/app/views/budget_types/_form.html.erb +1 -1
  29. data/app/views/budget_types/index.html.erb +1 -1
  30. data/app/views/budget_types/show.html.erb +1 -1
  31. data/app/views/libraries/_calendar.html.erb +1 -1
  32. data/app/views/libraries/_form.html.erb +2 -12
  33. data/app/views/libraries/_map.html+phone.erb +2 -2
  34. data/app/views/libraries/_map.html.erb +23 -10
  35. data/app/views/libraries/index.html.erb +1 -1
  36. data/app/views/libraries/show.html+phone.erb +1 -1
  37. data/app/views/libraries/show.html+phone.slim +1 -1
  38. data/app/views/libraries/show.html.erb +2 -2
  39. data/app/views/library_groups/_form.html.erb +14 -13
  40. data/app/views/library_groups/index.html.erb +1 -1
  41. data/app/views/library_groups/show.html.erb +2 -2
  42. data/app/views/picture_files/_index_shelf.html.erb +1 -1
  43. data/app/views/request_status_types/_form.html.erb +1 -1
  44. data/app/views/request_status_types/index.html.erb +1 -1
  45. data/app/views/request_status_types/show.html.erb +1 -1
  46. data/app/views/request_types/_form.html.erb +1 -1
  47. data/app/views/request_types/index.html.erb +1 -1
  48. data/app/views/request_types/show.html.erb +1 -1
  49. data/app/views/shelves/_form.html.erb +1 -1
  50. data/app/views/shelves/_select_form.html.erb +1 -1
  51. data/app/views/shelves/index.html.erb +3 -3
  52. data/app/views/shelves/show.html+phone.erb +1 -1
  53. data/app/views/shelves/show.html+phone.slim +1 -1
  54. data/app/views/shelves/show.html.erb +2 -2
  55. data/app/views/user_groups/_form.html.erb +1 -1
  56. data/app/views/user_groups/index.html.erb +1 -1
  57. data/app/views/user_groups/show.html.erb +2 -2
  58. data/app/views/user_import_files/_results.html.erb +0 -5
  59. data/app/views/user_import_files/new.html.erb +2 -2
  60. data/app/views/user_import_files/show.html.erb +2 -2
  61. data/app/views/user_import_results/index.html.erb +11 -0
  62. data/app/views/withdraws/_list.html.erb +2 -2
  63. data/app/views/withdraws/index.html.erb +3 -3
  64. data/app/views/withdraws/new.html.erb +1 -1
  65. data/config/locales/translation_en.yml +2 -4
  66. data/config/locales/translation_ja.yml +2 -4
  67. data/db/migrate/20160813191647_add_max_number_of_results_to_library_group.rb +1 -1
  68. data/db/migrate/20190630113817_add_display_name_translations_to_library_group.rb +12 -0
  69. data/db/migrate/20190630115523_add_login_banner_translations_to_library_group.rb +6 -0
  70. data/lib/enju_library/version.rb +1 -1
  71. data/lib/generators/enju_library/setup/setup_generator.rb +2 -7
  72. data/lib/generators/enju_library/setup/templates/db/fixtures/budget_types.yml +4 -0
  73. data/lib/generators/enju_library/setup/templates/db/fixtures/libraries.yml +2 -2
  74. data/lib/generators/enju_library/setup/templates/db/fixtures/library_groups.yml +11 -5
  75. data/lib/generators/enju_library/setup/templates/db/fixtures/user_groups.yml +1 -2
  76. data/spec/controllers/budget_types_controller_spec.rb +1 -1
  77. data/spec/controllers/items_controller_spec.rb +35 -0
  78. data/spec/dummy/app/helpers/application_helper.rb +1 -0
  79. data/spec/dummy/app/models/user.rb +1 -2
  80. data/spec/dummy/bin/bundle +1 -1
  81. data/spec/dummy/bin/setup +1 -3
  82. data/spec/dummy/bin/update +4 -2
  83. data/spec/dummy/bin/yarn +3 -3
  84. data/spec/dummy/config/application.rb +1 -0
  85. data/spec/dummy/config/database.yml +70 -9
  86. data/spec/dummy/config/initializers/assets.rb +1 -1
  87. data/spec/dummy/config/storage.yml +34 -0
  88. data/spec/dummy/db/development.sqlite3 +0 -0
  89. data/spec/dummy/db/migrate/113_create_events.rb +2 -4
  90. data/spec/dummy/db/migrate/20081028093607_create_event_import_files.rb +2 -4
  91. data/spec/dummy/db/migrate/20090519203307_create_participates.rb +2 -4
  92. data/spec/dummy/db/migrate/20100925074639_create_event_import_results.rb +2 -2
  93. data/spec/dummy/db/migrate/20140720192418_add_default_library_id_to_event_import_file.rb +1 -1
  94. data/spec/dummy/db/migrate/20140812152348_create_event_export_files.rb +1 -1
  95. data/spec/dummy/db/migrate/20140814070854_add_default_event_category_id_to_event_import_file.rb +1 -1
  96. data/spec/dummy/db/migrate/20151128142913_create_places.rb +14 -0
  97. data/spec/dummy/db/migrate/20151201163718_add_place_id_to_event.rb +5 -0
  98. data/spec/dummy/db/migrate/20160319144230_create_issn_records.rb +11 -0
  99. data/spec/dummy/db/migrate/20160506144040_create_isbn_records.rb +11 -0
  100. data/spec/dummy/db/migrate/20160703184258_add_most_recent_to_event_import_file_transitions.rb +9 -0
  101. data/spec/dummy/db/migrate/20160703184311_add_most_recent_to_event_export_file_transitions.rb +9 -0
  102. data/spec/dummy/db/migrate/20170116134107_create_issn_record_and_manifestations.rb +11 -0
  103. data/spec/dummy/db/migrate/20170116134120_create_isbn_record_and_manifestations.rb +11 -0
  104. data/spec/dummy/db/migrate/20170116150432_create_jpno_records.rb +10 -0
  105. data/spec/dummy/db/migrate/20171126072934_create_ndla_records.rb +10 -0
  106. data/spec/dummy/db/migrate/20180107162659_add_constraints_to_most_recent_for_message_transitions.rb +13 -0
  107. data/spec/dummy/db/migrate/20180107162711_add_constraints_to_most_recent_for_message_request_transitions.rb +13 -0
  108. data/spec/dummy/db/migrate/20180107164558_add_constraints_to_most_recent_for_event_import_file_transitions.rb +13 -0
  109. data/spec/dummy/db/migrate/20180107164617_add_constraints_to_most_recent_for_event_export_file_transitions.rb +13 -0
  110. data/spec/dummy/db/migrate/20181030072731_add_not_null_to_position_on_carrier_type.rb +14 -0
  111. data/spec/dummy/db/migrate/20181119170645_add_foreign_key_to_events_referencing_event_categories.rb +5 -0
  112. data/spec/dummy/db/migrate/20190102034126_create_doi_records.rb +13 -0
  113. data/spec/dummy/db/migrate/20190208135957_create_active_storage_tables.active_storage.rb +27 -0
  114. data/spec/dummy/db/migrate/20190311154610_create_periodicals.rb +10 -0
  115. data/spec/dummy/db/migrate/20190312033839_create_periodical_and_manifestations.rb +11 -0
  116. data/spec/dummy/db/migrate/20190314151124_add_full_name_translations_to_create.rb +7 -0
  117. data/spec/dummy/db/migrate/20190501043418_create_ndl_bib_id_records.rb +10 -0
  118. data/spec/dummy/db/migrate/20190508160525_create_retains.rb +10 -0
  119. data/spec/dummy/db/migrate/20190512133459_upgrade_enju_event_to_enju_leaf20.rb +115 -0
  120. data/spec/dummy/db/migrate/20190629134017_rename_user_group_has_checkout_type_due_date_before_to_due_date_after.rb +5 -0
  121. data/spec/dummy/db/migrate/20190630151446_add_display_name_translations_to_role.rb +5 -0
  122. data/spec/dummy/db/migrate/20190630153136_add_display_name_translations_to_event.rb +6 -0
  123. data/spec/dummy/db/migrate/20190706052525_add_display_name_translations_to_circulation_status.rb +5 -0
  124. data/spec/dummy/db/migrate/20190712163038_add_display_name_translations_to_carrier_type.rb +21 -0
  125. data/spec/dummy/db/migrate/20190713114724_add_checkout_id_to_checkin.rb +6 -0
  126. data/spec/dummy/db/migrate/20190713114940_add_profile_id_to_user.rb +5 -0
  127. data/spec/dummy/db/migrate/20190713115451_add_full_name_translations_to_profile.rb +5 -0
  128. data/spec/dummy/db/migrate/20190814120827_add_display_name_translations_to_checkout_type.rb +5 -0
  129. data/spec/dummy/db/schema.rb +402 -204
  130. data/spec/dummy/db/test.sqlite3 +0 -0
  131. data/spec/factories/budget_types.rb +8 -7
  132. data/spec/factories/profile.rb +9 -2
  133. data/spec/factories/user.rb +25 -31
  134. data/spec/factories/user_export_file.rb +5 -0
  135. data/spec/factories/user_import_file.rb +7 -0
  136. data/spec/factories/user_import_result.rb +6 -0
  137. data/spec/fixtures/agent_relationship_types.yml +34 -0
  138. data/spec/fixtures/agent_types.yml +11 -11
  139. data/spec/fixtures/agents.yml +27 -27
  140. data/spec/fixtures/baskets.yml +1 -0
  141. data/spec/fixtures/bookstores.yml +1 -0
  142. data/spec/fixtures/budget_types.yml +9 -7
  143. data/spec/fixtures/carrier_type_has_checkout_types.yml +5 -5
  144. data/spec/fixtures/carrier_types.yml +28 -24
  145. data/spec/fixtures/checked_items.yml +6 -6
  146. data/spec/fixtures/checkins.yml +4 -11
  147. data/spec/fixtures/checkout_stat_has_manifestations.yml +5 -5
  148. data/spec/fixtures/checkout_stat_has_users.yml +6 -6
  149. data/spec/fixtures/checkout_types.yml +11 -11
  150. data/spec/fixtures/checkouts.yml +16 -17
  151. data/spec/fixtures/circulation_statuses.yml +29 -38
  152. data/spec/fixtures/classification_types.yml +63 -0
  153. data/spec/fixtures/content_types.yml +20 -31
  154. data/spec/fixtures/create_types.yml +43 -0
  155. data/spec/fixtures/event_categories.yml +23 -23
  156. data/spec/fixtures/frequencies.yml +17 -25
  157. data/spec/fixtures/identifier_types.yml +42 -0
  158. data/spec/fixtures/item_has_use_restrictions.yml +11 -11
  159. data/spec/fixtures/items.yml +28 -17
  160. data/spec/fixtures/languages.yml +12 -13
  161. data/spec/fixtures/lending_policies.yml +8 -15
  162. data/spec/fixtures/libraries.yml +30 -29
  163. data/spec/fixtures/library_groups.yml +12 -9
  164. data/spec/fixtures/manifestation_checkout_stats.yml +4 -3
  165. data/spec/fixtures/manifestation_relationship_types.yml +29 -0
  166. data/spec/fixtures/manifestation_reserve_stats.yml +4 -3
  167. data/spec/fixtures/manifestations.yml +60 -50
  168. data/spec/fixtures/message_requests.yml +3 -3
  169. data/spec/fixtures/produce_types.yml +29 -0
  170. data/spec/fixtures/profiles.yml +11 -6
  171. data/spec/fixtures/realize_types.yml +36 -0
  172. data/spec/fixtures/request_status_types.yml +14 -13
  173. data/spec/fixtures/request_types.yml +13 -12
  174. data/spec/fixtures/reserve_stat_has_manifestations.yml +5 -5
  175. data/spec/fixtures/reserve_stat_has_users.yml +5 -5
  176. data/spec/fixtures/reserve_transitions.yml +8 -7
  177. data/spec/fixtures/reserves.yml +44 -64
  178. data/spec/fixtures/roles.yml +22 -5
  179. data/spec/fixtures/search_engines.yml +13 -12
  180. data/spec/fixtures/shelves.yml +16 -15
  181. data/spec/fixtures/subject_heading_types.yml +39 -0
  182. data/spec/fixtures/subject_types.yml +28 -0
  183. data/spec/fixtures/use_restrictions.yml +4 -4
  184. data/spec/fixtures/user_checkout_stats.yml +4 -4
  185. data/spec/fixtures/user_export_files.yml +1 -1
  186. data/spec/fixtures/user_group_has_checkout_types.yml +19 -19
  187. data/spec/fixtures/user_groups.yml +4 -3
  188. data/spec/fixtures/user_has_roles.yml +3 -4
  189. data/spec/fixtures/user_reserve_stats.yml +5 -4
  190. data/spec/models/budget_type_spec.rb +8 -7
  191. data/spec/models/library_group_spec.rb +5 -14
  192. data/spec/models/library_spec.rb +26 -25
  193. data/spec/models/request_status_type_spec.rb +8 -7
  194. data/spec/models/request_type_spec.rb +8 -7
  195. data/spec/models/search_engine_spec.rb +13 -12
  196. data/spec/models/shelf_spec.rb +12 -11
  197. data/spec/models/user_export_file_spec.rb +2 -2
  198. data/spec/models/user_group_spec.rb +1 -6
  199. data/spec/models/user_import_file_spec.rb +23 -23
  200. data/spec/rails_helper.rb +10 -2
  201. data/spec/system/libraries_spec.rb +5 -5
  202. metadata +476 -493
  203. data/app/helpers/shelves_helper.rb +0 -16
  204. data/app/views/layouts/libraries.html.erb +0 -31
  205. data/app/views/libraries/_map_header.html.erb +0 -6
  206. data/db/migrate/20151213070943_add_translation_table_to_library_group.rb +0 -18
  207. data/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +0 -22
  208. data/lib/generators/enju_library/setup/templates/db/fixtures/library_group/translations.yml +0 -12
  209. data/spec/dummy/app/assets/config/manifest.js +0 -5
  210. data/spec/dummy/db/migrate/20190818075603_add_memo_to_manifestation.rb +0 -5
  211. data/spec/dummy/db/migrate/20190818075628_add_memo_to_item.rb +0 -5
  212. data/spec/dummy/db/migrate/20200425072340_create_manifestation_custom_properties.rb +0 -12
  213. data/spec/dummy/db/migrate/20200425072349_create_item_custom_properties.rb +0 -12
  214. data/spec/dummy/db/migrate/20200425074758_create_manifestation_custom_values.rb +0 -12
  215. data/spec/dummy/db/migrate/20200425074822_create_item_custom_values.rb +0 -12
  216. data/spec/dummy/yarn.lock +0 -7535
data/app/models/shelf.rb CHANGED
@@ -12,6 +12,7 @@ class Shelf < ApplicationRecord
12
12
  before_update :reset_position
13
13
 
14
14
  acts_as_list scope: :library
15
+ translates :display_name
15
16
 
16
17
  searchable do
17
18
  string :shelf_name do
@@ -53,15 +54,16 @@ end
53
54
  #
54
55
  # Table name: shelves
55
56
  #
56
- # id :integer not null, primary key
57
- # name :string not null
58
- # display_name :text
59
- # note :text
60
- # library_id :integer not null
61
- # items_count :integer default(0), not null
62
- # position :integer
63
- # created_at :datetime
64
- # updated_at :datetime
65
- # deleted_at :datetime
66
- # closed :boolean default(FALSE), not null
57
+ # id :integer not null, primary key
58
+ # name :string not null
59
+ # display_name :text
60
+ # note :text
61
+ # library_id :integer not null
62
+ # items_count :integer default(0), not null
63
+ # position :integer
64
+ # created_at :datetime
65
+ # updated_at :datetime
66
+ # deleted_at :datetime
67
+ # closed :boolean default(FALSE), not null
68
+ # display_name_translations :jsonb not null
67
69
  #
@@ -61,7 +61,7 @@ end
61
61
  # user_id :integer
62
62
  # user_export_file_name :string
63
63
  # user_export_content_type :string
64
- # user_export_file_size :integer
64
+ # user_export_file_size :bigint
65
65
  # user_export_updated_at :datetime
66
66
  # executed_at :datetime
67
67
  # created_at :datetime
@@ -6,7 +6,7 @@ class UserExportFileStateMachine
6
6
  state :completed
7
7
  state :failed
8
8
 
9
- transition from: :pending, to: [:started, :failed]
9
+ transition from: :pending, to: :started
10
10
  transition from: :started, to: [:completed, :failed]
11
11
 
12
12
  after_transition(from: :pending, to: :started) do |user_export_file|
@@ -5,6 +5,7 @@ class UserGroup < ApplicationRecord
5
5
  validates_numericality_of :valid_period_for_new_user,
6
6
  greater_than_or_equal_to: 0,
7
7
  allow_blank: true
8
+ translates :display_name
8
9
 
9
10
  paginates_per 10
10
11
  end
@@ -26,4 +27,5 @@ end
26
27
  # number_of_day_to_notify_overdue :integer default(7), not null
27
28
  # number_of_day_to_notify_due_date :integer default(3), not null
28
29
  # number_of_time_to_notify_overdue :integer default(3), not null
30
+ # display_name_translations :jsonb not null
29
31
  #
@@ -45,7 +45,7 @@ class UserImportFile < ApplicationRecord
45
45
  # 利用者情報をTSVファイルを用いて作成します。
46
46
  def import
47
47
  transition_to!(:started)
48
- num = { user_imported: 0, user_found: 0, failed: 0, error: 0 }
48
+ num = { user_imported: 0, user_found: 0, error: 0 }
49
49
  rows = open_import_file(create_import_temp_file(user_import))
50
50
  row_num = 1
51
51
 
@@ -69,34 +69,35 @@ class UserImportFile < ApplicationRecord
69
69
  num[:user_found] += 1
70
70
  else
71
71
  new_user = User.new
72
- new_user.role = Role.find_by(name: row['role'])
73
- if new_user.role
74
- unless user.has_role?(new_user.role.name)
75
- num[:failed] += 1
76
- next
77
- end
78
- else
79
- new_user.role = Role.find(2) # User
80
- end
81
72
  new_user.username = username
82
73
  new_user.assign_attributes(set_user_params(row))
83
74
  profile = Profile.new
84
75
  profile.assign_attributes(set_profile_params(row))
76
+ if row['role'].present?
77
+ role = Role.find_by(name: row['role'])
78
+ else
79
+ role = Role.find(2) # User
80
+ end
85
81
 
86
82
  Profile.transaction do
87
- if new_user.valid? and profile.valid?
83
+ if profile.valid? && role
88
84
  new_user.profile = profile
89
- import_result.user = new_user
90
- import_result.save!
91
- num[:user_imported] += 1
92
- else
93
- error_message = "line #{row_num}: "
94
- error_message += new_user.errors.full_messages.join(" ")
95
- error_message += profile.errors.full_messages.join(" ")
96
- import_result.error_message = error_message
97
- import_result.save
98
- num[:error] += 1
85
+ new_user.role = role
86
+
87
+ if new_user.save
88
+ import_result.user = new_user
89
+ import_result.save!
90
+ num[:user_imported] += 1
91
+ next
92
+ end
99
93
  end
94
+
95
+ error_message = "line #{row_num}: "
96
+ error_message += new_user.errors.full_messages.join(" ")
97
+ error_message += profile.errors.full_messages.join(" ")
98
+ import_result.error_message = error_message
99
+ import_result.save
100
+ num[:error] += 1
100
101
  end
101
102
  end
102
103
  end
@@ -145,7 +146,7 @@ class UserImportFile < ApplicationRecord
145
146
  )
146
147
 
147
148
  username = row['username']
148
- new_user = User.find_by(username: username)
149
+ new_user = User.where(username: username).first
149
150
  if new_user.try(:profile)
150
151
  new_user.assign_attributes(set_user_params(row))
151
152
  new_user.profile.assign_attributes(set_profile_params(row))
@@ -192,7 +193,7 @@ class UserImportFile < ApplicationRecord
192
193
  rows.each do |row|
193
194
  row_num += 1
194
195
  username = row['username'].to_s.strip
195
- remove_user = User.find_by(username: username)
196
+ remove_user = User.where(username: username).first
196
197
  if remove_user.try(:deletable_by?, user)
197
198
  UserImportFile.transaction do
198
199
  remove_user.destroy
@@ -288,15 +289,15 @@ class UserImportFile < ApplicationRecord
288
289
  # @param [Hash] row 利用者情報のハッシュ
289
290
  def set_profile_params(row)
290
291
  params = {}
291
- user_group = UserGroup.find_by(name: row['user_group'])
292
+ user_group = UserGroup.where(name: row['user_group']).first
292
293
  unless user_group
293
294
  user_group = default_user_group
294
295
  end
295
296
  params[:user_group_id] = user_group.id if user_group
296
297
 
297
- required_role = Role.find_by(name: row['required_role'])
298
+ required_role = Role.where(name: row['required_role']).first
298
299
  unless required_role
299
- required_role = Role.find_by(name: 'Librarian')
300
+ required_role = Role.where(name: 'Librarian').first
300
301
  end
301
302
  params[:required_role_id] = required_role.id if required_role
302
303
 
@@ -318,7 +319,7 @@ class UserImportFile < ApplicationRecord
318
319
  params[:locale] = row['locale']
319
320
  end
320
321
 
321
- library = Library.find_by(name: row['library'].to_s.strip)
322
+ library = Library.where(name: row['library'].to_s.strip).first
322
323
  unless library
323
324
  library = default_library || Library.web
324
325
  end
@@ -6,7 +6,7 @@ class UserImportFileStateMachine
6
6
  state :completed
7
7
  state :failed
8
8
 
9
- transition from: :pending, to: [:started, :failed]
9
+ transition from: :pending, to: :started
10
10
  transition from: :started, to: [:completed, :failed]
11
11
 
12
12
  after_transition(from: :pending, to: :started) do |user_import_file|
@@ -7,10 +7,16 @@ class Withdraw < ApplicationRecord
7
7
  uniqueness: true, #{ message: I18n.t('withdraw.already_withdrawn', locale: I18n.default_locale) },
8
8
  presence: true #, { message: I18n.translate('withdraw.item_not_found', locale: I18n.default_locale) }
9
9
  validates_presence_of :basket_id
10
+ validate :check_item
10
11
 
11
12
  attr_accessor :item_identifier
12
13
 
13
14
  paginates_per 10
15
+
16
+ def check_item
17
+ errors.add(:item) if item.try(:rent?)
18
+ errors.add(:item) if item.try(:reserved?)
19
+ end
14
20
  end
15
21
 
16
22
  # == Schema Information
@@ -17,7 +17,7 @@ class ShelfPolicy < ApplicationPolicy
17
17
 
18
18
  def destroy?
19
19
  if user.try(:has_role?, 'Administrator')
20
- true if record.items.count == 0 && !record.web_shelf?
20
+ true if record.items.empty? && !record.web_shelf?
21
21
  end
22
22
  end
23
23
  end
@@ -20,8 +20,8 @@
20
20
  <td>
21
21
  <%= render 'manifestations/show_index', manifestation: accept.item.manifestation %>
22
22
  <%= link_to accept.item.item_identifier, accept.item -%> / <%= accept.item.call_number %>
23
- (<%= link_to accept.item.shelf.library.display_name.localize, accept.item.shelf.library %> /
24
- <%= link_to accept.item.shelf.display_name.localize, accept.item.shelf %>)<br />
23
+ (<%= link_to accept.item.shelf.library.display_name, accept.item.shelf.library %> /
24
+ <%= link_to accept.item.shelf.display_name, accept.item.shelf %>)<br />
25
25
  <%=l accept.created_at %>
26
26
  </td>
27
27
  </tr>
@@ -23,8 +23,8 @@
23
23
  <% if accept.item %>
24
24
  <%= render 'manifestations/show_index', manifestation: accept.item.manifestation %>
25
25
  <%= link_to accept.item.item_identifier, accept.item -%> / <%= accept.item.call_number %>
26
- (<%= link_to accept.item.shelf.library.display_name.localize, accept.item.shelf.library %> /
27
- <%= link_to accept.item.shelf.display_name.localize, accept.item.shelf %>)<br />
26
+ (<%= link_to accept.item.shelf.library.display_name, accept.item.shelf.library %> /
27
+ <%= link_to accept.item.shelf.display_name, accept.item.shelf %>)<br />
28
28
  <%=l accept.created_at %>
29
29
  <% end %>
30
30
  </td>
@@ -3,7 +3,7 @@
3
3
 
4
4
  <div class="field">
5
5
  <%= f.label :name %><br />
6
- <%= f.text_field :name %>
6
+ <%= f.text_field :name, required: true %>
7
7
  </div>
8
8
  <div class="field">
9
9
  <%= f.label :display_name %><br />
@@ -19,7 +19,7 @@
19
19
  <%- end -%>
20
20
  </td>
21
21
  <td><%= link_to budget_type.name, budget_type -%></td>
22
- <td><%= link_to budget_type.display_name.localize, budget_type -%></td>
22
+ <td><%= link_to budget_type.display_name, budget_type -%></td>
23
23
  <td><%= budget_type.note -%></td>
24
24
  <td>
25
25
  <%- if policy(budget_type).update? -%>
@@ -10,7 +10,7 @@
10
10
 
11
11
  <p>
12
12
  <strong><%= t('activerecord.attributes.budget_type.display_name') -%>:</strong>
13
- <%= @budget_type.display_name.localize -%>
13
+ <%= @budget_type.display_name -%>
14
14
  </p>
15
15
 
16
16
  <p>
@@ -3,7 +3,7 @@
3
3
  <ul>
4
4
  <%- @events.each do |event| -%>
5
5
  <li>
6
- <%= link_to event.display_name.localize, event -%>
6
+ <%= link_to event.display_name, event -%>
7
7
  <% if event.all_day? %>
8
8
  (<%= l(event.start_at, format: :only_date) -%> - <%= l(event.end_at, format: :only_date) -%>)
9
9
  <% else %>
@@ -20,12 +20,12 @@
20
20
  <% unless @library.web? %>
21
21
  <div class="field">
22
22
  <%= f.label :isil -%><br />
23
- <%= f.text_field :isil, class: 'resource_identifier' -%>
23
+ <%= f.text_field :isil, class: 'resource_identifierr' -%>
24
24
  </div>
25
25
 
26
26
  <div class="field">
27
27
  <%= f.label t('activerecord.models.country') -%><br />
28
- <%= f.select(:country_id, @countries.collect{|c| [c.display_name.localize, c.id]}) -%>
28
+ <%= f.select(:country_id, @countries.collect{|c| [c.display_name, c.id]}) -%>
29
29
  </div>
30
30
 
31
31
  <div class="field">
@@ -48,16 +48,6 @@
48
48
  <%= f.text_area :street, class: 'resource_textarea' -%>
49
49
  </div>
50
50
 
51
- <div class="field">
52
- <%= f.label :latitude -%><br />
53
- <%= f.text_field :latitude -%>
54
- </div>
55
-
56
- <div class="field">
57
- <%= f.label :longitude -%><br />
58
- <%= f.text_field :longitude -%>
59
- </div>
60
-
61
51
  <div class="field">
62
52
  <%= f.label :telephone_number_1 -%><br />
63
53
  <%= f.phone_field :telephone_number_1 -%>
@@ -12,10 +12,10 @@
12
12
  var marker = new google.maps.Marker({
13
13
  position: latlng,
14
14
  map: map,
15
- title: '<%= library.display_name.localize %>'
15
+ title: '<%= library.display_name %>'
16
16
  });
17
17
  var infowindow = new google.maps.InfoWindow({
18
- content: '<%= library.display_name.localize %>'
18
+ content: '<%= library.display_name %>'
19
19
  });
20
20
  google.maps.event.addListener(marker, 'click', function() {
21
21
  infowindow.open(map,marker);
@@ -1,12 +1,25 @@
1
- <div id="library_map" style="width: 500px; height: 500px;"></div>
2
- <script>
3
- var mymap = L.map('library_map').setView([<%= @library.latitude %>, <%= @library.longitude %>], 13);
4
- L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
5
- attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
6
- maxZoom: 18
7
- }).addTo(mymap);
8
- L.marker([<%= @library.latitude %>, <%= @library.longitude %>]).addTo(mymap).bindPopup('<%= @library.display_name.localize %>').openPopup();
9
- jQuery(document).ready(function ($) {
10
- mymap.invalidateSize();
1
+ <script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
2
+ <script type="text/javascript">
3
+ google.maps.event.addDomListener(window, 'load', function() {
4
+ var latlng = new google.maps.LatLng(<%= library.latitude %>, <%= library.longitude %>);
5
+ var options = {
6
+ zoom: 16,
7
+ center: latlng,
8
+ mapTypeId: google.maps.MapTypeId.ROADMAP,
9
+ scaleControl: true
10
+ };
11
+ var map = new google.maps.Map(document.getElementById("library_map"), options);
12
+ var marker = new google.maps.Marker({
13
+ position: latlng,
14
+ map: map,
15
+ title: '<%= library.display_name %>'
16
+ });
17
+ var infowindow = new google.maps.InfoWindow({
18
+ content: '<%= library.display_name %>'
19
+ });
20
+ google.maps.event.addListener(marker, 'click', function() {
21
+ infowindow.open(map,marker);
22
+ });
11
23
  });
12
24
  </script>
25
+ <div id="library_map" style="width: 500px; height: 500px;"></div>
@@ -47,7 +47,7 @@
47
47
  </td>
48
48
  <td><%= library.name -%></td>
49
49
  <td>
50
- <%= link_to library.display_name.localize, library -%>
50
+ <%= link_to library.display_name, library -%>
51
51
  <br />
52
52
  <%= library.zip_code -%>
53
53
  <%= library.address -%>
@@ -1,6 +1,6 @@
1
1
  <div data-role="header">
2
2
  <a href="javascript:history.back()" data-icon="back" data-iconpos="notext" class="ui-btn-left"><%= t('page.back') %></a>
3
- <h1 class="title"><%= @library.display_name.localize -%></h1>
3
+ <h1 class="title"><%= @library.display_name -%></h1>
4
4
  </div>
5
5
  <div data-role="content">
6
6
  <div id="detail">
@@ -2,7 +2,7 @@ div[data-role="header"]
2
2
  a.ui-btn-left[href="javascript:history.back()" data-icon="back" data-iconpos="notext"]
3
3
  = t('page.back')
4
4
  .panel-heading
5
- = @library.display_name.localize
5
+ = @library.display_name
6
6
  div[data-role="content"]
7
7
  #detail
8
8
  p
@@ -1,5 +1,5 @@
1
1
  <div id="content_detail" class="ui-corner-all ui-widget-content">
2
- <h1 class="title"><%= @library.display_name.localize -%></h1>
2
+ <h1 class="title"><%= @library.display_name -%></h1>
3
3
  <div id="content_list">
4
4
  <p id="notice"><%= notice %></p>
5
5
 
@@ -71,7 +71,7 @@
71
71
  <%- @library.shelves.each do |shelf| -%>
72
72
  <tr class="line<%= cycle("0", "1") -%>">
73
73
  <td>
74
- <%= link_to shelf.display_name.localize, shelf_path(shelf, library_id: @library.name) -%>
74
+ <%= link_to shelf.display_name, shelf_path(shelf, library_id: @library.name) -%>
75
75
  <%- shelf.picture_files.each do |picture_file| -%>
76
76
  <%= link_to image_tag('icons/picture.png', size: '16x16', class: 'enju_icon', alt: t('page.picture')), picture_file_path(picture_file, format: :download), rel: "shelf_#{h(shelf.id)}" -%>
77
77
  <%- end -%>
@@ -6,10 +6,13 @@
6
6
  <%= f.text_field :name, class: 'short_name' -%>
7
7
  </div>
8
8
 
9
- <div class="field">
10
- <%= f.label :display_name -%><br />
11
- <%= f.text_area :display_name, class: 'resource_textarea' -%>
12
- </div>
9
+ <% I18n.available_locales.each do |locale| %>
10
+ <div class="field">
11
+ <% display_name = "display_name_#{locale.to_s}" %>
12
+ <%= f.label :display_name -%> (<%= locale.to_s %>)<br />
13
+ <%= f.text_field display_name -%>
14
+ </div>
15
+ <% end %>
13
16
 
14
17
  <div class="field">
15
18
  <%= f.label :header_logo -%><br />
@@ -31,17 +34,15 @@
31
34
  <%= f.url_field :url, class: 'resource_url' -%>
32
35
  </div>
33
36
 
34
- <% @available_languages.each do |language| -%>
37
+ <% I18n.available_locales.each do |locale| -%>
35
38
  <div class="field">
36
- <%= f.label :login_banner -%> (<%= language.display_name.localize -%>)<br />
37
- <%= f.text_area LibraryGroup.localized_attr_name_for(:login_banner, language.iso_639_1) -%>
39
+ <%= f.label :login_banner -%> (<%= locale -%>)<br />
40
+ <%= f.text_area :"login_banner_#{locale.to_s}" -%>
38
41
  </div>
39
- <% end -%>
40
42
 
41
- <% @available_languages.each do |language| -%>
42
- <div>
43
- <%= f.label :footer_banner -%> (<%= language.display_name.localize -%>)<br />
44
- <%= f.text_area LibraryGroup.localized_attr_name_for(:footer_banner, language.iso_639_1) -%>
43
+ <div class="field">
44
+ <%= f.label :footer_banner -%> (<%= locale -%>)<br />
45
+ <%= f.text_area :"footer_banner_#{locale.to_s}" -%>
45
46
  </div>
46
47
  <% end -%>
47
48
 
@@ -66,7 +67,7 @@
66
67
 
67
68
  <div class="field">
68
69
  <%= f.label t('activerecord.models.country') -%><br />
69
- <%= f.select(:country_id, @countries.collect{|c| [c.display_name.localize, c.id]}) -%>
70
+ <%= f.select(:country_id, @countries.collect{|c| [c.display_name, c.id]}) -%>
70
71
  </div>
71
72
 
72
73
  <% if defined?(EnjuBookmark) %>