-
Notifications
You must be signed in to change notification settings - Fork 366
Breadcrumbs
Richard Všianský edited this page Apr 2, 2019
·
15 revisions
Breadcrumbs show hierarchical way to the current page, not a history of user. Its logic is more clear and most of it is only in one Mixin, not scattered throughout the code.
A controller should include Breadcrumbs mixins:
include Mixins::BreadcrumbMixin
and then it has to define a new method:
def breadcrumbs_options
- which returns a hash with variables depended on the controller and its type:
{
:breadcrumbs => ...,
:include_record => ...,
:record_info => ...,
:record_title => ...,
}All controllers should contain:
{
:breadcrumbs => [
{ :title => ... , :url => ?, :key => ? }
]
}-
which sets a way in the main navigation menu:
-
:title- title of the breadcrumb, eg._('Cloud Providers)' -
:url- url, eg.controller_url
A breadcrumb can have also:
-
:key- using in tree views, key for the item, eg.root -
:action- additional action for using with the key, eg.accordion_select
All variables are optional.
:record_info => @ems
- some controllers use different variables to store information about a current item. Most of them are using
@record, which is a default variable. If not, then you have to manually set which variable is used.
:record_title => :key
- Method which stores a title of the variable set in the record_info (
:title = @ems.key)
Explorer controllers
:include_record => true
- when the title of the shown item is missing, e.g. in edit actions. Mostly used when trees do not contain all nodes.
Schema of breadcrumbs flow
