Sha256: 855eaf329817d369faa4f8fb5cf32a72d632d2b8df6918cd70e578e56b53a0eb

Contents?: true

Size: 1.28 KB

Versions: 15

Compression:

Stored size: 1.28 KB

Contents

<% if 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[:id]), :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("Bookmark", :id => "bookmark_toggle_#{document[:id]}", :class => "bookmark_add") %>
      <% end %>
  
  <% else %>
  
      <%= form_tag( bookmark_path( document[:id]), :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("Remove bookmark", :id => "bookmark_toggle_#{document[:id]}", :class => "bookmark_remove") %>
      <% end %>
      
  <% end %>
<% else %>
  &nbsp;
<% end %>

Version data entries

15 entries across 13 versions & 2 rubygems

Version Path
atrium-0.0.1 app/views/atrium/collections/_bookmark_control.html.erb
atrium-0.0.1 app/views/atrium/exhibits/_bookmark_control.html.erb
atrium-0.0.1.alpha app/views/atrium/collections/_bookmark_control.html.erb
atrium-0.0.1.alpha app/views/atrium/exhibits/_bookmark_control.html.erb
blacklight-3.1.2 app/views/catalog/_bookmark_control.html.erb
blacklight-3.1.1 app/views/catalog/_bookmark_control.html.erb
blacklight-3.1.0 app/views/catalog/_bookmark_control.html.erb
blacklight-3.0.0 app/views/catalog/_bookmark_control.html.erb
blacklight-3.0.0pre8 app/views/catalog/_bookmark_control.html.erb
blacklight-3.0.0pre7 app/views/catalog/_bookmark_control.html.erb
blacklight-3.0.0pre6 app/views/catalog/_bookmark_control.html.erb
blacklight-3.0.0pre4 app/views/catalog/_bookmark_control.html.erb
blacklight-3.0.0pre3 app/views/catalog/_bookmark_control.html.erb
blacklight-3.0pre2 app/views/catalog/_bookmark_control.html.erb
blacklight-3.0pre1 app/views/catalog/_bookmark_control.html.erb