Module: Microservice::BreadcrumbsHelper
- Defined in:
- app/helpers/microservice/breadcrumbs_helper.rb
Instance Method Summary collapse
- #render_breadcrumb(*args) ⇒ Object
- #render_breadcrumb_edit(entity) ⇒ Object
- #render_breadcrumb_index(entity_class) ⇒ Object
- #render_breadcrumb_new(entity) ⇒ Object
- #render_breadcrumb_show(entity) ⇒ Object
- #render_entity_breadcrumb ⇒ Object
Instance Method Details
#render_breadcrumb(*args) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/helpers/microservice/breadcrumbs_helper.rb', line 4 def (*args) flatten_args = args.flatten.compact content_tag :div, class: 'ui huge breadcrumb' do flatten_args.map.with_index do |element, idx| if flatten_args.size == idx + 1 content_tag(:span, element.html_safe, class: 'section active') else content_tag(:span, element.html_safe, class: 'section') + content_tag(:i, '', class: 'right chevron icon divider') end end.join.html_safe end end |
#render_breadcrumb_edit(entity) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'app/helpers/microservice/breadcrumbs_helper.rb', line 74 def (entity) links = [home_link(entity.namespace)] if @parent_entity links << link_to_entity(@parent_entity.class, :index, no_icon: true) links << link_to_entity(@parent_entity, :show, no_icon: true) end links << link_to_entity(entity.class, :index, no_icon: true) links << link_to_entity(entity, :edit, no_icon: true) links end |
#render_breadcrumb_index(entity_class) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/helpers/microservice/breadcrumbs_helper.rb', line 33 def (entity_class) links = [home_link(entity_class.namespace)] if @parent_entity links << link_to_entity(@parent_entity.class, :index, no_icon: true) links << link_to_entity(@parent_entity, :show, no_icon: true) end links << link_to_entity(entity_class, :index, no_icon: true) links end |
#render_breadcrumb_new(entity) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'app/helpers/microservice/breadcrumbs_helper.rb', line 60 def (entity) links = [home_link(entity.namespace)] if @parent_entity links << link_to_entity(@parent_entity.class, :index, no_icon: true) links << link_to_entity(@parent_entity, :show, no_icon: true) end links << link_to_entity(entity.class, :index, no_icon: true) links << link_to_entity(entity.class, :new, no_icon: true) links end |
#render_breadcrumb_show(entity) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/helpers/microservice/breadcrumbs_helper.rb', line 46 def (entity) links = [home_link(entity.namespace)] if @parent_entity links << link_to_entity(@parent_entity.class, :index, no_icon: true) links << link_to_entity(@parent_entity, :show, no_icon: true) end links << link_to_entity(entity.class, :index, no_icon: true) links << link_to_entity(entity, :show, no_icon: true) links end |
#render_entity_breadcrumb ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/helpers/microservice/breadcrumbs_helper.rb', line 18 def if @entity case action_name when 'show' @entity when 'new', 'create' @entity when 'edit', 'update' @entity end elsif controller.entity_class controller.entity_class end end |