enju_library 0.1.2 → 0.2.0.beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +3 -3
  3. data/Rakefile +15 -8
  4. data/app/controllers/accepts_controller.rb +13 -3
  5. data/app/controllers/baskets_controller.rb +11 -1
  6. data/app/controllers/bookstores_controller.rb +12 -1
  7. data/app/controllers/budget_types_controller.rb +13 -2
  8. data/app/controllers/concerns/enju_library/controller.rb +43 -0
  9. data/app/controllers/libraries_controller.rb +13 -4
  10. data/app/controllers/library_groups_controller.rb +16 -6
  11. data/app/controllers/request_status_types_controller.rb +13 -2
  12. data/app/controllers/request_types_controller.rb +13 -2
  13. data/app/controllers/search_engines_controller.rb +13 -2
  14. data/app/controllers/shelves_controller.rb +14 -4
  15. data/app/controllers/subscribes_controller.rb +12 -2
  16. data/app/controllers/subscriptions_controller.rb +12 -3
  17. data/app/controllers/withdraws_controller.rb +14 -3
  18. data/app/helpers/shelves_helper.rb +2 -2
  19. data/app/models/accept.rb +2 -4
  20. data/app/models/basket.rb +0 -2
  21. data/app/models/budget_type.rb +0 -1
  22. data/app/models/concerns/enju_library/enju_item.rb +32 -0
  23. data/app/models/library_group.rb +9 -16
  24. data/app/models/request_status_type.rb +0 -1
  25. data/app/models/request_type.rb +0 -1
  26. data/app/models/search_engine.rb +0 -1
  27. data/app/models/withdraw.rb +8 -4
  28. data/app/policies/accept_policy.rb +21 -0
  29. data/app/policies/basket_policy.rb +21 -0
  30. data/app/policies/bookstore_policy.rb +23 -0
  31. data/app/policies/budget_type_policy.rb +21 -0
  32. data/app/policies/library_group_policy.rb +23 -0
  33. data/app/policies/library_policy.rb +25 -0
  34. data/app/policies/request_status_type_policy.rb +21 -0
  35. data/app/policies/request_type_policy.rb +21 -0
  36. data/app/policies/search_engine_policy.rb +21 -0
  37. data/app/policies/shelf_policy.rb +23 -0
  38. data/app/policies/subscribe_policy.rb +21 -0
  39. data/app/policies/subscription_policy.rb +21 -0
  40. data/app/policies/withdraw_policy.rb +21 -0
  41. data/app/views/accepts/index.html.erb +1 -1
  42. data/app/views/accepts/show.html.erb +1 -1
  43. data/app/views/baskets/edit.html.erb +1 -1
  44. data/app/views/baskets/new.html.erb +3 -1
  45. data/app/views/bookstores/index.html.erb +4 -4
  46. data/app/views/bookstores/show.html.erb +2 -2
  47. data/app/views/budget_types/index.html.erb +4 -4
  48. data/app/views/budget_types/show.html.erb +2 -2
  49. data/app/views/libraries/{_map.mobile.erb → _map.html+phone.erb} +0 -0
  50. data/app/views/libraries/index.html.erb +4 -4
  51. data/app/views/libraries/{show.mobile.erb → show.html+phone.erb} +0 -0
  52. data/app/views/libraries/show.html.erb +5 -5
  53. data/app/views/library_groups/_color_fields.html.erb +5 -0
  54. data/app/views/library_groups/_form.html.erb +17 -7
  55. data/app/views/library_groups/edit.html.erb +1 -1
  56. data/app/views/library_groups/index.html.erb +1 -1
  57. data/app/views/library_groups/show.html.erb +6 -2
  58. data/app/views/picture_files/_index_shelf.html.erb +4 -4
  59. data/app/views/request_status_types/index.html.erb +6 -4
  60. data/app/views/request_status_types/show.html.erb +1 -1
  61. data/app/views/request_types/index.html.erb +6 -4
  62. data/app/views/request_types/show.html.erb +1 -1
  63. data/app/views/search_engines/index.html.erb +4 -4
  64. data/app/views/search_engines/show.html.erb +2 -2
  65. data/app/views/shelves/_library_facet.html.erb +1 -1
  66. data/app/views/shelves/index.html.erb +4 -4
  67. data/app/views/shelves/{show.mobile.erb → show.html+phone.erb} +0 -0
  68. data/app/views/shelves/show.html.erb +3 -3
  69. data/app/views/subscriptions/index.html.erb +3 -1
  70. data/app/views/subscriptions/show.html.erb +1 -1
  71. data/app/views/withdraws/index.html.erb +1 -1
  72. data/app/views/withdraws/show.html.erb +1 -1
  73. data/config/locales/translation_en.yml +2 -1
  74. data/config/locales/translation_ja.yml +2 -1
  75. data/db/migrate/20151213070943_add_translation_table_to_library_group.rb +13 -0
  76. data/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +9 -0
  77. data/lib/enju_library/engine.rb +3 -0
  78. data/lib/enju_library/version.rb +1 -1
  79. data/lib/enju_library.rb +0 -41
  80. data/lib/generators/enju_library/setup/setup_generator.rb +2 -0
  81. data/lib/generators/enju_library/setup/templates/db/fixtures/library_group/translations.yml +10 -0
  82. data/lib/tasks/enju_library_tasks.rake +6 -2
  83. data/spec/controllers/accepts_controller_spec.rb +6 -6
  84. data/spec/controllers/baskets_controller_spec.rb +7 -7
  85. data/spec/controllers/bookstores_controller_spec.rb +11 -11
  86. data/spec/controllers/budget_types_controller_spec.rb +1 -1
  87. data/spec/controllers/libraries_controller_spec.rb +9 -9
  88. data/spec/controllers/library_groups_controller_spec.rb +3 -3
  89. data/spec/controllers/request_status_types_controller_spec.rb +16 -16
  90. data/spec/controllers/request_types_controller_spec.rb +16 -16
  91. data/spec/controllers/search_engines_controller_spec.rb +13 -13
  92. data/spec/controllers/shelves_controller_spec.rb +10 -9
  93. data/spec/controllers/subscribes_controller_spec.rb +8 -8
  94. data/spec/controllers/subscriptions_controller_spec.rb +8 -8
  95. data/spec/controllers/withdraws_controller_spec.rb +11 -3
  96. data/spec/dummy/app/controllers/application_controller.rb +6 -3
  97. data/spec/dummy/app/models/user.rb +2 -2
  98. data/spec/dummy/config/application.rb +8 -38
  99. data/spec/dummy/config/environments/development.rb +22 -18
  100. data/spec/dummy/config/environments/production.rb +46 -34
  101. data/spec/dummy/config/environments/test.rb +21 -14
  102. data/spec/dummy/config/initializers/enju_leaf.rb +6 -0
  103. data/spec/dummy/db/schema.rb +13 -1
  104. data/spec/models/withdraw_spec.rb +2 -0
  105. data/spec/spec_helper.rb +1 -1
  106. data/spec/views/accepts/index.html.erb_spec.rb +1 -0
  107. data/spec/views/budget_types/index.html.erb_spec.rb +1 -0
  108. data/spec/views/budget_types/show.html.erb_spec.rb +1 -0
  109. data/spec/views/libraries/show.html.erb_spec.rb +2 -1
  110. data/spec/views/library_groups/edit.html.erb_spec.rb +1 -0
  111. data/spec/views/library_groups/show.html.erb_spec.rb +2 -0
  112. data/spec/views/withdraws/index.html.erb_spec.rb +2 -0
  113. metadata +52 -105
  114. data/app/models/enju_library/ability.rb +0 -72
  115. data/lib/enju_library/item.rb +0 -39
  116. data/spec/dummy/app/models/ability.rb +0 -68
