Sha256: 3878bc0c65e0d8a21fa566652d6653e325f745fced32758fed41ed6281cb7039

Contents?: true

Size: 1.34 KB

Versions: 38

Compression:

Stored size: 1.34 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 separate 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("Bookmark", :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("Remove bookmark", :id => "bookmark_toggle_#{document.id.to_s.parameterize}", :class => "bookmark_remove") %>
      <% end %>
      
  <% end %>
<% else %>
  &nbsp;
<% end %>

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
sufia-4.0.0.beta2 app/views/catalog/_bookmark_control.html.erb
sufia-4.0.0.beta1 app/views/catalog/_bookmark_control.html.erb
sufia-3.7.2 app/views/catalog/_bookmark_control.html.erb
sufia-3.7.1 app/views/catalog/_bookmark_control.html.erb
sufia-3.7.0 app/views/catalog/_bookmark_control.html.erb
sufia-3.6.1 app/views/catalog/_bookmark_control.html.erb
sufia-3.6.0 app/views/catalog/_bookmark_control.html.erb
sufia-3.5.0 app/views/catalog/_bookmark_control.html.erb
sufia-3.4.0 app/views/catalog/_bookmark_control.html.erb
sufia-3.4.0.rc4 app/views/catalog/_bookmark_control.html.erb
sufia-3.4.0.rc3 app/views/catalog/_bookmark_control.html.erb
sufia-3.3.1 app/views/catalog/_bookmark_control.html.erb
sufia-3.4.0.rc2 app/views/catalog/_bookmark_control.html.erb
sufia-3.4.0.rc1 app/views/catalog/_bookmark_control.html.erb
sufia-3.3.0 app/views/catalog/_bookmark_control.html.erb
sufia-3.2.1 app/views/catalog/_bookmark_control.html.erb
sufia-3.1.3 app/views/catalog/_bookmark_control.html.erb
sufia-3.1.2 app/views/catalog/_bookmark_control.html.erb
sufia-3.1.1 app/views/catalog/_bookmark_control.html.erb
sufia-3.1.0 app/views/catalog/_bookmark_control.html.erb