Sha256: b1c82a6bcc2c191314500fc978ba41067448ee4ccdaa502d76e966f03fb1e46d

Contents?: true

Size: 857 Bytes

Versions: 5

Compression:

Stored size: 857 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
            s = render partial: 'twitter/bootswatch/breadcrumbs'
            s.first
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
twitter-bootswatch-rails-helpers-3.3.2.0 lib/twitter/bootswatch/rails/helpers/breadcrumbs.rb
twitter-bootswatch-rails-helpers-3.2.0.0 lib/twitter/bootswatch/rails/helpers/breadcrumbs.rb
twitter-bootswatch-rails-helpers-3.1.0.0 lib/twitter/bootswatch/rails/helpers/breadcrumbs.rb
twitter-bootswatch-rails-helpers-3.0.0.1 lib/twitter/bootswatch/rails/helpers/breadcrumbs.rb
twitter-bootswatch-rails-helpers-3.0.0.0 lib/twitter/bootswatch/rails/helpers/breadcrumbs.rb