@@ -17,7 +17,7 @@
17
17
  <%- @picture_files.each do |picture_file| -%>
18
18
  <tr class="line<%= cycle("0", "1") -%>">
19
19
  <td>
20
- <%- if can? :update, picture_file -%>
20
+ <%- if policy(picture_file).update? -%>
21
21
  <%= move_position(picture_file) -%>
22
22
  <%- end -%>
23
23
  </td>
@@ -29,10 +29,10 @@
29
29
  <td><%= link_to picture_file.picture_file_name, picture_file_path(picture_file, format: :download, size: 'original') -%></td>
30
30
  <td>
31
31
  <%= link_to t('page.show'), picture_file -%>
32
- <%- if can? :update, picture_file -%>
32
+ <%- if policy(picture_file).update? -%>
33
33
  <%= link_to t('page.edit'), edit_picture_file_path(picture_file) -%>
34
34
  <% end %>
35
- <%- if can? :delete, picture_file -%>
35
+ <%- if policy(picture_file).destroy? -%>
36
36
  <%= link_to t('page.destroy'), picture_file, data: {confirm: t('page.are_you_sure')}, method: :delete -%>
37
37
  <%- end -%>
38
38
  </td>
@@ -45,7 +45,7 @@
45
45
  </div>
46
46
 
47
47
  <div id="submenu" class="ui-corner-all ui-widget-content">
