Class: Crm::StickyHeaderComponent

Inherits:
ApplicationComponent show all
Defined in:
app/components/crm/sticky_header_component.rb

Overview

Reusable sticky header for CRM show pages with scrollspy navigation.

Renders three rows:

  1. Breadcrumb trail
  2. Identifiers (left) + action buttons (right)
  3. 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: 'image', label: 'Preview', active: true) %>
<% header.with_nav_item(href: '#image-general', icon: 'circle-info', label: 'General') %>
<% header.with_nav_item(href: '#image-youtube', icon: 'youtube', icon_family: :brands, label: 'YouTube') %>
<% end %>

icon: is a canonical FA6+ name (e.g. 'circle-info') — the component
routes through IconHelper#fa_icon so every emission lands on the
project's bundled fa-sharp fa-{regular,solid} / fa-brands families.
Pass icon_family: (:solid / :brands / :custom) when you need
something other than the default sharp-regular.

Defined Under Namespace

Classes: NavItem

Delegated Instance Attributes collapse

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

Methods inherited from ApplicationComponent

#fetch_or_fallback

Constructor Details

#initialize(nav_id:, breadcrumbs: [], identifiers: {}, inactive: false) ⇒ StickyHeaderComponent

Returns a new instance of StickyHeaderComponent.



38
39
40
41
42
43
44
# File 'app/components/crm/sticky_header_component.rb', line 38

def initialize(nav_id:, breadcrumbs: [], identifiers: {}, inactive: false)
  super()
  @breadcrumbs = breadcrumbs
  @nav_id = nav_id
  @identifiers = identifiers
  @inactive = inactive
end

Instance Method Details

#clipboard_copyObject

Alias for Helpers#clipboard_copy

Returns:

  • (Object)

    Helpers#clipboard_copy

See Also:



30
# File 'app/components/crm/sticky_header_component.rb', line 30

delegate :clipboard_copy, :identifiers, :render_simple_drop_down, to: :helpers

#identifiersObject

Alias for Helpers#identifiers

Returns:

  • (Object)

    Helpers#identifiers

See Also:



30
# File 'app/components/crm/sticky_header_component.rb', line 30

delegate :clipboard_copy, :identifiers, :render_simple_drop_down, to: :helpers

#render_simple_drop_downObject

Alias for Helpers#render_simple_drop_down

Returns:

  • (Object)

    Helpers#render_simple_drop_down

See Also:



30
# File 'app/components/crm/sticky_header_component.rb', line 30

delegate :clipboard_copy, :identifiers, :render_simple_drop_down, to: :helpers