psu-libraries/psulib_blacklight

View on GitHub
app/components/psul_bookmark_component.html.erb

Summary

Maintainability
Test Coverage
<%= form_tag(bookmark_path,
             method: bookmarked? ? :delete : :put,
             class: 'bookmark-toggle',
             data: {
               'doc-id' => @document.id,
               present: t('blacklight.search.bookmarks.present'),
               absent: t('blacklight.search.bookmarks.absent'),
               inprogress: t('blacklight.search.bookmarks.inprogress')
             }) do %>
  <%= submit_tag(t(bookmarked? ? 'remove.button' : 'add.button', scope: 'blacklight.bookmarks'),
                 id: "bookmark_toggle_#{@document.id.to_s.parameterize}",
                 class: "bookmark-#{bookmarked? ? 'remove' : 'add'} btn btn-info btn-sm") %>
<% end %>