Sha256: 94ea462dab86b78abef43683b26168dd45c4e31caa23bfc1f98ea42d34793d04

Contents?: true

Size: 686 Bytes

Versions: 12

Compression:

Stored size: 686 Bytes

Contents

module ShelvesHelper
  def library_shelf_facet(current_library, facet)
    library = Library.where(name: facet.value).select([:name, :display_name]).first
    return nil unless library
    current = true if current_library.try(:name) == library.name
    content_tag :li do
      if current
        content_tag :strong do
          link_to("#{library.display_name.localize} (" + facet.count.to_s + ")", url_for(params.merge(page: nil, library_id: library.name, only_path: true)))
        end
      else
        link_to("#{library.display_name.localize} (" + facet.count.to_s + ")", url_for(params.merge(page: nil, library_id: library.name, only_path: true)))
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
enju_library-0.1.2 app/helpers/shelves_helper.rb
enju_library-0.1.1 app/helpers/shelves_helper.rb
enju_library-0.1.0 app/helpers/shelves_helper.rb
enju_library-0.1.0.pre45 app/helpers/shelves_helper.rb
enju_library-0.1.0.pre44 app/helpers/shelves_helper.rb
enju_library-0.1.0.pre43 app/helpers/shelves_helper.rb
enju_library-0.1.0.pre42 app/helpers/shelves_helper.rb
enju_library-0.1.0.pre41 app/helpers/shelves_helper.rb
enju_library-0.1.0.pre40 app/helpers/shelves_helper.rb
enju_library-0.1.0.pre39 app/helpers/shelves_helper.rb
enju_library-0.1.0.pre38 app/helpers/shelves_helper.rb
enju_library-0.1.0.pre37 app/helpers/shelves_helper.rb