48
- <%- if can? :create, PictureFile -%>
48
+ <%- if policy(PictureFile).create? -%>
49
49
  <ul>
50
50
  <li><%= link_to t('page.new', model: t('activerecord.models.picture_file')), new_picture_file_path(shelf_id: shelf.id) -%></li>
51
51
  <li><%= link_to t('picture_file.all_picture'), picture_files_path -%></li>
@@ -13,17 +13,17 @@
13
13
  <%- @request_status_types.each do |request_status_type| -%>
14
14
  <tr class="line<%= cycle("0", "1") -%>">
15
15
  <td>
16
- <%- if can? :update, request_status_type -%>
16
+ <%- if policy(request_status_type).update? -%>
17
17
  <%= move_position(request_status_type) -%>
18
18
  <%- end -%>
19
19
  </td>
20
20
  <td><%= link_to request_status_type.name, request_status_type -%></td>
21
21
  <td><%= link_to request_status_type.display_name.localize, request_status_type -%></td>
22
22
  <td>
23
- <%- if can? :update, request_status_type -%>
23
+ <%- if policy(request_status_type).update? -%>
24
24
  <%= link_to t('page.edit'), edit_request_status_type_path(request_status_type) -%>
25
25
  <% end %>
26
- <%- if can? :delete, request_status_type -%>
26
+ <%- if policy(request_status_type).destroy? -%>
27
27
  <%= link_to t('page.destroy'), request_status_type, data: {confirm: t('page.are_you_sure')}, method: :delete -%>
28
28
  <% end %>
29
29
  </td>
@@ -35,6 +35,8 @@
35
35
 
36
36
  <div id="submenu" class="ui-corner-all ui-widget-content">
37
37
  <ul>
38
- <li><%= link_to t('page.new', model: t('activerecord.models.request_status_type')), new_request_status_type_path -%></li>
38
+ <% policy(RequestStatusType).create? %>
39
+ <li><%= link_to t('page.new', model: t('activerecord.models.request_status_type')), new_request_status_type_path -%></li>
40
+ <% end %>
39
41
  </ul>
40
42
  </div>
@@ -24,6 +24,6 @@
24
24
  <div id="submenu" class="ui-corner-all ui-widget-content">
25
25
  <ul>
26
26
  <li><%= link_to t('page.edit'), edit_request_status_type_path(@request_status_type) -%></li>
27
- <li><%= back_to_index(flash[:page_info]) -%></li>
27
+ <li><%= link_to t('page.back'), :back -%></li>
28
28
  </ul>
29
29
  </div>
@@ -13,17 +13,17 @@
13
13
  <%- @request_types.each do |request_type| -%>
14
14
  <tr class="line<%= cycle("0", "1") -%>">
15
15
  <td>
16
- <%- if can? :update, request_type -%>
16
+ <%- if policy(request_type).update? -%>
17
17
  <%= move_position(request_type) -%>
18
18
  <%- end -%>
19
19
  </td>
20
20
  <td><%= link_to request_type.name, request_type -%></td>
21
21
  <td><%= link_to request_type.display_name.localize, request_type -%></td>
22
22
  <td>
23
- <%- if can? :update, request_type -%>
23
+ <%- if policy(request_type).update? -%>
24
24
  <%= link_to t('page.edit'), edit_request_type_path(request_type) -%>
25
25
  <% end %>
26
- <%- if can? :delete, request_type -%>
26
+ <%- if policy(request_type).destroy? -%>
27
27
  <%= link_to t('page.destroy'), request_type, data: {confirm: t('page.are_you_sure')}, method: :delete -%>
28
28
  <% end %>
29
29
  </td>
@@ -35,6 +35,8 @@
35
35
 
36
36
  <div id="submenu" class="ui-corner-all ui-widget-content">
37
37
  <ul>
38
- <li><%= link_to t('page.new', model: t('activerecord.models.request_type')), new_request_type_path -%></li>
38
+ <% policy(RequestStatusType).create? %>
39
+ <li><%= link_to t('page.new', model: t('activerecord.models.request_type')), new_request_type_path -%></li>
40
+ <% end %>
39
41
  </ul>
40
42
  </div>
@@ -24,6 +24,6 @@
24
24
  <div id="submenu" class="ui-corner-all ui-widget-content">
25
25
  <ul>
26
26
  <li><%= link_to t('page.edit'), edit_request_type_path(@request_type) -%></li>
27
- <li><%= back_to_index(flash[:page_info]) -%></li>
27
+ <li><%= link_to t('page.back'), :back -%></li>
28
28
  </ul>
29
29
  </div>
@@ -14,7 +14,7 @@
14
14
  <%- @search_engines.each do |search_engine| -%>
