13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'app/controllers/concerns/controller/breadcrumbs_concern.rb', line 13
def breadcrumbs!
[].tap do |breadcrumbs|
breadcrumbs << { label: t('controller.breadcrumbs_concern.home'), url: send("itsf_backend_#{I18n.locale}").root_path, link_html_options: {}, li_html_options: {}}
if respond_to?(:current_engine, true) && current_engine.present?
breadcrumbs << { label: t("classes.#{current_engine.name.underscore}"), url: send("#{current_engine.engine_name}_#{I18n.locale}").root_path, link_html_options: {}, li_html_options: {} }
end
if respond_to?(:resource_class, true)
breadcrumbs << { label: resource_class.model_name.human(count: :other), url: url_for(action: :index), link_html_options: {}, li_html_options: {} }
end
if @resource.present? && @resource.persisted?
breadcrumbs << { label: @resource.try_all(*Itsf::Backend.resource_title_methods), url: url_for(@resource), link_html_options: {}, li_html_options: {} }
end
if respond_to?(:service_class, true)
breadcrumbs << { label: t("classes.#{service_class.name.underscore}"), url: url_for(action: :index), link_html_options: {}, li_html_options: {} }
end
if %w(new create edit update invoke call).include?(action_name)
breadcrumbs << { label: t("controller.breadcrumbs_concern.#{action_name}"), url: '#', link_html_options: {}, li_html_options: {} }
end
if params[:page].present?
breadcrumbs << { label: t('controller.breadcrumbs_concern.page', page_number: params[:page]), url: '#', link_html_options: {}, li_html_options: {} }
end
breadcrumbs.last[:li_html_options][:class] = 'active'
end
end
|