Skip to content

Commit

Permalink
show order_list when logged in as Librarian next-l/enju_leaf#925
Browse files Browse the repository at this point in the history
  • Loading branch information
nabeta committed Dec 8, 2015
1 parent c6b180f commit 2563eda
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ gemspec
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.
gem 'enju_leaf', github: 'next-l/enju_leaf', branch: '1.2'
gem 'enju_biblio', github: 'next-l/enju_biblio', branch: '1.2'
gem 'enju_library', github: 'next-l/enju_library', branch: '1.2'
gem 'enju_manifestation_viewer', github: 'next-l/enju_manifestation_viewer', branch: '1.2'
gem 'enju_bookmark', github: 'next-l/enju_bookmark', branch: '1.2'

# To use debugger
Expand Down
6 changes: 4 additions & 2 deletions app/views/purchase_requests/_index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
<%= purchase_request.author -%>
<%= purchase_request.publisher -%>
<%= purchase_request.pub_date -%>
<br />
<%= t('activerecord.models.order_list') %>: <%= link_to purchase_request.order_list.title, purchase_requests_path(order_list_id: purchase_request.order_list.id) if purchase_request.order_list -%>
<% if current_user.has_role?('Librarian') %>
<br />
<%= t('activerecord.models.order_list') %>: <%= link_to purchase_request.order_list.title, purchase_requests_path(order_list_id: purchase_request.order_list.id) if purchase_request.order_list -%>
<% end %>
</td>
<td><%= purchase_request.price -%></td>
<td>
Expand Down
10 changes: 8 additions & 2 deletions lib/enju_purchase_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@ module InstanceMethods
private

def get_order_list
@order_list = OrderList.find(params[:order_list_id]) if params[:order_list_id]
if params[:order_list_id]
@order_list = OrderList.find(params[:order_list_id])
authorize @order_list, :show?
end
end

def get_purchase_request
@purchase_request = PurchaseRequest.find(params[:purchase_request_id]) if params[:purchase_request_id]
if params[:purchase_request_id]
@purchase_request = PurchaseRequest.find(params[:purchase_request_id])
authorize @purchase_request, :show?
end
end
end
end
Expand Down

0 comments on commit 2563eda

Please sign in to comment.