Sha256: 59ae2d8459707beeb02a2cbbe60cb13476219e594d4ad58ac175df2a6738a419

Contents?: true

Size: 1.42 KB

Versions: 2

Compression:

Stored size: 1.42 KB

Contents

<%# 
  # Prepare a title in an H4, with formats in parens in a <small> (for
  # bootstrap), linked, etc.
  #
  # Pass in local `item` with BentoSearch::ResultItem (can use :as arg to
  # Rails render). 
  #
  # Optionally pass in a local "index" with result set index to display
  # in front of title. 1. 2. etc. 
  # 
  # If index is passed in, we'll make an 'id' attribute that can be used
  # for an attribute based on anchor. Using either a passed in 'id_prefix'
  # or, the engine_id if present. If neither present no go (need a prefix for
  # uniqueness when more than one bento_results on a page). 
  #  
  # %>
  <h4 class="bento_item_title">
    <% if local_assigns[:index] %>
      <% id_attr = item.html_id(local_assigns[:id_prefix], index) %>
      <%= content_tag("span", :class => "bento_index", :id => (id_attr if id_attr)) do %>
        <%= index %>.
      <% end %>
    <% end %>
  
    <%= link_to_unless(item.link.blank?, item.complete_title, item.link) %>
    
    <% if item.display_format.present? || item.display_language.present? %>
    
      <small class="bento_item_about">
        <%# sorry, no whitespace so parens are flush %>
        (<%- if item.display_format.present? -%><span class="bento_format"><%= item.display_format -%></span><%- end -%><%- if item.display_language.present? -%><span class="bento_language"> in <%= item.display_language -%></span><%- end -%>)
      </small>
      
    <% end %>  
  </h4>
  

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bento_search-1.0.6 app/views/bento_search/_item_title.html.erb
bento_search-1.0.4 app/views/bento_search/_item_title.html.erb