15
15
  <tr class="line<%= cycle("0", "1") -%>">
16
16
  <td>
17
- <%- if can? :update, search_engine -%>
17
+ <%- if policy(search_engine).update? -%>
18
18
  <%= move_position(search_engine) -%>
19
19
  <%- end -%>
20
20
  </td>
@@ -22,10 +22,10 @@
22
22
  <td><%= search_engine.note -%></td>
23
23
  <td><%= link_to t('page.show'), search_engine -%></td>
24
24
  <td>
25
- <%- if can? :update, search_engine -%>
25
+ <%- if policy(search_engine).update? -%>
26
26
  <%= link_to t('page.edit'), edit_search_engine_path(search_engine) -%>
27
27
  <% end %>
28
- <%- if can? :delete, search_engine -%>
28
+ <%- if policy(search_engine).destroy? -%>
29
29
  <%= link_to t('page.destroy'), search_engine, data: {confirm: t('page.are_you_sure')}, method: :delete -%>
30
30
  <%- end -%>
31
31
  </td>
@@ -38,7 +38,7 @@
38
38
 
39
39
  <div id="submenu" class="ui-corner-all ui-widget-content">
40
40
  <ul>
41
- <%- if can? :create, SearchEngine -%>
41
+ <%- if policy(SearchEngine).create? -%>
42
42
  <li><%= link_to t('page.new', model: t('activerecord.models.search_engine')), new_search_engine_path -%></li>
43
43
  <%- end -%>
44
44
  </ul>
@@ -43,9 +43,9 @@
43
43
 
44
44
  <div id="submenu" class="ui-corner-all ui-widget-content">
45
45
  <ul>
46
- <%- if can? :update, @search_engine -%>
46
+ <%- if policy(@search_engine).update? -%>
47
47
  <li><%= link_to t('page.edit'), edit_search_engine_path(@search_engine) -%></li>
48
48
  <%- end -%>
49
- <li><%= back_to_index(flash[:page_info]) -%></li>
49
+ <li><%= link_to t('page.back'), :back -%></li>
50
50
  </ul>
51
51
  </div>
@@ -4,6 +4,6 @@
4
4
  <%= library_shelf_facet(@library, facet) %>
5
5
  <%- end -%>
6
6
  <%- if params[:library_id] -%>
7
- <li><%= link_to t('page.remove_this_facet'), url_for(params.merge(library_id: nil, page: nil, only_path: true)) -%></li>
7
+ <li><%= link_to t('page.remove_this_facet'), url_for(params.permit.merge(library_id: nil, page: nil, only_path: true)) -%></li>
8
8
  <%- end -%>
9
9
  </ul>
@@ -29,7 +29,7 @@
29
29
  <tr class="line<%= cycle("0", "1") -%>">
30
30
  <td>
31
31
  <% if @library and params[:query].blank? and params[:order].blank? %>
32
- <%- if can? :update, shelf -%>
32
+ <%- if policy(shelf).update? -%>
33
33
  <%= move_position(shelf) -%>
34
34
  <%- end -%>
35
35
  <% end %>
@@ -48,10 +48,10 @@
48
48
  <%= shelf.library.name if current_user.try(:has_role?, 'Librarian') %>
49
49
  </td>
50
50
  <td>
51
- <%- if can? :update, shelf -%>
51
+ <%- if policy(shelf).update? -%>
52
52
  <%= link_to t('page.edit'), edit_shelf_path(shelf) -%>
53
53
  <% end %>
54
- <%- if can? :delete, shelf -%>
54
+ <%- if policy(shelf).destroy? -%>
55
55
  <%= link_to t('page.destroy'), shelf, data: {confirm: t('page.are_you_sure')}, method: :delete -%>
56
56
  <%- end -%>
57
57
  </td>
@@ -66,7 +66,7 @@
66
66
  <div id="submenu" class="ui-corner-all ui-widget-content">
67
67
  <%= render 'library_facet' %>
68
68
  <ul>
69
- <%- if can? :create, Shelf -%>
69
+ <%- if policy(Shelf).create? -%>
70
70
  <li><%= link_to t('page.new', model: t('activerecord.models.shelf')), new_shelf_path -%></li>
71
71
  <%- end -%>
72
72
  </ul>
@@ -47,19 +47,19 @@
47
47
 
48
48
  <div id="submenu" class="ui-corner-all ui-widget-content">
49
49
  <ul>
50
- <% if can? :create, Shelf %>
50
+ <% if policy(Shelf).create? %>
51
51
  <%- if @library -%>
