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.
- checksums.yaml +4 -4
- data/README.rdoc +3 -3
- data/Rakefile +15 -8
- data/app/controllers/accepts_controller.rb +13 -3
- data/app/controllers/baskets_controller.rb +11 -1
- data/app/controllers/bookstores_controller.rb +12 -1
- data/app/controllers/budget_types_controller.rb +13 -2
- data/app/controllers/concerns/enju_library/controller.rb +43 -0
- data/app/controllers/libraries_controller.rb +13 -4
- data/app/controllers/library_groups_controller.rb +16 -6
- data/app/controllers/request_status_types_controller.rb +13 -2
- data/app/controllers/request_types_controller.rb +13 -2
- data/app/controllers/search_engines_controller.rb +13 -2
- data/app/controllers/shelves_controller.rb +14 -4
- data/app/controllers/subscribes_controller.rb +12 -2
- data/app/controllers/subscriptions_controller.rb +12 -3
- data/app/controllers/withdraws_controller.rb +14 -3
- data/app/helpers/shelves_helper.rb +2 -2
- data/app/models/accept.rb +2 -4
- data/app/models/basket.rb +0 -2
- data/app/models/budget_type.rb +0 -1
- data/app/models/concerns/enju_library/enju_item.rb +32 -0
- data/app/models/library_group.rb +9 -16
- data/app/models/request_status_type.rb +0 -1
- data/app/models/request_type.rb +0 -1
- data/app/models/search_engine.rb +0 -1
- data/app/models/withdraw.rb +8 -4
- data/app/policies/accept_policy.rb +21 -0
- data/app/policies/basket_policy.rb +21 -0
- data/app/policies/bookstore_policy.rb +23 -0
- data/app/policies/budget_type_policy.rb +21 -0
- data/app/policies/library_group_policy.rb +23 -0
- data/app/policies/library_policy.rb +25 -0
- data/app/policies/request_status_type_policy.rb +21 -0
- data/app/policies/request_type_policy.rb +21 -0
- data/app/policies/search_engine_policy.rb +21 -0
- data/app/policies/shelf_policy.rb +23 -0
- data/app/policies/subscribe_policy.rb +21 -0
- data/app/policies/subscription_policy.rb +21 -0
- data/app/policies/withdraw_policy.rb +21 -0
- data/app/views/accepts/index.html.erb +1 -1
- data/app/views/accepts/show.html.erb +1 -1
- data/app/views/baskets/edit.html.erb +1 -1
- data/app/views/baskets/new.html.erb +3 -1
- data/app/views/bookstores/index.html.erb +4 -4
- data/app/views/bookstores/show.html.erb +2 -2
- data/app/views/budget_types/index.html.erb +4 -4
- data/app/views/budget_types/show.html.erb +2 -2
- data/app/views/libraries/{_map.mobile.erb → _map.html+phone.erb} +0 -0
- data/app/views/libraries/index.html.erb +4 -4
- data/app/views/libraries/{show.mobile.erb → show.html+phone.erb} +0 -0
- data/app/views/libraries/show.html.erb +5 -5
- data/app/views/library_groups/_color_fields.html.erb +5 -0
- data/app/views/library_groups/_form.html.erb +17 -7
- data/app/views/library_groups/edit.html.erb +1 -1
- data/app/views/library_groups/index.html.erb +1 -1
- data/app/views/library_groups/show.html.erb +6 -2
- data/app/views/picture_files/_index_shelf.html.erb +4 -4
- data/app/views/request_status_types/index.html.erb +6 -4
- data/app/views/request_status_types/show.html.erb +1 -1
- data/app/views/request_types/index.html.erb +6 -4
- data/app/views/request_types/show.html.erb +1 -1
- data/app/views/search_engines/index.html.erb +4 -4
- data/app/views/search_engines/show.html.erb +2 -2
- data/app/views/shelves/_library_facet.html.erb +1 -1
- data/app/views/shelves/index.html.erb +4 -4
- data/app/views/shelves/{show.mobile.erb → show.html+phone.erb} +0 -0
- data/app/views/shelves/show.html.erb +3 -3
- data/app/views/subscriptions/index.html.erb +3 -1
- data/app/views/subscriptions/show.html.erb +1 -1
- data/app/views/withdraws/index.html.erb +1 -1
- data/app/views/withdraws/show.html.erb +1 -1
- data/config/locales/translation_en.yml +2 -1
- data/config/locales/translation_ja.yml +2 -1
- data/db/migrate/20151213070943_add_translation_table_to_library_group.rb +13 -0
- data/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +9 -0
- data/lib/enju_library/engine.rb +3 -0
- data/lib/enju_library/version.rb +1 -1
- data/lib/enju_library.rb +0 -41
- data/lib/generators/enju_library/setup/setup_generator.rb +2 -0
- data/lib/generators/enju_library/setup/templates/db/fixtures/library_group/translations.yml +10 -0
- data/lib/tasks/enju_library_tasks.rake +6 -2
- data/spec/controllers/accepts_controller_spec.rb +6 -6
- data/spec/controllers/baskets_controller_spec.rb +7 -7
- data/spec/controllers/bookstores_controller_spec.rb +11 -11
- data/spec/controllers/budget_types_controller_spec.rb +1 -1
- data/spec/controllers/libraries_controller_spec.rb +9 -9
- data/spec/controllers/library_groups_controller_spec.rb +3 -3
- data/spec/controllers/request_status_types_controller_spec.rb +16 -16
- data/spec/controllers/request_types_controller_spec.rb +16 -16
- data/spec/controllers/search_engines_controller_spec.rb +13 -13
- data/spec/controllers/shelves_controller_spec.rb +10 -9
- data/spec/controllers/subscribes_controller_spec.rb +8 -8
- data/spec/controllers/subscriptions_controller_spec.rb +8 -8
- data/spec/controllers/withdraws_controller_spec.rb +11 -3
- data/spec/dummy/app/controllers/application_controller.rb +6 -3
- data/spec/dummy/app/models/user.rb +2 -2
- data/spec/dummy/config/application.rb +8 -38
- data/spec/dummy/config/environments/development.rb +22 -18
- data/spec/dummy/config/environments/production.rb +46 -34
- data/spec/dummy/config/environments/test.rb +21 -14
- data/spec/dummy/config/initializers/enju_leaf.rb +6 -0
- data/spec/dummy/db/schema.rb +13 -1
- data/spec/models/withdraw_spec.rb +2 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/views/accepts/index.html.erb_spec.rb +1 -0
- data/spec/views/budget_types/index.html.erb_spec.rb +1 -0
- data/spec/views/budget_types/show.html.erb_spec.rb +1 -0
- data/spec/views/libraries/show.html.erb_spec.rb +2 -1
- data/spec/views/library_groups/edit.html.erb_spec.rb +1 -0
- data/spec/views/library_groups/show.html.erb_spec.rb +2 -0
- data/spec/views/withdraws/index.html.erb_spec.rb +2 -0
- metadata +52 -105
- data/app/models/enju_library/ability.rb +0 -72
- data/lib/enju_library/item.rb +0 -39
- data/spec/dummy/app/models/ability.rb +0 -68
data/app/models/request_type.rb
CHANGED
data/app/models/search_engine.rb
CHANGED
data/app/models/withdraw.rb
CHANGED
@@ -3,15 +3,19 @@ class Withdraw < ActiveRecord::Base
|
|
3
3
|
belongs_to :item, touch: true
|
4
4
|
belongs_to :librarian, class_name: 'User'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
validates_presence_of :item_id, message: I18n.t('withdraw.item_not_found')
|
6
|
+
validates :item_id,
|
7
|
+
uniqueness: true, #{ message: I18n.t('withdraw.already_withdrawn', locale: I18n.default_locale) },
|
8
|
+
presence: true #, { message: I18n.translate('withdraw.item_not_found', locale: I18n.default_locale) }
|
10
9
|
validates_presence_of :basket_id
|
10
|
+
validate :check_item
|
11
11
|
|
12
12
|
attr_accessor :item_identifier
|
13
13
|
|
14
14
|
paginates_per 10
|
15
|
+
|
16
|
+
def check_item
|
17
|
+
errors.add(:item) if item.try(:rent?)
|
18
|
+
end
|
15
19
|
end
|
16
20
|
|
17
21
|
# == Schema Information
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class AcceptPolicy < ApplicationPolicy
|
2
|
+
def index?
|
3
|
+
true if user.try(:has_role?, 'Librarian')
|
4
|
+
end
|
5
|
+
|
6
|
+
def show?
|
7
|
+
true if user.try(:has_role?, 'Librarian')
|
8
|
+
end
|
9
|
+
|
10
|
+
def create?
|
11
|
+
true if user.try(:has_role?, 'Librarian')
|
12
|
+
end
|
13
|
+
|
14
|
+
def update?
|
15
|
+
true if user.try(:has_role?, 'Librarian')
|
16
|
+
end
|
17
|
+
|
18
|
+
def destroy?
|
19
|
+
true if user.try(:has_role?, 'Librarian')
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class BasketPolicy < ApplicationPolicy
|
2
|
+
def index?
|
3
|
+
true if user.try(:has_role?, 'Librarian')
|
4
|
+
end
|
5
|
+
|
6
|
+
def show?
|
7
|
+
true if user.try(:has_role?, 'Librarian')
|
8
|
+
end
|
9
|
+
|
10
|
+
def create?
|
11
|
+
true if user.try(:has_role?, 'Librarian')
|
12
|
+
end
|
13
|
+
|
14
|
+
def update?
|
15
|
+
true if user.try(:has_role?, 'Librarian')
|
16
|
+
end
|
17
|
+
|
18
|
+
def destroy?
|
19
|
+
true if user.try(:has_role?, 'Librarian')
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class BookstorePolicy < ApplicationPolicy
|
2
|
+
def index?
|
3
|
+
true if user.try(:has_role?, 'Librarian')
|
4
|
+
end
|
5
|
+
|
6
|
+
def show?
|
7
|
+
true if user.try(:has_role?, 'Librarian')
|
8
|
+
end
|
9
|
+
|
10
|
+
def create?
|
11
|
+
true if user.try(:has_role?, 'Administrator')
|
12
|
+
end
|
13
|
+
|
14
|
+
def update?
|
15
|
+
true if user.try(:has_role?, 'Administrator')
|
16
|
+
end
|
17
|
+
|
18
|
+
def destroy?
|
19
|
+
if user.try(:has_role?, 'Administrator')
|
20
|
+
true if record.items.empty?
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class BudgetTypePolicy < ApplicationPolicy
|
2
|
+
def index?
|
3
|
+
true if user.try(:has_role?, 'Librarian')
|
4
|
+
end
|
5
|
+
|
6
|
+
def show?
|
7
|
+
true if user.try(:has_role?, 'Librarian')
|
8
|
+
end
|
9
|
+
|
10
|
+
def create?
|
11
|
+
true if user.try(:has_role?, 'Administrator')
|
12
|
+
end
|
13
|
+
|
14
|
+
def update?
|
15
|
+
true if user.try(:has_role?, 'Administrator')
|
16
|
+
end
|
17
|
+
|
18
|
+
def destroy?
|
19
|
+
true if user.try(:has_role?, 'Administrator')
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class LibraryGroupPolicy < ApplicationPolicy
|
2
|
+
def index?
|
3
|
+
true if user.try(:has_role?, 'Librarian')
|
4
|
+
end
|
5
|
+
|
6
|
+
def show?
|
7
|
+
true if user.try(:has_role?, 'Librarian')
|
8
|
+
end
|
9
|
+
|
10
|
+
def create?
|
11
|
+
true if user.try(:has_role?, 'Administrator')
|
12
|
+
end
|
13
|
+
|
14
|
+
def update?
|
15
|
+
true if user.try(:has_role?, 'Administrator')
|
16
|
+
end
|
17
|
+
|
18
|
+
def destroy?
|
19
|
+
if user.try(:has_role?, 'Administrator')
|
20
|
+
true if record.shelves.empty? && !record.web?
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class LibraryPolicy < ApplicationPolicy
|
2
|
+
def index?
|
3
|
+
true
|
4
|
+
end
|
5
|
+
|
6
|
+
def show?
|
7
|
+
true
|
8
|
+
end
|
9
|
+
|
10
|
+
def create?
|
11
|
+
true if user.try(:has_role?, 'Administrator')
|
12
|
+
end
|
13
|
+
|
14
|
+
def update?
|
15
|
+
true if user.try(:has_role?, 'Administrator')
|
16
|
+
end
|
17
|
+
|
18
|
+
def destroy?
|
19
|
+
if user.try(:has_role?, 'Administrator')
|
20
|
+
if record.profiles.empty?
|
21
|
+
true if record.shelves.empty? && !record.web?
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class RequestStatusTypePolicy < ApplicationPolicy
|
2
|
+
def index?
|
3
|
+
true if user.try(:has_role?, 'Librarian')
|
4
|
+
end
|
5
|
+
|
6
|
+
def show?
|
7
|
+
true if user.try(:has_role?, 'Librarian')
|
8
|
+
end
|
9
|
+
|
10
|
+
def create?
|
11
|
+
false
|
12
|
+
end
|
13
|
+
|
14
|
+
def update?
|
15
|
+
true if user.try(:has_role?, 'Administrator')
|
16
|
+
end
|
17
|
+
|
18
|
+
def destroy?
|
19
|
+
false
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class RequestTypePolicy < ApplicationPolicy
|
2
|
+
def index?
|
3
|
+
true if user.try(:has_role?, 'Librarian')
|
4
|
+
end
|
5
|
+
|
6
|
+
def show?
|
7
|
+
true if user.try(:has_role?, 'Librarian')
|
8
|
+
end
|
9
|
+
|
10
|
+
def create?
|
11
|
+
false
|
12
|
+
end
|
13
|
+
|
14
|
+
def update?
|
15
|
+
true if user.try(:has_role?, 'Administrator')
|
16
|
+
end
|
17
|
+
|
18
|
+
def destroy?
|
19
|
+
false
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class SearchEnginePolicy < ApplicationPolicy
|
2
|
+
def index?
|
3
|
+
true if user.try(:has_role?, 'Librarian')
|
4
|
+
end
|
5
|
+
|
6
|
+
def show?
|
7
|
+
true if user.try(:has_role?, 'Librarian')
|
8
|
+
end
|
9
|
+
|
10
|
+
def create?
|
11
|
+
true if user.try(:has_role?, 'Administrator')
|
12
|
+
end
|
13
|
+
|
14
|
+
def update?
|
15
|
+
true if user.try(:has_role?, 'Administrator')
|
16
|
+
end
|
17
|
+
|
18
|
+
def destroy?
|
19
|
+
true if user.try(:has_role?, 'Administrator')
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class ShelfPolicy < ApplicationPolicy
|
2
|
+
def index?
|
3
|
+
true
|
4
|
+
end
|
5
|
+
|
6
|
+
def show?
|
7
|
+
true
|
8
|
+
end
|
9
|
+
|
10
|
+
def create?
|
11
|
+
true if user.try(:has_role?, 'Administrator')
|
12
|
+
end
|
13
|
+
|
14
|
+
def update?
|
15
|
+
true if user.try(:has_role?, 'Administrator')
|
16
|
+
end
|
17
|
+
|
18
|
+
def destroy?
|
19
|
+
if user.try(:has_role?, 'Administrator')
|
20
|
+
true if record.items.empty? && !record.web_shelf?
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class SubscribePolicy < ApplicationPolicy
|
2
|
+
def index?
|
3
|
+
true if user.try(:has_role?, 'Librarian')
|
4
|
+
end
|
5
|
+
|
6
|
+
def show?
|
7
|
+
true if user.try(:has_role?, 'Librarian')
|
8
|
+
end
|
9
|
+
|
10
|
+
def create?
|
11
|
+
true if user.try(:has_role?, 'Librarian')
|
12
|
+
end
|
13
|
+
|
14
|
+
def update?
|
15
|
+
true if user.try(:has_role?, 'Librarian')
|
16
|
+
end
|
17
|
+
|
18
|
+
def destroy?
|
19
|
+
true if user.try(:has_role?, 'Librarian')
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class SubscriptionPolicy < ApplicationPolicy
|
2
|
+
def index?
|
3
|
+
true if user.try(:has_role?, 'Librarian')
|
4
|
+
end
|
5
|
+
|
6
|
+
def show?
|
7
|
+
true if user.try(:has_role?, 'Librarian')
|
8
|
+
end
|
9
|
+
|
10
|
+
def create?
|
11
|
+
true if user.try(:has_role?, 'Librarian')
|
12
|
+
end
|
13
|
+
|
14
|
+
def update?
|
15
|
+
true if user.try(:has_role?, 'Librarian')
|
16
|
+
end
|
17
|
+
|
18
|
+
def destroy?
|
19
|
+
true if user.try(:has_role?, 'Librarian')
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class WithdrawPolicy < ApplicationPolicy
|
2
|
+
def index?
|
3
|
+
true if user.try(:has_role?, 'Librarian')
|
4
|
+
end
|
5
|
+
|
6
|
+
def show?
|
7
|
+
true if user.try(:has_role?, 'Librarian')
|
8
|
+
end
|
9
|
+
|
10
|
+
def create?
|
11
|
+
true if user.try(:has_role?, 'Librarian')
|
12
|
+
end
|
13
|
+
|
14
|
+
def update?
|
15
|
+
true if user.try(:has_role?, 'Librarian')
|
16
|
+
end
|
17
|
+
|
18
|
+
def destroy?
|
19
|
+
true if user.try(:has_role?, 'Librarian')
|
20
|
+
end
|
21
|
+
end
|
@@ -25,6 +25,6 @@
|
|
25
25
|
<div id="submenu" class="ui-corner-all ui-widget-content">
|
26
26
|
<ul>
|
27
27
|
<li><%= link_to t('page.show'), basket_path(@basket) -%></li>
|
28
|
-
<li><%= link_to t('page.back'),
|
28
|
+
<li><%= link_to t('page.back'), baskets_path(user_id: @basket.user.username) -%></li>
|
29
29
|
</ul>
|
30
30
|
</div>
|
@@ -23,7 +23,9 @@
|
|
23
23
|
|
24
24
|
<div id="submenu" class="ui-corner-all ui-widget-content">
|
25
25
|
<ul>
|
26
|
-
|
26
|
+
<% if defined?(EnjuCirculation) %>
|
27
|
+
<li><%= link_to t('page.new', model: t('activerecord.models.checkin')), new_checkin_path -%></li>
|
28
|
+
<% end %>
|
27
29
|
<li><%= link_to t('page.search_resource', model: t('activerecord.models.profile')), profiles_path -%></li>
|
28
30
|
</ul>
|
29
31
|
</div>
|
@@ -14,7 +14,7 @@
|
|
14
14
|
<%- @bookstores.each_with_index do |bookstore, i| -%>
|
15
15
|
<tr class="line<%= cycle("0", "1") -%>">
|
16
16
|
<td>
|
17
|
-
<%- if
|
17
|
+
<%- if policy(bookstore).update? -%>
|
18
18
|
<%= move_position(bookstore) -%>
|
19
19
|
<%- end -%>
|
20
20
|
</td>
|
@@ -25,10 +25,10 @@
|
|
25
25
|
<td><%= bookstore.telephone_number -%></td>
|
26
26
|
<td><%= bookstore.fax_number -%></td>
|
27
27
|
<td>
|
28
|
-
<%- if
|
28
|
+
<%- if policy(bookstore).update? -%>
|
29
29
|
<%= link_to t('page.edit'), edit_bookstore_path(bookstore) -%>
|
30
30
|
<% end %>
|
31
|
-
<%- if
|
31
|
+
<%- if policy(bookstore).destroy? -%>
|
32
32
|
<%= link_to t('page.destroy'), bookstore, data: {confirm: t('page.are_you_sure')}, method: :delete -%>
|
33
33
|
<%- end -%>
|
34
34
|
</td>
|
@@ -41,7 +41,7 @@
|
|
41
41
|
</div>
|
42
42
|
|
43
43
|
<div id="submenu" class="ui-corner-all ui-widget-content">
|
44
|
-
<%- if
|
44
|
+
<%- if policy(Bookstore).create? -%>
|
45
45
|
<ul>
|
46
46
|
<li><%= link_to t('page.new', model: t('activerecord.models.bookstore')), new_bookstore_path -%></li>
|
47
47
|
</ul>
|
@@ -43,10 +43,10 @@
|
|
43
43
|
|
44
44
|
<div id="submenu" class="ui-corner-all ui-widget-content">
|
45
45
|
<ul>
|
46
|
-
<%- if
|
46
|
+
<%- if policy(@bookstore).update? -%>
|
47
47
|
<li><%= link_to t('page.edit'), edit_bookstore_path(@bookstore) -%></li>
|
48
48
|
<%- end -%>
|
49
|
-
<li><%=
|
49
|
+
<li><%= link_to t('page.back'), :back -%></li>
|
50
50
|
<% if defined?(EnjuPurchaseRequest) %>
|
51
51
|
<li><%= link_to t('activerecord.models.order_list'), bookstore_order_lists_path(@bookstore) -%></li>
|
52
52
|
<% end %>
|
@@ -14,7 +14,7 @@
|
|
14
14
|
<%- @budget_types.each do |budget_type| -%>
|
15
15
|
<tr class="line<%= cycle("0", "1") -%>">
|
16
16
|
<td>
|
17
|
-
<%- if
|
17
|
+
<%- if policy(budget_type).update? -%>
|
18
18
|
<%= move_position(budget_type) -%>
|
19
19
|
<%- end -%>
|
20
20
|
</td>
|
@@ -22,10 +22,10 @@
|
|
22
22
|
<td><%= link_to budget_type.display_name.localize, budget_type -%></td>
|
23
23
|
<td><%= budget_type.note -%></td>
|
24
24
|
<td>
|
25
|
-
<%- if
|
25
|
+
<%- if policy(budget_type).update? -%>
|
26
26
|
<%= link_to t('page.edit'), edit_budget_type_path(budget_type) -%>
|
27
27
|
<% end %>
|
28
|
-
<%- if
|
28
|
+
<%- if policy(budget_type).destroy? -%>
|
29
29
|
<%= link_to t('page.destroy'), budget_type, 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
|
41
|
+
<%- if policy(BudgetType).create? -%>
|
42
42
|
<li><%= link_to t('page.new', model: t('activerecord.models.budget_type')), new_budget_type_path -%></li>
|
43
43
|
<%- end -%>
|
44
44
|
</ul>
|
@@ -23,9 +23,9 @@
|
|
23
23
|
|
24
24
|
<div id="submenu" class="ui-corner-all ui-widget-content">
|
25
25
|
<ul>
|
26
|
-
<%- if
|
26
|
+
<%- if policy(@budget_type).update? -%>
|
27
27
|
<li><%= link_to t('page.edit'), edit_budget_type_path(@budget_type) -%></li>
|
28
28
|
<%- end -%>
|
29
|
-
<li><%=
|
29
|
+
<li><%= link_to t('page.back'), :back -%></li>
|
30
30
|
</ul>
|
31
31
|
</div>
|
File without changes
|
@@ -40,7 +40,7 @@
|
|
40
40
|
<%- @libraries.each_with_index do |library, i| -%>
|
41
41
|
<tr class="line<%= cycle("0", "1") -%>">
|
42
42
|
<td>
|
43
|
-
<%- if
|
43
|
+
<%- if policy(library).update? and params[:query].blank? -%>
|
44
44
|
<%= library.first? ? image_tag('icons/stop.png', size: '16x16') : link_to(image_tag('icons/arrow_up.png', size: '16x16', alt: t('page.asc')), {action: 'update', move: 'higher', id: library.name}, method: :put) -%>
|
45
45
|
<%= library.last? ? image_tag('icons/stop.png', size: '16x16') : link_to(image_tag('icons/arrow_down.png', size: '16x16', alt: t('page.desc')), {action: 'update', move: 'lower', id: library.name}, method: :put) -%>
|
46
46
|
<%- end -%>
|
@@ -66,10 +66,10 @@
|
|
66
66
|
<% end %>
|
67
67
|
</td>
|
68
68
|
<td>
|
69
|
-
<%- if
|
69
|
+
<%- if policy(library).update? -%>
|
70
70
|
<%= link_to t('page.edit'), edit_library_path(library) -%>
|
71
71
|
<% end %>
|
72
|
-
<%- if
|
72
|
+
<%- if policy(library).destroy? -%>
|
73
73
|
<%= link_to t('page.destroy'), library, data: {confirm: t('page.are_you_sure')}, method: :delete -%>
|
74
74
|
<%- end -%>
|
75
75
|
</td>
|
@@ -83,7 +83,7 @@
|
|
83
83
|
|
84
84
|
<div id="submenu" class="ui-corner-all ui-widget-content">
|
85
85
|
<ul>
|
86
|
-
<%- if
|
86
|
+
<%- if policy(Library).create? -%>
|
87
87
|
<li><%= link_to t('page.new', model: t('activerecord.models.library')), new_library_path -%></li>
|
88
88
|
<%- end -%>
|
89
89
|
</ul>
|
File without changes
|
@@ -36,7 +36,7 @@
|
|
36
36
|
<% if defined?(EnjuEvent) %>
|
37
37
|
<li><a href="#tab4"><em><%= t('activerecord.models.event') -%></em></a></li>
|
38
38
|
<% end %>
|
39
|
-
<%- if
|
39
|
+
<%- if policy(@library).update? -%>
|
40
40
|
<li><a href="#tab5"><em><%= t('page.configuration') -%></em></a></li>
|
41
41
|
<%- end -%>
|
42
42
|
</ul>
|
@@ -97,7 +97,7 @@
|
|
97
97
|
</div>
|
98
98
|
<% end %>
|
99
99
|
|
100
|
-
<%- if
|
100
|
+
<%- if policy(@library).update? -%>
|
101
101
|
<div id="tab5">
|
102
102
|
<h3><%= t('page.configuration') -%></h3>
|
103
103
|
<p>
|
@@ -119,15 +119,15 @@
|
|
119
119
|
|
120
120
|
<div id="submenu" class="ui-corner-all ui-widget-content">
|
121
121
|
<ul>
|
122
|
-
<%- if
|
122
|
+
<%- if policy(@library).update? -%>
|
123
123
|
<li><%= link_to t('page.edit'), edit_library_path(@library) -%></li>
|
124
124
|
<%- end -%>
|
125
125
|
|
126
|
-
<%- if
|
126
|
+
<%- if policy(Shelf).create? and !@library.web? -%>
|
127
127
|
<li><%= link_to t('page.new', model: t('activerecord.models.shelf')), new_shelf_path(library_id: @library.id) -%></li>
|
128
128
|
<%- end -%>
|
129
129
|
<% if defined?(EnjuEvent) %>
|
130
|
-
<%- if
|
130
|
+
<%- if policy(Event).create? and !@library.web? -%>
|
131
131
|
<li><%= link_to t('page.new', model: t('activerecord.models.event')), new_event_path(library_id: @library.id) -%></li>
|
132
132
|
<%- end -%>
|
133
133
|
<%- end -%>
|
@@ -21,10 +21,19 @@
|
|
21
21
|
<%= f.url_field :url, class: 'resource_url' -%>
|
22
22
|
</div>
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
<% @available_languages.each do |language| -%>
|
25
|
+
<div class="field">
|
26
|
+
<%= f.label :login_banner -%> (<%= language.display_name.localize -%>)<br />
|
27
|
+
<%= f.text_area LibraryGroup.localized_attr_name_for(:login_banner, language.iso_639_1) -%>
|
28
|
+
</div>
|
29
|
+
<% end -%>
|
30
|
+
|
31
|
+
<% @available_languages.each do |language| -%>
|
32
|
+
<div>
|
33
|
+
<%= f.label :footer_banner -%> (<%= language.display_name.localize -%>)<br />
|
34
|
+
<%= f.text_area LibraryGroup.localized_attr_name_for(:footer_banner, language.iso_639_1) -%>
|
35
|
+
</div>
|
36
|
+
<% end -%>
|
28
37
|
|
29
38
|
<div class="field">
|
30
39
|
<%= f.label :max_number_of_results -%><br />
|
@@ -39,10 +48,11 @@
|
|
39
48
|
<div class="field">
|
40
49
|
<%= f.label :color -%><br />
|
41
50
|
<%= f.fields_for :colors do |color_form| %>
|
42
|
-
<%=
|
43
|
-
<%= color_form.text_field :code %>
|
44
|
-
<br />
|
51
|
+
<%= render 'color_fields', f: color_form %>
|
45
52
|
<% end %>
|
53
|
+
<div class="links">
|
54
|
+
<p><%= link_to_add_association t('page.add'), f, :colors %></p>
|
55
|
+
</div>
|
46
56
|
</div>
|
47
57
|
|
48
58
|
<div class="field">
|
@@ -16,7 +16,7 @@
|
|
16
16
|
<td><%= library_group.name -%></td>
|
17
17
|
<td><%= library_group.user.email -%></td>
|
18
18
|
<td>
|
19
|
-
<%= link_to t('page.edit'), edit_library_group_path(library_group) if
|
19
|
+
<%= link_to t('page.edit'), edit_library_group_path(library_group) if policy(library_group).update? -%>
|
20
20
|
</td>
|
21
21
|
</tr>
|
22
22
|
<%- end -%>
|
@@ -28,6 +28,11 @@
|
|
28
28
|
<%= markdown_helper(@library_group.login_banner) -%>
|
29
29
|
</p>
|
30
30
|
|
31
|
+
<p>
|
32
|
+
<strong><%= t('activerecord.attributes.library_group.footer_banner') -%>:</strong>
|
33
|
+
<%= markdown_helper(@library_group.footer_banner) -%>
|
34
|
+
</p>
|
35
|
+
|
31
36
|
<p>
|
32
37
|
<strong><%= t('activerecord.attributes.library_group.max_number_of_results') -%>:</strong>
|
33
38
|
<%= @library_group.max_number_of_results -%>
|
@@ -88,9 +93,8 @@
|
|
88
93
|
|
89
94
|
<div id="submenu" class="ui-corner-all ui-widget-content">
|
90
95
|
<ul>
|
91
|
-
<%- if
|
96
|
+
<%- if policy(@library_group).update? -%>
|
92
97
|
<li><%= link_to t('page.edit'), edit_library_group_path(@library_group) -%></li>
|
93
98
|
<%- end -%>
|
94
|
-
<li><%= back_to_index(flash[:page_info]) -%></li>
|
95
99
|
</ul>
|
96
100
|
</div>
|