enju_leaf 1.1.0.rc14 → 1.1.0.rc15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/enju_leaf.js +0 -1
  3. data/app/assets/stylesheets/enju.css +5 -2
  4. data/app/assets/stylesheets/images/ajax-loader.gif +0 -0
  5. data/app/assets/stylesheets/images/border.png +0 -0
  6. data/app/assets/stylesheets/images/controls.png +0 -0
  7. data/app/assets/stylesheets/images/icons-18-black.png +0 -0
  8. data/app/assets/stylesheets/images/icons-18-white.png +0 -0
  9. data/app/assets/stylesheets/images/icons-36-black.png +0 -0
  10. data/app/assets/stylesheets/images/icons-36-white.png +0 -0
  11. data/app/assets/stylesheets/images/loading.gif +0 -0
  12. data/app/assets/stylesheets/images/loading_background.png +0 -0
  13. data/app/assets/stylesheets/images/overlay.png +0 -0
  14. data/app/assets/stylesheets/images/spinner_bar.gif +0 -0
  15. data/app/assets/stylesheets/pagination.css +2 -2
  16. data/app/controllers/page_controller.rb +6 -2
  17. data/app/controllers/user_import_results_controller.rb +1 -0
  18. data/app/mailers/notifier.rb +3 -3
  19. data/app/models/enju_leaf/ability.rb +3 -3
  20. data/app/models/profile.rb +3 -1
  21. data/app/models/role.rb +9 -3
  22. data/app/models/user_export_file.rb +2 -1
  23. data/app/models/user_group.rb +2 -2
  24. data/app/models/user_has_role.rb +2 -2
  25. data/app/models/user_import_file.rb +19 -17
  26. data/app/models/user_import_result.rb +3 -3
  27. data/app/views/page/_include.html.erb +40 -0
  28. data/app/views/page/_menu.html.erb +6 -3
  29. data/app/views/page/configuration.html.erb +1 -1
  30. data/app/views/page/{opensearch.builder → opensearch.xml.builder} +4 -4
  31. data/app/views/page/statistics.html.erb +2 -2
  32. data/app/views/user_import_results/show.html.erb +1 -1
  33. data/config/locales/translation_en.yml +2 -1
  34. data/config/locales/translation_ja.yml +3 -1
  35. data/lib/enju_leaf/master_model.rb +3 -3
  36. data/lib/enju_leaf/user.rb +6 -5
  37. data/lib/enju_leaf/version.rb +1 -1
  38. data/lib/enju_leaf.rb +11 -7
  39. data/lib/generators/enju_leaf/quick_install/quick_install_generator.rb +11 -11
  40. data/lib/generators/enju_leaf/setup/setup_generator.rb +21 -14
  41. data/lib/generators/enju_leaf/setup/templates/db/seeds.rb +5 -1
  42. data/lib/tasks/enju_leaf_tasks.rake +7 -11
  43. data/spec/controllers/my_accounts_controller_spec.rb +2 -2
  44. data/spec/controllers/page_controller_spec.rb +2 -2
  45. data/spec/dummy/config/application.rb +1 -1
  46. data/spec/dummy/config/boot.rb +2 -2
  47. data/spec/dummy/config/initializers/friendly_id.rb +90 -0
  48. data/spec/dummy/db/development.sqlite3 +0 -0
  49. data/spec/dummy/db/migrate/090_create_search_histories.rb +31 -0
  50. data/spec/dummy/db/migrate/20100623173800_rename_search_history_version_to_sru_version.rb +9 -0
  51. data/spec/dummy/db/migrate/20110627035057_create_series_statement_merges.rb +1 -1
  52. data/spec/dummy/db/migrate/20140823094847_add_dimensions_to_manifestation.rb +5 -0
  53. data/spec/dummy/db/migrate/20140823095740_rename_manifestation_periodical_to_serial.rb +9 -0
  54. data/spec/dummy/db/schema.rb +29 -2
  55. data/spec/dummy/db/test.sqlite3 +0 -0
  56. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20140820-9103-mfcugd.txt +8 -0
  57. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20140822-13160-wz7o56.txt +8 -0
  58. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20140824-39018-fw3fdj.txt +8 -0
  59. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20140828-69043-tbwoqv.txt +8 -0
  60. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20140915-22971-1jmyywh.txt +8 -0
  61. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20140915-23153-j4x3ru.txt +8 -0
  62. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20140915-67244-1uo8pkb.txt +8 -0
  63. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20140922-80298-14af9pc.txt +8 -0
  64. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20140922-80450-1qhv5cf.txt +8 -0
  65. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20140922-80529-1hahtrn.txt +8 -0
  66. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20140922-80725-tqmhnv.txt +8 -0
  67. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20140922-81018-wl1hgj.txt +8 -0
  68. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20140922-81246-wll5s.txt +8 -0
  69. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20140922-81371-8uz50r.txt +8 -0
  70. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20140922-84122-1u96hw6.txt +8 -0
  71. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20140926-7716-bbs13d.txt +8 -0
  72. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20141002-57000-yu6qop.txt +8 -0
  73. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20141002-57206-2j8sg2.txt +8 -0
  74. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20141002-57328-p8lryh.txt +8 -0
  75. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20141002-57609-1j3dd67.txt +8 -0
  76. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20141003-78097-dw5i2k.txt +8 -0
  77. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140820-9103-tuuox.txt +8 -0
  78. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140822-13160-17b5dbh.txt +8 -0
  79. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140824-39018-o12xa4.txt +8 -0
  80. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140915-22971-d4ul8o.txt +8 -0
  81. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140915-23153-1qmzqi6.txt +8 -0
  82. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140915-67244-1ps1qsi.txt +8 -0
  83. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140922-80298-121rh7h.txt +8 -0
  84. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140922-80450-wdetsg.txt +8 -0
  85. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140922-80529-lmet02.txt +8 -0
  86. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140922-80725-1l6tliy.txt +8 -0
  87. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140922-81018-azm74f.txt +8 -0
  88. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140922-81246-1rjpksn.txt +8 -0
  89. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140922-81371-aroaof.txt +8 -0
  90. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140922-84122-7d6kls.txt +8 -0
  91. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140926-7716-1nap0l.txt +8 -0
  92. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141002-57000-3nb1bj.txt +8 -0
  93. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141002-57206-197ca0p.txt +8 -0
  94. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141002-57328-1kra77f.txt +8 -0
  95. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141002-57609-iymry0.txt +8 -0
  96. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141003-78097-1ocngi2.txt +8 -0
  97. data/spec/dummy/solr/default/data/index/_7b.fdt +0 -0
  98. data/spec/dummy/solr/default/data/index/{_5b.fdx → _7b.fdx} +0 -0
  99. data/spec/dummy/solr/default/data/index/{_5b.fnm → _7b.fnm} +0 -0
  100. data/spec/dummy/solr/default/data/index/{_5b.nvd → _7b.nvd} +0 -0
  101. data/spec/dummy/solr/default/data/index/{_5b.nvm → _7b.nvm} +0 -0
  102. data/spec/dummy/solr/default/data/index/{_5b.si → _7b.si} +0 -0
  103. data/spec/dummy/solr/default/data/index/{_5b_Lucene41_0.doc → _7b_Lucene41_0.doc} +0 -0
  104. data/spec/dummy/solr/default/data/index/{_5b_Lucene41_0.pos → _7b_Lucene41_0.pos} +0 -0
  105. data/spec/dummy/solr/default/data/index/{_5b_Lucene41_0.tim → _7b_Lucene41_0.tim} +0 -0
  106. data/spec/dummy/solr/default/data/index/{_5b_Lucene41_0.tip → _7b_Lucene41_0.tip} +0 -0
  107. data/spec/dummy/solr/default/data/index/segments.gen +0 -0
  108. data/spec/dummy/solr/default/data/index/segments_ev +0 -0
  109. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000524 +0 -0
  110. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000525 +0 -0
  111. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000526 +0 -0
  112. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000527 +0 -0
  113. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000528 +0 -0
  114. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000529 +0 -0
  115. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000530 +0 -0
  116. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000531 +0 -0
  117. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000532 +0 -0
  118. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000533 +0 -0
  119. data/spec/dummy/tmp/cache/assets/test/sprockets/1b984bdbd3204a51a82d0e01a1569e2d +0 -0
  120. data/spec/dummy/tmp/cache/assets/test/sprockets/62899096da1a3e67660f3b88068be8c9 +0 -0
  121. data/spec/dummy/tmp/cache/assets/test/sprockets/65b2e4f67eab21b30217e29075f433b2 +0 -0
  122. data/spec/dummy/tmp/cache/assets/test/sprockets/87d24a3f43f175d4d17babe9203c79a7 +0 -0
  123. data/spec/dummy/tmp/cache/stdout +898 -0
  124. data/spec/dummy/tmp/pids/redis-test.pid +1 -1
  125. data/spec/fixtures/library_groups.yml +3 -3
  126. data/spec/fixtures/manifestations.yml +5 -6
  127. data/spec/fixtures/roles.yml +4 -0
  128. data/spec/fixtures/users.yml +1 -1
  129. data/spec/views/page/about.html.erb_spec.rb +19 -0
  130. data/spec/views/page/advanced_search.html.erb_spec.rb +20 -0
  131. data/spec/views/page/configuration.html.erb_spec.rb +19 -0
  132. data/spec/views/page/export.html.erb_spec.rb +19 -0
  133. data/spec/views/page/import.html.erb_spec.rb +19 -0
  134. data/spec/views/page/index.html.erb_spec.rb +20 -0
  135. data/spec/views/page/opensearch.xml.builder_spec.rb +20 -0
  136. data/spec/views/page/statistics.html.erb_spec.rb +20 -0
  137. data/spec/views/profiles/edit.html.erb_spec.rb +1 -1
  138. data/spec/views/profiles/index.html.erb_spec.rb +2 -2
  139. data/spec/views/profiles/new.html.erb_spec.rb +1 -1
  140. data/spec/views/profiles/show.html.erb_spec.rb +1 -1
  141. metadata +185 -76
  142. data/app/assets/images/ie6/borderBottomCenter.png +0 -0
  143. data/app/assets/images/ie6/borderBottomLeft.png +0 -0
  144. data/app/assets/images/ie6/borderBottomRight.png +0 -0
  145. data/app/assets/images/ie6/borderMiddleLeft.png +0 -0
  146. data/app/assets/images/ie6/borderMiddleRight.png +0 -0
  147. data/app/assets/images/ie6/borderTopCenter.png +0 -0
  148. data/app/assets/images/ie6/borderTopLeft.png +0 -0
  149. data/app/assets/images/ie6/borderTopRight.png +0 -0
  150. data/spec/dummy/solr/default/data/index/_5b.fdt +0 -0
  151. data/spec/dummy/solr/default/data/index/segments_av +0 -0
  152. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000380 +0 -0
  153. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000381 +0 -0
  154. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000382 +0 -0
  155. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000383 +0 -0
  156. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000384 +0 -0
  157. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000385 +0 -0
  158. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000386 +0 -0
  159. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000387 +0 -0
  160. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000388 +0 -0
  161. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000389 +0 -0
  162. data/spec/fixtures/extents.yml +0 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 95ae9f6dfbaf5012408bc8d3a69282851cde058e
