Class: Crm::StickyHeaderComponent
- Inherits:
-
ApplicationComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- Crm::StickyHeaderComponent
- Defined in:
- app/components/crm/sticky_header_component.rb
Overview
Reusable sticky header for CRM show pages with scrollspy navigation.
Renders three rows:
- Breadcrumb trail
- Identifiers (left) + action buttons (right)
- Horizontally scrollable nav pills
Usage:
<%= render Crm::StickyHeaderComponent.new(
breadcrumbs: [{ title: 'Images', href: images_path }, { title: @image.slug }],
identifiers: { 'ID' => @image.id, 'Slug' => @image.slug },
nav_id: 'image-sections-nav'
) do |header| %>
<% header.with_action do %>
<%= render_combo_drop_down image_command_options(@image), main_link_class: 'btn-outline-primary btn-sm' %>
<% end %>
<% header.with_nav_item(href: '#image-preview', icon: 'fa-regular fa-image', label: 'Preview', active: true) %>
<% header.with_nav_item(href: '#image-general', icon: 'fa-regular fa-circle-info', label: 'General') %>
<% end %>
Defined Under Namespace
Classes: NavItem
Delegated Instance Attributes collapse
-
#clipboard_copy ⇒ Object
Alias for Helpers#clipboard_copy.
-
#identifiers ⇒ Object
Alias for Helpers#identifiers.
-
#render_simple_drop_down ⇒ Object
Alias for Helpers#render_simple_drop_down.
Methods inherited from ApplicationComponent
#cms_link, #image_asset_tag, #image_tag, #number_to_currency, #number_with_delimiter, #post_path, #post_url, #strip_tags
Instance Method Summary collapse
-
#initialize(nav_id:, breadcrumbs: [], identifiers: {}, inactive: false) ⇒ StickyHeaderComponent
constructor
A new instance of StickyHeaderComponent.
Methods inherited from ApplicationComponent
Constructor Details
#initialize(nav_id:, breadcrumbs: [], identifiers: {}, inactive: false) ⇒ StickyHeaderComponent
Returns a new instance of StickyHeaderComponent.
31 32 33 34 35 36 37 |
# File 'app/components/crm/sticky_header_component.rb', line 31 def initialize(nav_id:, breadcrumbs: [], identifiers: {}, inactive: false) super() @breadcrumbs = @nav_id = nav_id @identifiers = identifiers @inactive = inactive end |
Instance Method Details
#clipboard_copy ⇒ Object
Alias for Helpers#clipboard_copy
23 |
# File 'app/components/crm/sticky_header_component.rb', line 23 delegate :clipboard_copy, :identifiers, :render_simple_drop_down, to: :helpers |
#identifiers ⇒ Object
Alias for Helpers#identifiers
23 |
# File 'app/components/crm/sticky_header_component.rb', line 23 delegate :clipboard_copy, :identifiers, :render_simple_drop_down, to: :helpers |
#render_simple_drop_down ⇒ Object
Alias for Helpers#render_simple_drop_down
23 |
# File 'app/components/crm/sticky_header_component.rb', line 23 delegate :clipboard_copy, :identifiers, :render_simple_drop_down, to: :helpers |