<% # expects "bookmarkable" (a BookmarkableDecorator object) %>
<% # Unwrap the bookmarkable to avoid type mis-identification. %>
<% unwrapped = bookmarkable.__getobj__ %>
<li id="bookmark_<%= bookmarkable.id %>" class="<%= css_classes_for_bookmarkable_blurb(unwrapped) %>" role="article">

  <!--bookmark icons-->
  <% bookmark_count = bookmarkable.public_bookmark_count %>
  <p class="status" title="<%= bookmark_count %> Bookmarks">
    <%= get_count_for_bookmark_blurb(bookmarkable) %>
  </p>

  <!--bookmark item module-->
  <%= render "bookmarks/bookmark_item_module", bookmarkable: unwrapped %>

  <!--actions-->
  <ul class="actions" role="navigation">
    <li>
      <% if current_user_bookmark ||= bookmark_if_exists(unwrapped) %>
        <%= link_to ts("Saved"),
                    edit_bookmark_path(current_user_bookmark),
                    id: "bookmark_form_trigger_for_#{bookmarkable.id}",
                    remote: true %>
      <% else %>
        <%= link_to ts("Save"),
                    new_polymorphic_path([bookmarkable, Bookmark]),
                    id: "bookmark_form_trigger_for_#{bookmarkable.id}",
                    remote: true %>
      <% end %>
    </li>
  </ul>

  <% if logged_in_as_admin? && bookmarkable.class == ExternalWork %>
    <%= render "admin/admin_options", item: bookmarkable %>
  <% end %>

  <% # bookmark form loaded here if requested %>
  <div class="new dynamic" id="bookmark_form_placement_for_<%= bookmarkable.id %>"></div>

  <div class="recent module group">
    <ul class="bookmark index group">
      <% bookmarkable.matching_bookmarks.each do |bookmark| %>
        <%= render "bookmarks/bookmark_blurb_short", bookmark: bookmark %>
      <% end %>
    </ul>
  </div>

  <ul class="actions" role="navigation">
    <li id="recent_link_<%= bookmarkable.id %>" class="showme">
      <%= link_to ts("All Bookmarks"),
                  polymorphic_path([bookmarkable, Bookmark]),
                  class: "actions" %>
    </li>
  </ul>
</li>