4
- data.tar.gz: c74028321f37ac263e7a9c05ab8be4c19f0a66af
3
+ metadata.gz: 4e2c36786a4d1988f1d7e97b655ee4a1a8b691ed
4
+ data.tar.gz: 7b96331440eff81045e4d5ca5c2d1513b0a08439
5
5
  SHA512:
6
- metadata.gz: fd22fba7f3d5e4df989f5643a07a3e7e4be3a46aadbd156220e8517972139ae411de29edb655849d0f76a8f0b2b4f7cdaf4d3aaf418157733816d7ef2af316c4
7
- data.tar.gz: cfb1a898f9ab8e590dcefe7195b00c09d60d6fae88e79575f9abaa76cb2730f97b609262c7b54be90561e94ad3128e4cba89e3241ba42ae13f08e0019fb9c059
6
+ metadata.gz: a623d4c880c5c7e65bb302bdf2073aa1cffb5a7ade091b493aa134f85f0a00004dc1b6851987b7742b4e86cd75934c616d46dc50c30b3b59e2ef566917d5e9c8
7
+ data.tar.gz: 19069d34b47a78767df3ab5cd0ccc082e3194654eced6ca385d37608ee33ed708cc952f514c1a339be7e3592db2498cbac227f67b97890eae8b4c830fb935aa3
@@ -8,6 +8,5 @@
8
8
  //= require select_locale