52
52
  <li><%= link_to t('page.new', model: t('activerecord.models.shelf')), new_shelf_path(library_id: @library.id) -%></li>
53
53
  <%- else -%>
54
54
  <li><%= link_to t('page.new', model: t('activerecord.models.shelf')), new_shelf_path -%></li>
55
55
  <%- end -%>
56
56
  <% end %>
57
- <% if can? :update, @shelf %>
57
+ <% if policy(@shelf).update? %>
58
58
  <li><%= link_to t('page.edit'), edit_shelf_path(@shelf) -%></li>
59
59
  <li><%= link_to t('page.listing', model: t('activerecord.models.picture_file')), picture_files_path(shelf_id: @shelf.id) -%></li>
60
60
  <% end %>
61
61
  <li>
62
- <%= back_to_index(flash[:page_info]) -%>
62
+ <%= link_to t('page.back'), :back -%>
63
63
  </li>
64
64
  </ul>
65
65
  </div>
@@ -14,8 +14,10 @@
14
14
  <td><%= link_to subscription.title, subscription -%></td>
15
15
  <td><%= subscription.works.size -%></td>
16
16
  <td>
17
- <% if can? :delete, subscription %>
17
+ <% if policy(subscription).update? %>
18
18
  <%= link_to t('page.edit'), edit_subscription_path(subscription) -%>
19
+ <% end %>
20
+ <% if policy(subscription).destroy? %>
19
21
  <%= link_to t('page.destroy'), subscription, data: {confirm: t('page.are_you_sure')}, method: :delete -%>
20
22
  <% end %>
21
23
  </td>
@@ -35,6 +35,6 @@
35
35
  <ul>
36
36
  <li><%= link_to t('page.edit'), edit_subscription_path(@subscription) -%></li>
37
37
  <li><%= link_to t('work.add'), subscription_manifestations_path(@subscription) -%></li>
38
- <li><%= back_to_index(flash[:page_info]) -%></li>
38
+ <li><%= link_to t('page.back'), :back -%></li>
39
39
  </ul>
40
40
  </div>
@@ -29,7 +29,7 @@
29
29
  <% end %>
30
30
  </td>
31
31
  <td>
32
- <%- if can? :delete, withdraw -%>
32
+ <%- if policy(withdraw).destroy? -%>
33
33
  <%= link_to t('page.destroy'), withdraw, data: {confirm: t('page.are_you_sure')}, method: :delete -%>
34
34
  <%- end -%>
35
35
  </td>
@@ -26,6 +26,6 @@
26
26
 
27
27
  <div id="submenu" class="ui-corner-all ui-widget-content">
28
28
  <ul>
29
- <li><%= back_to_index(flash[:page_info]) -%></li>
29
+ <li><%= link_to t('page.back'), :back -%></li>
30
30
  </ul>
31
31
  </div>
@@ -2,7 +2,7 @@ en:
2
2
  activerecord:
3
3
  models:
4
4
  library: Library
5
- library_group: Library Group
5
+ library_group: System configuration
6
6
  shelf: Shelf
7
7
  accept: Accept
8
8
  budget_type: Budget type
@@ -52,6 +52,7 @@ en:
52
52
  admin_networks: Admin networks
53
53
  note: Note
54
54
  login_banner: Login banner
55
+ footer_banner: Footer banner
55
56
  post_to_union_catalog: Post to union catalog
56
57
  url: URL
57
58
  color: Color
@@ -2,7 +2,7 @@ ja:
2
2
  activerecord:
3
3
  models:
4
4
  library: 図書館
5
- library_group: 図書館全体の設定
5
+ library_group: システム全体の設定
6
6
  shelf: 本棚
7
7
  accept: 検収
8
8
  budget_type: 予算種別
@@ -52,6 +52,7 @@ ja:
52
52
  admin_networks: 管理用として扱うネットワーク
53
53
  note: 注記
54
54
  login_banner: ログイン画面でのメッセージ
55
+ footer_banner: フッターのメッセージ
55
56
  post_to_union_catalog: 総合目録に登録する
56
57
  url: URL
57
58
  color: 色
@@ -0,0 +1,13 @@
1
+ class AddTranslationTableToLibraryGroup < ActiveRecord::Migration
2
+ def up
3
+ LibraryGroup.create_translation_table!({
4
+ login_banner: :text
5
+ }, {
6
+ migrate_data: true
7
+ })
8
+ end
9
+
10
+ def down
11
+ LibraryGroup.drop_translation_table! migrate_data: true
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ class AddFooterBannerToLibraryGroup < ActiveRecord::Migration
2
+ def up
3
+ LibraryGroup.add_translation_fields! footer_banner: :text
4
+ end
5
+
6
+ def down
7
+ remove_column :library_group_translations, :footer_banner
8
+ end
9
+ end
@@ -1,4 +1,7 @@
1
+ require 'enju_biblio'
1
2
  require 'geocoder'
