Sha256: 0849ddda4d8b059f3a41c94123b07e2f08bbf707afbf12cd83038575e933ff9a

Contents?: true

Size: 1.09 KB

Versions: 11

Compression:

Stored size: 1.09 KB

Contents

<% if current_or_guest_user %>
  <%- existing_bookmark = current_or_guest_user.existing_bookmark_for(document.id) -%>
  <%- 
  # 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.
  -%>  
  <% unless existing_bookmark %>  

      <%= form_tag( bookmark_path( document ), :method => :put, :class => "bookmark_toggle", "data-doc-id" => document.id) do %>   
        <%= submit_tag(t('blacklight.bookmarks.add.button'), :id => "bookmark_toggle_#{document.id.to_s.parameterize}", :class => "bookmark_add") %>
      <% end %>
  
  <% else %>
  
      <%= form_tag( bookmark_path( document ), :method => :delete, :class => "bookmark_toggle", "data-doc-id" => document.id) do %>  
        <%= submit_tag(t('blacklight.bookmarks.remove.button'), :id => "bookmark_toggle_#{document.id.to_s.parameterize}", :class => "bookmark_remove") %>
      <% end %>
      
  <% end %>
<% else %>
  &nbsp;
<% end %>

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
blacklight-4.3.0 app/views/catalog/_bookmark_control.html.erb
blacklight-4.2.2 app/views/catalog/_bookmark_control.html.erb
blacklight-4.2.1 app/views/catalog/_bookmark_control.html.erb
blacklight-4.2.0 app/views/catalog/_bookmark_control.html.erb
blacklight-4.1.0 app/views/catalog/_bookmark_control.html.erb
blacklight-4.0.1 app/views/catalog/_bookmark_control.html.erb
blacklight-4.0.0 app/views/catalog/_bookmark_control.html.erb
blacklight-4.0.0.rc2 app/views/catalog/_bookmark_control.html.erb
blacklight-4.0.0.rc1 app/views/catalog/_bookmark_control.html.erb
blacklight-4.0.0.pre7 app/views/catalog/_bookmark_control.html.erb
blacklight-4.0.0.pre6 app/views/catalog/_bookmark_control.html.erb