Sha256: c890ab129ba26aa7889e81ed0293bead84089678350a406ffbc27afaa56e913a

Contents?: true

Size: 1.36 KB

Versions: 1

Compression:

Stored size: 1.36 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, :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

1 entries across 1 versions & 1 rubygems

Version Path
blacklight-3.8.2 app/views/catalog/_bookmark_control.html.erb