Skip to content

Commit

Permalink
hide purchase request link from manifestation detail page
Browse files Browse the repository at this point in the history
  • Loading branch information
nabeta committed Feb 18, 2024
1 parent 8d7176b commit 28bed81
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
3 changes: 2 additions & 1 deletion app/controllers/purchase_requests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ def show
def new
@purchase_request = current_user.purchase_requests.new(purchase_request_params)
if defined?(EnjuBookmark)
@purchase_request.title = Bookmark.get_title_from_url(@purchase_request.url) unless @purchase_request.title?
bookmark = Bookmark.new
@purchase_request.title = bookmark.get_title_from_url(@purchase_request.url) unless @purchase_request.title?
end
end

Expand Down
7 changes: 4 additions & 3 deletions app/models/bookmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,12 @@ def get_title
end
end

def self.get_title_from_url(url)
def get_title_from_url(url)
return if url.blank?
return unless Addressable::URI.parse(url).host
if manifestation_id = url.bookmarkable_id
self.manifestation = Manifestation.find(manifestation_id)

if manifestation_id == url.bookmarkable_id
bookmark.manifestation = Manifestation.find(manifestation_id)
return manifestation.original_title
end
unless manifestation
Expand Down
2 changes: 0 additions & 2 deletions app/views/manifestations/_reservation.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
<br />
(<%= link_to_if(current_user.has_role?('Librarian'), t('page.number_of_reservations', count: @reserved_count), reserves_path(query: "manifestation_id_i:#{@manifestation.id}")) -%>)</li>
<%- else -%>
<!--
<% if defined?(EnjuPurchaseRequest) %>
<li><%= link_to t('activerecord.models.purchase_request'), new_purchase_request_path(purchase_request: {url: manifestation_url(@manifestation)}) %></li>
<% end %>
-->
<%- end -%>
<% else %>
<% unless Pundit.policy_scope!(current_user, @manifestation.items).for_checkout.empty? %>
Expand Down

0 comments on commit 28bed81

Please sign in to comment.