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: '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

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.



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 = 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:



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

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

#identifiersObject

Alias for Helpers#identifiers

Returns:

  • (Object)

    Helpers#identifiers

See Also:



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

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:



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

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