3
+ require 'globalize'
4
+ require 'globalize-accessors'
2
5
  require 'ipaddr'
3
6
 
4
7
  module EnjuLibrary
@@ -1,3 +1,3 @@
1
1
  module EnjuLibrary
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0.beta.1"
3
3
  end
data/lib/enju_library.rb CHANGED
@@ -1,45 +1,4 @@
1
1
  require "enju_library/engine"
2
- require "enju_library/item"
3
2
 
4
3
  module EnjuLibrary
5
- def self.included(base)
6
- base.extend(ClassMethods)
7
- end
8
-
9
- module ClassMethods
10
- def enju_library
11
- include EnjuLibrary::InstanceMethods
12
- end
13
- end
14
-
15
- module InstanceMethods
16
- private
17
-
18
- def get_library_group
19
- @library_group = LibraryGroup.site_config
20
- end
21
-
22
- def get_shelf
23
- @shelf = Shelf.includes(:library).find(params[:shelf_id]) if params[:shelf_id]
24
- end
25
-
26
- def get_library
27
- @library = Library.find(params[:library_id]) if params[:library_id]
28
- end
29
-
30
- def get_libraries
31
- @libraries = Library.all_cache
32
- end
33
-
34
- def get_bookstore
35
- @bookstore = Bookstore.find(params[:bookstore_id]) if params[:bookstore_id]
36
- end
37
-
38
- def get_subscription
39
- @subscription = Subscription.find(params[:subscription_id]) if params[:subscription_id]
40
- end
41
- end
42
4
  end
43
-
44
- ActiveRecord::Base.send :include, EnjuLibrary::LibraryItem
45
- ActionController::Base.send(:include, EnjuLibrary)
@@ -5,5 +5,7 @@ class EnjuLibrary::SetupGenerator < Rails::Generators::Base
5
5
  def copy_setup_files
6
6
  directory("db/fixtures", "db/fixtures/enju_library")
7
7
  return if file == 'fixture'
8
+ inject_into_file 'app/controllers/application_controller.rb',
9
+ " include EnjuLibrary::Controller\n", after: "include EnjuLeaf::Controller\n"
8
10
  end
9
11
  end
