Class: Crm::SeoDashboardComponent

Inherits:
ApplicationComponent show all
Includes:
ActionView::Helpers::NumberHelper
Defined in:
app/components/crm/seo_dashboard_component.rb

Overview

Displays SEO metrics and analysis for a SiteMap record.
Reusable component for blog posts, products, and other content types.

Examples:

Basic usage

render Crm::SeoDashboardComponent.new(site_map: @post.site_map)

With analysis trigger

render Crm::SeoDashboardComponent.new(
  site_map: @product.site_map,
  show_analyze_button: true
)

Instance Method Summary collapse

Methods inherited from ApplicationComponent

#cms_link, #fetch_or_fallback, #image_asset_tag, #image_tag, #number_to_currency, #number_with_delimiter, #post_path, #post_url, #strip_tags

Constructor Details

#initialize(site_map:, show_analyze_button: true) ⇒ SeoDashboardComponent

Returns a new instance of SeoDashboardComponent.

Parameters:

  • site_map (SiteMap)

    the SiteMap record whose SEO data is displayed

  • show_analyze_button (Boolean) (defaults to: true)

    whether to render the analysis trigger button



21
22
23
24
25
# File 'app/components/crm/seo_dashboard_component.rb', line 21

def initialize(site_map:, show_analyze_button: true)
  super()
  @site_map = site_map
  @show_analyze_button = show_analyze_button
end

Instance Method Details

#render?Boolean

Whether the component should render at all.

Returns:

  • (Boolean)

    true when a SiteMap record is present



29
30
31
# File 'app/components/crm/seo_dashboard_component.rb', line 29

def render?
  @site_map.present?
end