9
9
  //= require portlets
10
10
  //= require tab_view
11
- //= require event_calendar
12
11
  //= require jquery.powertip
13
12
  //= require jquery_nested_form
@@ -223,8 +223,8 @@ h4{
223
223
  }
224
224
 
225
225
  h1.title, h2.title, h3.title, h4.title{
226
- color: white;
227
- background-color: #5970B2;
226
+ /* color: white; */
227
+ /* background-color: #5970B2; */
228
228
  padding: 5px;
229
229
  margin: 0px;
230
230
  }
@@ -536,3 +536,6 @@ div.search_form{
536
536
  }
537
537
 
538
538
  .hidden {display: none;}
539
+
540
+ .enju_table_header{
541
+ }
@@ -21,8 +21,8 @@
21
21
  color: #105CB6;
22
22
  border: 1px solid #9AAFE5; }
23
23
  .digg_pagination a:hover, .digg_pagination a:focus {
24
- color: #003;
25
- border-color: #003; }
24
+ /* color: #003; */
25
+ /* border-color: #003; */ }
26
26
  .digg_pagination .page_info {
27
27
  background: #2E6AB1;
28
28
  color: white;
@@ -32,11 +32,15 @@ class PageController < ApplicationController
32
32
  end
33
33
 
34
34
  def msie_acceralator
35
- render layout: false
35
+ respond_to do |format|
36
+ format.xml { render layout: false }
37
+ end
36
38
  end
37
39
 
38
40
  def opensearch
39
- render layout: false
41
+ respond_to do |format|
42
+ format.xml { render layout: false }
43
+ end
40
44
  end
41
45
 
42
46
  def advanced_search
@@ -1,5 +1,6 @@
1
1
  class UserImportResultsController < ApplicationController
2
2
  load_and_authorize_resource
3
+
3
4
  # GET /user_import_results
4
5
  # GET /user_import_results.json
5
6
  def index
@@ -8,7 +8,7 @@ class Notifier < ActionMailer::Base
8
8
  if message.subject
9
9
  subject = message.subject
10
10
  else
11
- subject = I18n.t('message.new_message_from_library', :library => LibraryGroup.system_name(message.receiver.user.profile.locale))
11
+ subject = I18n.t('message.new_message_from_library', library: LibraryGroup.system_name(message.receiver.user.profile.locale))
12
12
  end
13
13
  if message.sender
14
14
  @sender_name = message.sender.username
@@ -17,7 +17,7 @@ class Notifier < ActionMailer::Base
17
17
  end
18
18
  @message = message
19
19
  @locale = message.receiver.profile.locale
20
- mail(:from => from, :to => message.receiver.email, :subject => subject)
20
+ mail(from: from, to: message.receiver.email, subject: subject)
21
21
  end
22
22
 
23
23
  def manifestation_info(user_id, manifestation_id)
@@ -27,6 +27,6 @@ class Notifier < ActionMailer::Base
27
27
  subject = "#{manifestation.original_title} : #{LibraryGroup.system_name(user.profile.locale)}"
28
28
  @user = user
29
29
  @manifestation = manifestation
30
- mail(:from => from, :to => user.email, :subject => subject)
30
+ mail(from: from, to: user.email, subject: subject)
31
31
  end
32
32
  end
@@ -3,14 +3,14 @@ module EnjuLeaf
3
3
  include CanCan::Ability
4
4
 
5
5
  def initialize(user, ip_address = nil)
6
-
6
+
7
7
  case user.try(:role).try(:name)
8
8
  when 'Administrator'
9
9
  can :index, Profile
10
10
  can [:read, :create, :update], [User, Profile]
11
11
  can :destroy, Profile do |profile|
12
12
  if profile.user
13
- if profile != user.profile and profile.user.id != 1
13
+ if profile != user.profile && profile.user.id != 1
14
14
  if defined?(EnjuCirculation)
15
15
  if profile.user.checkouts.not_returned.empty?
16
16
  true if profile.user.deletable_by?(user)
@@ -45,7 +45,7 @@ module EnjuLeaf
45
45
  can [:read, :create, :update], Profile
46
46
  can :destroy, Profile do |profile|
47
47
  if profile.user
48
- if profile != user.profile and profile.user.id != 1
48
+ if profile != user.profile && profile.user.id != 1
49
49
  if defined?(EnjuCirculation)
50
50
  if profile.user.checkouts.not_returned.empty?
51
51
  true if profile.user.deletable_by?(user)
@@ -9,6 +9,8 @@ class Profile < ActiveRecord::Base
9
9
  enju_circulation_profile_model if defined?(EnjuCirculation)
10
10
  enju_search_log_profile_model if defined?(EnjuSearchLog)
11
11
 
12
+ scope :administrators, -> { joins(user: :role).where('roles.name = ?', 'Administrator') }
13
+ scope :librarians, -> { joins(user: :role).where('roles.name = ? OR roles.name = ?', 'Administrator', 'Librarian') }
12
14
  belongs_to :user
13
15
  belongs_to :library, validate: true
14
16
  belongs_to :user_group
@@ -17,7 +19,7 @@ class Profile < ActiveRecord::Base
17
19
  validates_associated :user_group, :library
18
20
  validates_associated :user
19
21
  validates_presence_of :user_group, :library, :locale #, :user_number
20
- validates :user_number, uniqueness: true, format: {with: /\A[0-9A-Za-z_]+\Z/}, allow_blank: true
22
+ validates :user_number, uniqueness: true, format: { with: /\A[0-9A-Za-z_]+\Z/ }, allow_blank: true
21
23
 
22
24
  searchable do
23
25
  text :user_number, :full_name, :note
data/app/models/role.rb CHANGED
@@ -1,7 +1,8 @@
1
1
  class Role < ActiveRecord::Base
2
2
  attr_accessible :name, :display_name, :note
3
3
  include MasterModel
4
- default_scope order: "roles.position"
4
+ default_scope { order("roles.position") }
5
+ validates :name, presence: true, format: { with: /\A[A-Za-z][a-z_,]*[a-z]\Z/ }
5
6
  has_many :user_has_roles
6
7
  has_many :users, through: :user_has_roles
7
8
  after_save :clear_all_cache
@@ -16,7 +17,7 @@ class Role < ActiveRecord::Base
16
17
 
17
18
  def self.all_cache
18
19
  if Rails.env == 'production'
19
- Rails.cache.fetch('role_all'){Role.select(:name).all}
20
+ Rails.cache.fetch('role_all'){ Role.select(:name).all }
20
21
  else
21
22
  Role.select(:name)
22
23
  end
@@ -27,7 +28,12 @@ class Role < ActiveRecord::Base
27
28
  end
28
29
 
29
30
  def self.default_role
30
- Rails.cache.fetch('default_role'){Role.find('Guest')}
31
+ Role.where(name: 'Guest').first
32
+ end
33
+
34
+ private
35
+ def valid_name?
36
+ true
31
37
  end
32
38
  end
33
39
 
@@ -1,4 +1,5 @@
1
1
  class UserExportFile < ActiveRecord::Base
2
+ attr_accessible
2
3
  include Statesman::Adapters::ActiveRecordModel
3
4
  include ExportFile
4
5
  enju_export_file_model
@@ -20,7 +21,7 @@ class UserExportFile < ActiveRecord::Base
20
21
  file = User.export(format: :txt)
21
22
  tempfile.puts(file)
22
23
  tempfile.close
23
- self.user_export = File.new(tempfile.path, "r")
24
+ self.user_export = File.new(tempfile.path, 'r')
24
25
  if save
25
26
  send_message
26
27
  end
@@ -7,11 +7,11 @@ class UserGroup < ActiveRecord::Base
7
7
  :number_of_time_to_notify_overdue
8
8
 
9
9
  include MasterModel
10
- default_scope order: "user_groups.position"
10
+ default_scope { order("user_groups.position") }
11
11
  has_many :profiles
12
12
 
13
13
  validates_numericality_of :valid_period_for_new_user,
14
- :greater_than_or_equal_to => 0,
14
+ greater_than_or_equal_to: 0,
15
15
  allow_blank: true
16
16
 
17
17
  paginates_per 10
@@ -1,6 +1,6 @@
1
1
  class UserHasRole < ActiveRecord::Base
2
- attr_accessible :user_id, :role_id
3
- attr_accessible :user_id, :role_id, as: :admin
2
+ attr_accessible :user_id, :role_id, :role
3
+ attr_accessible :user_id, :role_id, :role, as: :admin
4
4
  belongs_to :user
5
5
  belongs_to :role
6
6
  accepts_nested_attributes_for :role
@@ -4,18 +4,18 @@ class UserImportFile < ActiveRecord::Base
4
4
  include Statesman::Adapters::ActiveRecordModel
5
5
  include ImportFile
6
6
  default_scope {order('user_import_files.id DESC')}
7
- scope :not_imported, -> {in_state(:pending)}
8
- scope :stucked, -> {in_state(:pending).where('user_import_files.created_at < ?', 1.hour.ago)}
7
+ scope :not_imported, -> { in_state(:pending) }
8
+ scope :stucked, -> { in_state(:pending).where('user_import_files.created_at < ?', 1.hour.ago) }
9
9
 
10
10
  if Setting.uploaded_file.storage == :s3
11
- has_attached_file :user_import, :storage => :s3,
12
- :s3_credentials => "#{Setting.amazon}",
13
- :s3_permissions => :private
11
+ has_attached_file :user_import, storage: :s3,
12
+ s3_credentials: "#{Setting.amazon}",
13
+ s3_permissions: :private
14
14
  else
15
15
  has_attached_file :user_import,
16
16
  path: ":rails_root/private/system/:class/:attachment/:id_partition/:style/:filename"
17
17
  end
18
- validates_attachment_content_type :user_import, :content_type => [
18
+ validates_attachment_content_type :user_import, content_type: [
19
19
  'text/csv',
20
20
  'text/plain',
21
21
  'text/tab-separated-values',
@@ -34,7 +34,7 @@ class UserImportFile < ActiveRecord::Base
34
34
  attr_accessor :mode
35
35
 
36
36
  def state_machine
37
- @state_machine ||= UserImportFileStateMachine.new(self, transition_class: UserImportFileTransition)
37
+ UserImportFileStateMachine.new(self, transition_class: UserImportFileTransition)
38
38
  end
39
39
 
40
40
  delegate :can_transition_to?, :transition_to!, :transition_to, :current_state,
@@ -47,7 +47,7 @@ class UserImportFile < ActiveRecord::Base
47
47
  row_num = 1
48
48
 
49
49
  field = rows.first
50
- if [field['username']].reject{|f| f.to_s.strip == ""}.empty?
50
+ if [field['username']].reject{ |f| f.to_s.strip == "" }.empty?
51
51
  raise "username column is not found"
52
52
  end
53
53
 
@@ -55,11 +55,11 @@ class UserImportFile < ActiveRecord::Base
55
55
  row_num += 1
56
56
  next if row['dummy'].to_s.strip.present?
57
57
  import_result = UserImportResult.create!(
58
- :user_import_file_id => id, body: row.fields.join("\t")
58
+ user_import_file_id: id, body: row.fields.join("\t")
59
59
  )
60
60
 
61
61
  username = row['username']
62
- new_user = User.where(:username => username).first
62
+ new_user = User.where(username: username).first
63
63
  if new_user
64
64
  import_result.user = new_user
65
65
  import_result.save
@@ -103,6 +103,7 @@ class UserImportFile < ActiveRecord::Base
103
103
  num
104
104
  rescue => e
105
105
  self.error_message = "line #{row_num}: #{e.message}"
106
+ save
106
107
  transition_to!(:failed)
107
108
  raise e
108
109
  end
@@ -122,11 +123,11 @@ class UserImportFile < ActiveRecord::Base
122
123
  row_num += 1
123
124
  next if row['dummy'].to_s.strip.present?
124
125
  import_result = UserImportResult.create!(
125
- :user_import_file_id => id, body: row.fields.join("\t")
126
+ user_import_file_id: id, body: row.fields.join("\t")
126
127
  )
127
128
 
128
129
  username = row['username']
129
- new_user = User.where(:username => username).first
130
+ new_user = User.where(username: username).first
130
131
  if new_user
131
132
  new_user.assign_attributes(set_user_params(new_user, row), as: :admin)
132
133
  if new_user.save
@@ -147,6 +148,7 @@ class UserImportFile < ActiveRecord::Base
147
148
  num
148
149
  rescue => e
149
150
  self.error_message = "line #{row_num}: #{e.message}"
151
+ save
150
152
  transition_to!(:failed)
151
153
  raise e
152
154
  end
@@ -157,19 +159,20 @@ class UserImportFile < ActiveRecord::Base
157
159
  rows = open_import_file(create_import_temp_file(user_import))
158
160
 
159
161
  field = rows.first
160
- if [field['username']].reject{|field| field.to_s.strip == ""}.empty?
162
+ if [field['username']].reject{ |f| f.to_s.strip == "" }.empty?
161
163
  raise "username column is not found"
162
164
  end
163
165
 
164
166
  rows.each do |row|
165
167
  row_num += 1
166
168
  username = row['username'].to_s.strip
167
- user = User.where(:username => username).first
169
+ user = User.where(username: username).first
168
170
  user.destroy if user
169
171
  end
170
172
  transition_to!(:completed)
171
173
  rescue => e
172
174
  self.error_message = "line #{row_num}: #{e.message}"
175
+ save
173
176
  transition_to!(:failed)
174
177
  raise e
175
178
  end
@@ -202,7 +205,7 @@ class UserImportFile < ActiveRecord::Base
202
205
  save!
203
206
  end
204
207
  rows = CSV.open(tempfile.path, 'r:utf-8', headers: header, col_sep: "\t")
205
- UserImportResult.create!(:user_import_file_id => self.id, body: header.join("\t"))
208
+ UserImportResult.create!(user_import_file_id: id, body: header.join("\t"))
206
209
  tempfile.close(true)
207
210
  file.close
208
211
  rows
@@ -217,9 +220,8 @@ class UserImportFile < ActiveRecord::Base
217
220
  end
218
221
 
219
222
  private
220
- def set_user_params(new_user, row)
223
+ def set_user_params(_new_user, row)
221
224
  params = {}
222
- profile_params = {}
223
225
  params[:email] = row['email'] if row['email'].present?
224
226
 
225
227
  if row['password'].present?
@@ -1,8 +1,8 @@
1
1
  class UserImportResult < ActiveRecord::Base
2
2
  attr_accessible :user_import_file_id, :user_id, :body
3
- default_scope {order('user_import_results.id')}
4
- scope :file_id, proc{|file_id| where(:user_import_file_id => file_id)}
5
- scope :failed, -> {where(:user_id => nil)}
3
+ default_scope { order('user_import_results.id') }
4
+ scope :file_id, proc{ |file_id| where(user_import_file_id: file_id) }
5
+ scope :failed, -> { where(user_id: nil) }
6
6
 
7
7
  belongs_to :user_import_file
8
8
  belongs_to :user
@@ -2,3 +2,43 @@
2
2
  <%= stylesheet_link_tag 'print', media: :print %>
3
3
  <%= javascript_include_tag 'application' %>
4
4
  <%= csrf_meta_tag %>
5
+
6
+ <style>
7
+ <% @library_group.colors.each do |color| %>
8
+ .enju_<%= color.property %>{
9
+ <% case color.property %>
10
+ <% when 'header_title' %>
11
+ background-color: #<%= color.code %>;
12
+ color: white;
13
+ border: 1px solid #<%= color.code %>;
14
+ <% when 'table_line0' %>
15
+ background-color: #<%= color.code %>;
16
+ <% when 'table_line1' %>
17
+ background-color: #<%= color.code %>;
18
+ <% when 'table_border' %>
19
+ border: 1px solid #<%= color.code %>;
20
+ <% end %>
21
+ }
22
+ <% end %>
23
+ </style>
24
+
25
+ <script>
26
+ $(function(){
27
+ <% @library_group.colors.each do |color|
28
+ case color.property
29
+ when 'header_title' %>
30
+ $('.title').addClass('enju_<%= color.property %>');
31
+ $('div.digg_pagination>span.current').addClass('enju_<%= color.property %>');
32
+ <% when 'table_line0' %>
33
+ $('tr.line0').addClass('enju_<%= color.property %>');
34
+ <% when 'table_line1' %>
35
+ $('tr.line1').addClass('enju_<%= color.property %>');
36
+ <% when 'table_border' %>
37
+ $('tr>th').addClass('enju_<%= color.property %>');
38
+ $('tr>td').addClass('enju_<%= color.property %>');
39
+ $('div.digg_pagination>span.current').addClass('enju_<%= color.property %>');
40
+ $('div.digg_pagination>a').addClass('enju_<%= color.property %>');
41
+ <% end %>
42
+ <% end %>
43
+ });
44
+ </script>
@@ -44,9 +44,12 @@
44
44
  <li><%= link_to t('enju_loc.import_from_loc_search'), loc_search_index_path -%></li>
45
45
  <% end %>
46
46
  <li><%= link_to t('page.add_resource_manually'), new_manifestation_path -%></li>
47
- <li><%= link_to t('page.serial'), manifestations_path(periodical: true) -%></li>
47
+ <li><%= link_to t('page.serial'), manifestations_path(serial: true) -%></li>
48
48
  <li><%= link_to t('page.import_from_file'), new_resource_import_file_path -%></li>
49
49
  <li><%= link_to t('activerecord.models.accept'), new_accept_path -%></li>
50
+ <% if defined?(EnjuIr) %>
51
+ <li><%= link_to t('activemodel.models.resource'), resources_path -%></li>
52
+ <% end %>
50
53
  <% if defined?(EnjuBookmark) %>
51
54
  <li><%= link_to t('page.listing', model: t('activerecord.models.bookmark')), bookmarks_path -%></li>
52
55
  <% end %>
@@ -85,10 +88,10 @@
85
88
  <a href="#event_menu"><%= t('activerecord.models.event') -%></a>
86
89
  <ul>
87
90
  <%- unless @library_group.real_libraries.empty? -%>
88
- <li><%= link_to t('page.calendar'), calendar_path -%></li>
91
+ <li><%= link_to t('page.calendar'), events_path(mode: 'calendar') -%></li>
89
92
  <li><%= link_to t('event.all'), events_path -%></li>
90
93
  <%- @library_group.real_libraries.each do |library| -%>
91
- <li><%= link_to library.display_name.localize, library_events_path(library) -%></li>
94
+ <li><%= link_to library.display_name.localize, events_path(library_id: library.name) -%></li>
92
95
  <%- end -%>
93
96
  <%- if can? :create, Event -%>
94
97
  <li><%= link_to t('page.import'), new_event_import_file_path -%></li>
@@ -27,7 +27,7 @@
27
27
  <% if defined?(EnjuEvent) %>
28
28
  <li><%= link_to t('activerecord.models.event_category'), event_categories_path -%>
29
29
  <ul>
30
- <li><%= link_to t('page.new', model: t('activerecord.models.event_import_file')), new_event_import_file_path %></li>
30
+ <li><%= link_to t('activerecord.models.event_import_file'), event_import_files_path -%></li>
31
31
  </ul>
32
32
  </li>
33
33
  <% end %>
@@ -5,11 +5,11 @@ xml.OpenSearchDescription(
5
5
  xml.ShortName @library_group.display_name.localize
6
6
  xml.Description @library_group.display_name.localize
7
7
  xml.Tags 'Library Catalog'
8
- xml.Contact @library_group.email
9
- xml.Url type: 'text/html', template: "#{manifestations_url}?query={searchTerms}&pages={startPage?}"
10
- xml.Url type: 'application/rss+xml', template: "#{manifestations_url(format: :rss)}?query={searchTerms}&pages={startPage?}"
8
+ xml.Contact @library_group.user.email
9
+ xml.Url type: 'text/html', template: "#{manifestations_url}?query={searchTerms}"
10
+ xml.Url type: 'application/rss+xml', template: "#{manifestations_url(format: :rss)}?query={searchTerms}"
11
11
  xml.Query :role => 'example', :searchTerms => 'enju'
12
- xml.Language @locale
12
+ xml.Language @locale.to_s
13
13
  xml.OutputEncoding 'UTF-8'
14
14
  xml.InputEncoding 'UTF-8'
15
15
  xml.tag! 'moz:SearchForm', root_url
@@ -13,8 +13,8 @@
13
13
  <td></td>
14
14
  </tr>
15
15
  <tr>
16
- <td><%= link_to t('activerecord.models.user'), users_path -%></td>
17
- <td><%= User.count -%></td>
16
+ <td><%= link_to t('activerecord.models.profile'), profiles_path -%></td>
17
+ <td><%= Profile.count -%></td>
18
18
  <td></td>
19
19
  </tr>
20
20
  <tr>
@@ -14,7 +14,7 @@
14
14
  </p>
15
15
 
16
16
  <p>
17
- <b><%= t('activerecord.attributes.agent_import_result.body') %></b>
17
+ <b><%= t('activerecord.attributes.user_import_result.body') %></b>
18
18
  <%= @user_import_result.body %>
19
19
  </p>
20
20
 
@@ -143,7 +143,6 @@ en:
143
143
  publisher: "Publisher"
144
144
  feed: "Feed"
145
145
  back_to_index: "Back to index"
146
- import: "Import from file"
147
146
  start_import: "Start import"
148
147
  import_record: "Import records"
149
148
  export: "Export"
@@ -283,6 +282,7 @@ en:
283
282
  system: System
284
283
  manual: Manual
285
284
  cannot_parse_yaml_header: "has an invalid YAML header. You must add a space after the header's colon."
285
+ notice: Notice
286
286
  title:
287
287
  index: "index"
288
288
  show: "show"
@@ -317,6 +317,7 @@ en:
317
317
  auto_detect: "Auto detect"
318
318
  successfully_created: "%{model} was created successfully. When the task is completed, its status on the list will be updated to 'completed'."
319
319
  following_column_were_ignored: "The follwing column(s) were ignored: %{column}"
320
+ dummy: This row is treated as a dummy input.
320
321
  export:
321
322
  export_completed: Export completed.
322
323
  are_you_sure_to_export: It may take some time to complete. Are you sure to export?
@@ -134,7 +134,6 @@ ja:
134
134
  cancel: "取消"
135
135
  feed: "フィード"
136
136
  back_to_index: "一覧に戻る"
137
- import: "インポート"
138
137
  start_import: "インポートを開始"
139
138
  import_record: "書誌レコードのインポート"
140
139
  export: "エクスポート"
@@ -180,6 +179,7 @@ ja:
180
179
  checkout_history: "貸出履歴"
181
180
  recommendation: "おすすめの資料"
182
181
  add_resource_manually: "手動で資料を登録する"
182
+ import: "インポート"
183
183
  import_from_file: "TSVファイルからのインポート"
184
184
  import_from_network: "ネットワークからインポート"
185
185
  no_record_found: "資料が見つかりませんでした。"
@@ -267,6 +267,7 @@ ja:
267
267
  system: システム
268
268
  manual: マニュアル
269
269
  cannot_parse_yaml_header: "のYAMLヘッダを読み込めません。ヘッダのコロンの後には、半角スペースを含める必要があります。"
270
+ notice: 注意
270
271
  title:
271
272
  index: "一覧"
272
273
  show: "表示"
@@ -298,6 +299,7 @@ ja:
298
299
  auto_detect: "自動判別"
299
300
  successfully_created: "%{model}は正常に作成されました。インポートが完了すると「%{model}の一覧」の状態が「完了」となります。"
300
301
  following_column_were_ignored: "次の列は無視されました。 %{column}"
302
+ dummy: この行はダミー行になっています。
301
303
  export:
302
304
  export_completed: エクスポートが完了しました。
303
305
  are_you_sure_to_export: エクスポートに時間がかかることがあります。本当にエクスポートしますか?
@@ -7,7 +7,7 @@ module MasterModel
7
7
  validates_uniqueness_of :name, case_sensitive: false
8
8
  validates :name, presence: true
9
9
  validate :name do
10
- valid_format?
10
+ valid_name?
11
11
  end
12
12
  validate :display_name do
13
13
  valid_yaml?
@@ -24,8 +24,8 @@ module MasterModel
24
24
  end
25
25
 
26
26
  private
27
- def valid_format?
28
- unless name =~ /\A[A-Za-z][0-9A-Za-z_\s]*[0-9a-z]\Z/
27
+ def valid_name?
28
+ unless name =~ /\A[a-z][0-9a-z_]*[0-9a-z]\Z/
29
29
  errors.add(:name, I18n.t('page.only_lowercase_letters_and_numbers_are_allowed'))
30
30
  end
31
31
  end
@@ -21,9 +21,9 @@ module EnjuLeaf
21
21
  :profile_attributes,
22
22
  :as => :admin
23
23
 
24
- scope :administrators, where('roles.name = ?', 'Administrator').includes(:role)
25
- scope :librarians, where('roles.name = ? OR roles.name = ?', 'Administrator', 'Librarian').includes(:role)
26
- scope :suspended, where('locked_at IS NOT NULL')
24
+ scope :administrators, -> { joins(:role).where('roles.name = ?', 'Administrator') }
25
+ scope :librarians, -> { joins(:role).where('roles.name = ? OR roles.name = ?', 'Administrator', 'Librarian') }
26
+ scope :suspended, -> { where('locked_at IS NOT NULL') }
27
27
  has_one :profile, :dependent => :destroy
28
28
  if defined?(EnjuBiblio)
29
29
  has_many :import_requests
@@ -35,9 +35,10 @@ module EnjuLeaf
35
35
  belongs_to :library
36
36
  belongs_to :required_role, class_name: 'Role', foreign_key: 'required_role_id'
37
37
  accepts_nested_attributes_for :user_has_role
38
- accepts_nested_attributes_for :profile
39
38
 
40
- validates :username, :presence => true, :uniqueness => true, :format => {:with => /\A[0-9A-Za-z][0-9A-Za-z_\-]*[0-9A-Za-z]\Z/}
39
+ validates :username, presence: true, uniqueness: true, format: {
40
+ with: /\A[0-9A-Za-z][0-9A-Za-z_\-]*[0-9A-Za-z]\Z/
41
+ }
41
42
  validates :email, :format => Devise::email_regexp, :allow_blank => true, :uniqueness => true
42
43
  validates_date :expired_at, :allow_blank => true
43
44
 
@@ -1,3 +1,3 @@
1
1
  module EnjuLeaf
2
- VERSION = "1.1.0.rc14"
2
+ VERSION = "1.1.0.rc15"
3
3
  end