Sha256: c36124c1024ba5a06772698c103bb52a6c1dea0a386c563120d738c6e1180cb9

Contents?: true

Size: 918 Bytes

Versions: 3

Compression:

Stored size: 918 Bytes

Contents

module Twitter
  module Bootswatch
    module Rails
      module Helpers
        module BreadCrumbs
          def self.included(base)
            base.extend(ClassMethods)
          end

          module ClassMethods
            def add_breadcrumb name, url, options={}
              before_filter options do |controller|
                controller.send :add_breadcrumb, name, url
              end
            end
          end

          protected

          def add_breadcrumb name, url = '', options = {}
            @breadcrumbs ||= []
            url = eval(url.to_s) if url =~ /_path|_url|@/
              @breadcrumbs << {:name => name, :url => url, :options => options}
          end

          def render_breadcrumbs(divider = '/')
            s = render :partial => 'twitter/bootswatch/breadcrumbs', :locals => {:divider => divider}
            s.first
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
twitter-bootswatch-rails-helpers-2.3.2.1 lib/twitter/bootswatch/rails/helpers/breadcrumbs.rb
twitter-bootswatch-rails-helpers-2.3.2 lib/twitter/bootswatch/rails/helpers/breadcrumbs.rb
twitter-bootswatch-rails-helpers-2.3.1 lib/twitter/bootswatch/rails/helpers/breadcrumbs.rb