Add a new breadcrumbs
@param [String] name
The name of resource.
@param [Symbol] name
The name of resource.
@param [String] url
The url href.
@param [String] caption
The text caption.
@param [Hash] options
The HTML options to include in li.
@example
breadcrumbs.add "foo", "/foo", "Foo Link", :id => "foo-id" breadcrumbs.add :foo, "/foo", "Foo Link", :class => "foo-class"
@api public
# File lib/padrino-helpers/breadcrumb_helpers.rb, line 101 def add(name, url, caption, options = {}) items << { :name => name.to_sym, :url => url.to_s, :caption => caption.to_s.humanize.html_safe, :options => options } end
Remove a Breadcrumbs
@param [String] name
The name of resource to delete from breadcrumbs list
@param [Symbol] name
The name of resource to delete from breadcrumbs list
@example
breadcrumbs.del "foo" breadcrumbs.del :foo
@api public
# File lib/padrino-helpers/breadcrumb_helpers.rb, line 126 def del(name) items.delete_if { |item| item[:name] == name.to_sym } end
Reset breadcrumbs to default or personal home
@example
breadcrumbs.reset
@api public
# File lib/padrino-helpers/breadcrumb_helpers.rb, line 57 def reset self.items = [] self.items << home end
Reset breadcrumbs to default home
@example
breadcrumbs.reset!
@api public
# File lib/padrino-helpers/breadcrumb_helpers.rb, line 69 def reset! self.home = { :name => :home, :url => DEFAULT_URL, :caption => DEFAULT_CAPTION, :options => {} } reset end
Set the custom home (Parent) link
@param [String] url
The url href
@param [String] caption
The text caption.
@param [Hash] options
The HTML options to include in li.
@example
breadcrumbs.set_home "/HomeFoo", "Foo Home", :id => "home-breadcrumb"
@api public
# File lib/padrino-helpers/breadcrumb_helpers.rb, line 40 def set_home(url, caption, options = {}) self.home = { :url => url.to_s, :caption => caption.to_s.humanize.html_safe, :name => :home, :options => options } reset end
Generated with the Darkfish Rdoc Generator 2.