@@ -0,0 +1,10 @@
1
+ library_group_00001_translations_ja:
2
+ locale: ja
3
+ footer_banner: "[Next-L Enju Leaf __VERSION__](https://github.com/next-l/enju_leaf), オープンソース統合図書館システム | [このシステムについて](/page/about) | [不具合を報告する](https://github.com/next-l/enju_leaf/issues) | [マニュアル](http://next-l.github.io/manual/1.2/)<br/>\r\n\
4
+ Developed by [Kosuke Tanabe](https://github.com/nabeta) and [Project Next-L](http://next-l.jp)."
5
+ library_group_id: 1
6
+ library_group_00001_translations_en:
7
+ locale: en
8
+ footer_banner: "[Next-L Enju Leaf __VERSION__](https://github.com/next-l/enju_leaf), an open source integrated library system | [About this system](/page/about) | [Report bugs](https://github.com/next-l/enju_leaf/issues) | [Manual](http://next-l.github.io/manual/1.2/)<br/>\r\n\
9
+ Developed by [Kosuke Tanabe](https://github.com/nabeta) and [Project Next-L](http://next-l.jp)."
10
+ library_group_id: 1
@@ -4,8 +4,12 @@ require 'tasks/color'
4
4
  desc "create initial records for enju_library"
5
5
  namespace :enju_library do
6
6
  task :setup => :environment do
7
- Dir.glob(Rails.root.to_s + '/db/fixtures/enju_library/*.yml').each do |file|
8
- ActiveRecord::Fixtures.create_fixtures('db/fixtures/enju_library', File.basename(file, '.*'))
7
+ Dir.glob(Rails.root.to_s + '/db/fixtures/enju_library/**/*.yml').each do |file|
8
+ dirname = File.basename(File.dirname file)
9
+ dirname = nil if dirname == "enju_library"
10
+ basename = [ dirname, File.basename(file, ".*") ].compact
11
+ basename = File.join(*basename)
12
+ ActiveRecord::FixtureSet.create_fixtures('db/fixtures/enju_library', basename)
9
13
  end
10
14
  end
11
15
 
@@ -123,7 +123,7 @@ describe AcceptsController do
123
123
 
124
124
  it "should not assign the requested accept as @accept" do
125
125
  get :new
126
- assigns(:accept).should_not be_valid
126
+ assigns(:accept).should be_nil
127
127
  response.should be_forbidden
128
128
  end
129
129
  end
@@ -131,7 +131,7 @@ describe AcceptsController do
131
131
  describe "When not logged in" do
132
132
  it "should not assign the requested accept as @accept" do
133
133
  get :new
134
- assigns(:accept).should_not be_valid
134
+ assigns(:accept).should be_nil
135
135
  response.should redirect_to(new_user_session_url)
136
136
  end
137
137
  end
@@ -149,7 +149,7 @@ describe AcceptsController do
149
149
  describe "with valid params" do
150
150
  it "assigns a newly created accept as @accept" do
151
151
  post :create, :accept => @attrs
152
- assigns(:accept).should_not be_valid
152
+ assigns(:accept).should be_nil
153
153
  end
154
154
 
155
155
  it "should not create a new accept without basket_id" do
@@ -169,7 +169,7 @@ describe AcceptsController do
169
169
  describe "with invalid params" do
170
170
  it "assigns a newly created but unsaved accept as @accept" do
171
171
  post :create, :accept => @invalid_attrs
172
- assigns(:accept).should_not be_valid
172
+ assigns(:accept).should be_nil
173
173
  end
174
174
 
175
175
  it "should be forbidden" do
@@ -191,7 +191,7 @@ describe AcceptsController do
191
191
  describe "with valid params" do
192
192
  it "assigns a newly created accept as @accept" do
193
193
  post :create, :accept => @attrs
194
- assigns(:accept).should_not be_valid
194
+ assigns(:accept).should be_nil
195
195
  end
196
196
 
197
197
  it "should not create a new accept without basket_id" do
@@ -207,7 +207,7 @@ describe AcceptsController do
207
207
  describe "with valid params" do
208
208
  it "assigns a newly created accept as @accept" do
209
209
  post :create, :accept => @attrs
210
- assigns(:accept).should_not be_valid
210
+ assigns(:accept).should be_nil
211
211
  end
212
212
 
213
213
  it "should be forbidden" do
@@ -34,7 +34,7 @@ describe BasketsController do
34
34
 
35
35
  it "assigns all baskets as @baskets" do
36
36
  get :index, :user_id => users(:user1).username
37
- assigns(:baskets).should be_empty
37
+ assigns(:baskets).should be_nil
38
38
  response.should be_forbidden
39
39
  end
40
40
  end
@@ -42,7 +42,7 @@ describe BasketsController do
42
42
  describe "When not logged in" do
43
43
  it "assigns all baskets as @baskets" do
44
44
  get :index, :user_id => users(:user1).username
45
- assigns(:baskets).should be_empty
45
+ assigns(:baskets).should be_nil
46
46
  response.should redirect_to(new_user_session_url)
47
47
  end
48
48
  end
@@ -110,7 +110,7 @@ describe BasketsController do
110
110
 
111
111
  it "should not assign the requested basket as @basket" do
112
112
  get :new
113
- assigns(:basket).should_not be_valid
113
+ assigns(:basket).should be_nil
114
114
  response.should be_forbidden
115
115
  end
116
116
  end
@@ -118,7 +118,7 @@ describe BasketsController do
118
118
  describe "When not logged in" do
119
119
  it "should not assign the requested basket as @basket" do
120
120
  get :new
121
- assigns(:basket).should_not be_valid
121
+ assigns(:basket).should be_nil
122
122
  response.should redirect_to(new_user_session_url)
123
123
  end
124
124
  end
@@ -269,7 +269,7 @@ describe BasketsController do
269
269
  describe "with valid params" do
270
270
  it "assigns a newly created basket as @basket" do
271
271
  post :create, :basket => {:user_number => users(:user1).profile.user_number }
272
- assigns(:basket).should_not be_valid
272
+ assigns(:basket).should be_nil
273
273
  end
274
274
 
275
275
  it "should be forbidden" do
@@ -288,12 +288,12 @@ describe BasketsController do
288
288
  describe "with blank params" do
289
289
  it "assigns a newly created basket as @basket" do
290
290
  post :create, :basket => { note: 'test' }
291
- assigns(:basket).should_not be_valid
291
+ assigns(:basket).should be_nil
292
292
  end
293
293
 
294
294
  it "should be redirected to new_user_session_url" do
295
295
  post :create, :basket => { note: 'test' }
296
- assigns(:basket).should_not be_valid
296
+ assigns(:basket).should be_nil
297
297
  assert_response :redirect
298
298
  response.should redirect_to new_user_session_url
299
299
  end
@@ -37,7 +37,7 @@ describe BookstoresController do
37
37
 
38
38
  it "assigns all bookstores as @bookstores" do
39
39
  get :index
40
- assigns(:bookstores).should be_empty
40
+ assigns(:bookstores).should be_nil
41
41
  response.should be_forbidden
42
42
  end
43
43
  end
@@ -45,7 +45,7 @@ describe BookstoresController do
45
45
  describe "When not logged in" do
46
46
  it "assigns all bookstores as @bookstores" do
47
47
  get :index
48
- assigns(:bookstores).should be_empty
48
+ assigns(:bookstores).should be_nil
49
49
  response.should redirect_to(new_user_session_url)
50
50
  end
51
51
  end
@@ -107,7 +107,7 @@ describe BookstoresController do
107
107
 
108
108
  it "should not assign the requested bookstore as @bookstore" do
109
109
  get :new
110
- assigns(:bookstore).should_not be_valid
110
+ assigns(:bookstore).should be_nil
111
111
  response.should be_forbidden
112
112
  end
113
113
  end
@@ -117,7 +117,7 @@ describe BookstoresController do
117
117
 
118
118
  it "should not assign the requested bookstore as @bookstore" do
119
119
  get :new
120
- assigns(:bookstore).should_not be_valid
120
+ assigns(:bookstore).should be_nil
121
121
  response.should be_forbidden
122
122
  end
123
123
  end
@@ -125,7 +125,7 @@ describe BookstoresController do
125
125
  describe "When not logged in" do
126
126
  it "should not assign the requested bookstore as @bookstore" do
127
127
  get :new
128
- assigns(:bookstore).should_not be_valid
128
+ assigns(:bookstore).should be_nil
129
129
  response.should redirect_to(new_user_session_url)
130
130
  end
131
131
  end
@@ -211,7 +211,7 @@ describe BookstoresController do
211
211
  describe "with valid params" do
212
212
  it "assigns a newly created bookstore as @bookstore" do
213
213
  post :create, :bookstore => @attrs
214
- assigns(:bookstore).should be_valid
214
+ assigns(:bookstore).should be_nil
215
215
  end
216
216
 
217
217
  it "should be forbidden" do
@@ -223,7 +223,7 @@ describe BookstoresController do
223
223
  describe "with invalid params" do
224
224
  it "assigns a newly created but unsaved bookstore as @bookstore" do
225
225
  post :create, :bookstore => @invalid_attrs
226
- assigns(:bookstore).should_not be_valid
226
+ assigns(:bookstore).should be_nil
227
227
  end
228
228
 
229
229
  it "should be forbidden" do
@@ -239,7 +239,7 @@ describe BookstoresController do
239
239
  describe "with valid params" do
240
240
  it "assigns a newly created bookstore as @bookstore" do
241
241
  post :create, :bookstore => @attrs
242
- assigns(:bookstore).should be_valid
242
+ assigns(:bookstore).should be_nil
243
243
  end
244
244
 
245
245
  it "should be forbidden" do
@@ -251,7 +251,7 @@ describe BookstoresController do
251
251
  describe "with invalid params" do
252
252
  it "assigns a newly created but unsaved bookstore as @bookstore" do
253
253
  post :create, :bookstore => @invalid_attrs
254
- assigns(:bookstore).should_not be_valid
254
+ assigns(:bookstore).should be_nil
255
255
  end
256
256
 
257
257
  it "should be forbidden" do
@@ -265,7 +265,7 @@ describe BookstoresController do
265
265
  describe "with valid params" do
266
266
  it "assigns a newly created bookstore as @bookstore" do
267
267
  post :create, :bookstore => @attrs
268
- assigns(:bookstore).should be_valid
268
+ assigns(:bookstore).should be_nil
269
269
  end
270
270
 
271
271
  it "should be forbidden" do
@@ -277,7 +277,7 @@ describe BookstoresController do
277
277
  describe "with invalid params" do
278
278
  it "assigns a newly created but unsaved bookstore as @bookstore" do
279
279
  post :create, :bookstore => @invalid_attrs
280
- assigns(:bookstore).should_not be_valid
280
+ assigns(:bookstore).should be_nil
281
281
  end
282
282
 
283
283
  it "should be forbidden" do
@@ -33,7 +33,7 @@ describe BudgetTypesController do
33
33
  it "assigns all budget_types as @budget_types" do
34
34
  budget_type = BudgetType.create! valid_attributes
35
35
  get :index
36
- assigns(:budget_types).should eq(BudgetType.all)
36
+ assigns(:budget_types).should eq(BudgetType.order(:position))
37
37
  end
38
38
  end
39
39