Sha256: 05ee764e51fefd2454de365061ce7dbc2c55cacffdfb6e35cb7bca2d09ea654c

Contents?: true

Size: 1.38 KB

Versions: 3

Compression:

Stored size: 1.38 KB

Contents

<% if has_user_authentication_provider? and current_user %>
  <%- existing_bookmark = current_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, :title=> document[document_show_link_field] ) do %>        
        <%= hidden_field(:bookmark, :title, :value => document[document_show_link_field] ) %>
        <%= 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, :title=> document[document_show_link_field]) do %>  
        <%= hidden_field(:bookmark, :title, :value => document[document_show_link_field] ) %>
        <%= 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

3 entries across 3 versions & 1 rubygems

Version Path
blacklight-3.6.1.1 app/views/catalog/_bookmark_control.html.erb
blacklight-3.6.0 app/views/catalog/_bookmark_control.html.erb
blacklight-3.5.0 app/views/catalog/_bookmark_control.html.erb