Sha256: 71146daa1dd3bc0350b29e8ddf8b7d85876c6a60172194903f3e16d1e8b87db6

Contents?: true

Size: 1.13 KB

Versions: 62

Compression:

Stored size: 1.13 KB

Contents

module Workarea
  class Metadata::HomePage < Metadata
    # Provides a default value for use as the html page title of
    # the home page using the top selling menus.
    #
    # @example
    #   Shop Men's, Women's, Shoes, and Accessories
    #
    # @return [String]
    #
    def title
      [
        I18n.t('workarea.metadata.shop'),
        top_menus.map(&:name).to_sentence
      ].join(' ')
    end

    # Provides a default value for use as the html content meta
    # tag for the home page using the top selling menus
    #
    # @example
    #   Shop online for a great selection including Men's, Women's,
    #   Shoes, and Accesories
    #
    # @return [String]
    #
    def description
      [
        I18n.t(
          'workarea.metadata.shop_selection',
          name: Workarea.config.site_name
        ),
        top_menus.map(&:name).to_sentence
      ].join(' ')
    end

    private

    def top_menus
      @top_menus ||= Navigation::Menu.all.sort_by do |menu|
        Metrics::MenuByDay
          .by_menu(menu.id)
          .since(Workarea.config.sorting_score_ttl.ago)
          .score(:orders)
      end.reverse
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.5.27 app/queries/workarea/metadata/home_page.rb
workarea-core-3.5.26 app/queries/workarea/metadata/home_page.rb
workarea-core-3.4.45 app/queries/workarea/metadata/home_page.rb
workarea-core-3.5.25 app/queries/workarea/metadata/home_page.rb
workarea-core-3.5.23 app/queries/workarea/metadata/home_page.rb
workarea-core-3.4.44 app/queries/workarea/metadata/home_page.rb
workarea-core-3.5.22 app/queries/workarea/metadata/home_page.rb
workarea-core-3.4.43 app/queries/workarea/metadata/home_page.rb
workarea-core-3.5.21 app/queries/workarea/metadata/home_page.rb
workarea-core-3.4.42 app/queries/workarea/metadata/home_page.rb
workarea-core-3.5.20 app/queries/workarea/metadata/home_page.rb
workarea-core-3.4.41 app/queries/workarea/metadata/home_page.rb
workarea-core-3.5.19 app/queries/workarea/metadata/home_page.rb
workarea-core-3.4.40 app/queries/workarea/metadata/home_page.rb
workarea-core-3.5.18 app/queries/workarea/metadata/home_page.rb
workarea-core-3.4.39 app/queries/workarea/metadata/home_page.rb
workarea-core-3.5.17 app/queries/workarea/metadata/home_page.rb
workarea-core-3.4.38 app/queries/workarea/metadata/home_page.rb
workarea-core-3.5.16 app/queries/workarea/metadata/home_page.rb
workarea-core-3.4.37 app/queries/workarea/metadata/home_page.rb