Sha256: 8caafd0944d4ebbcc6dca7eb3c6603a6faf9d22d7e626811064b216dbac5d41f

Contents?: true

Size: 1.65 KB

Versions: 13

Compression:

Stored size: 1.65 KB

Contents

<% if current_or_guest_user %>
  <%-
  # Note these two forms are pretty similar but for different :methods, classes, and labels.
  # but it was simpler to leave them seperate instead of DRYing them, got confusing trying that.
  # the data-doc-id attribute is used by our JS that converts to a checkbox/label.
  -%>
  <% if bookmarked? document %>
    <%= form_tag(bookmark_path(document),
                 method: :delete,
                 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('blacklight.bookmarks.remove.button'),
                     id: "bookmark_toggle_#{document.id.to_s.parameterize}",
                     class: "bookmark-remove btn btn-outline-secondary") %>
    <% end %>
  <% else %>
    <%= form_tag(bookmark_path(document),
                 method: :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('blacklight.bookmarks.add.button'),
                      id: "bookmark_toggle_#{document.id.to_s.parameterize}",
                      class: "bookmark-add btn btn-outline-secondary") %>
    <% end %>
  <% end %>
<% end %>

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
blacklight-7.10.0 app/views/catalog/_bookmark_control.html.erb
blacklight-7.9.0 app/views/catalog/_bookmark_control.html.erb
blacklight-7.8.1 app/views/catalog/_bookmark_control.html.erb
blacklight-7.8.0 app/views/catalog/_bookmark_control.html.erb
blacklight-7.7.0 app/views/catalog/_bookmark_control.html.erb
blacklight-7.6.0 app/views/catalog/_bookmark_control.html.erb
blacklight-7.5.1 app/views/catalog/_bookmark_control.html.erb
blacklight-7.5.0 app/views/catalog/_bookmark_control.html.erb
blacklight-7.4.2 app/views/catalog/_bookmark_control.html.erb
blacklight-7.4.1 app/views/catalog/_bookmark_control.html.erb
blacklight-7.4.0 app/views/catalog/_bookmark_control.html.erb
blacklight-7.3.0 app/views/catalog/_bookmark_control.html.erb
blacklight-7.2.0 app/views/catalog/_bookmark_control.html.erb