Sha256: f7c177cf921b7ccc6057134db39c699bcedeb3da34a52eea1cde3bb366741f8f

Contents?: true

Size: 1.08 KB

Versions: 24

Compression:

Stored size: 1.08 KB

Contents

class Breadcrumbs
  module Render
    class MyAdmin < Base # :nodoc: all
      def render
        options = {
          :class => "breadcrumbs"
        }.merge(default_options)

        tag(:div, options) do
          html_div = tag(:ul) do
            html = ""
            items = breadcrumbs.items
            size = items.size

            items.each_with_index do |item, i|
              html << render_item(item, i, size)
            end

            html
          end
          html_div << tag(:div, :class => "close-bread") do
            tag(:a, :href => "#") do 
              tag(:i, :class => "icon-remove")
            end
          end
          html_div
        end
      end

      def render_item(item, i, size)
        css = []
        css << "first" if i == 0
        css << "last" if i == size - 1
        css << "item-#{i}"

        text, url, options = *item
        text = wrap_item(url, CGI.escapeHTML(text), options)
        text << tag(:i, {:class => "icon-angle-right"}) unless i == size - 1
        
        tag(:li, text, :class => css.join(" "))
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
my_admin-0.1.13 lib/my_admin/breadcrumbs/my_admin.rb
my_admin-0.1.12 lib/my_admin/breadcrumbs/my_admin.rb
my_admin-0.1.11 lib/my_admin/breadcrumbs/my_admin.rb
my_admin-0.1.10 lib/my_admin/breadcrumbs/my_admin.rb
my_admin-0.1.9 lib/my_admin/breadcrumbs/my_admin.rb
my_admin-0.1.8 lib/my_admin/breadcrumbs/my_admin.rb
my_admin-0.1.7 lib/my_admin/breadcrumbs/my_admin.rb
my_admin-0.1.6 lib/my_admin/breadcrumbs/my_admin.rb
my_admin-0.1.5 lib/my_admin/breadcrumbs/my_admin.rb
my_admin-0.1.4 lib/my_admin/breadcrumbs/my_admin.rb
my_admin-0.1.3 lib/my_admin/breadcrumbs/my_admin.rb
my_admin-0.1.2 lib/my_admin/breadcrumbs/my_admin.rb
my_admin-0.1.1 lib/my_admin/breadcrumbs/my_admin.rb
my_admin-0.0.12 lib/my_admin/breadcrumbs/my_admin.rb
my_admin-0.0.11 lib/my_admin/breadcrumbs/my_admin.rb
my_admin-0.0.10 lib/my_admin/breadcrumbs/my_admin.rb
my_admin-0.0.9 lib/my_admin/breadcrumbs/my_admin.rb
my_admin-0.0.8 lib/my_admin/breadcrumbs/my_admin.rb
my_admin-0.0.7 lib/my_admin/breadcrumbs/my_admin.rb
my_admin-0.0.6 lib/my_admin/breadcrumbs/my_admin.rb