Sha256: 1742aa1697e86c9754ec5d884467fe5b962e84d49fec4c7d2e1747601324504b

Contents?: true

Size: 856 Bytes

Versions: 62

Compression:

Stored size: 856 Bytes

Contents

module Workarea
  class BrowsingPagesSeeds
    def perform
      puts 'Adding browsing pages...'

      Workarea.config.default_seeds_taxonomy.each do |top_level, children|
        page = Content::Page.create!(name: top_level, tag_list: 'browsing')
        content = Content.for(page)

        children.each do |category|
          content.blocks.build(
            type: :category_summary,
            data: { category: Catalog::Category.find_by(name: category).id }
          )
        end

        content.save!
      end
    end

    # TODO remove in v3.5 as this is no longer used
    def find_unique_name
      department = Faker::Commerce.department(1)
      pages = Content::Page.all.to_a

      until pages.select { |p| p.name == department }.empty?
        department = Faker::Commerce.department(1)
      end

      department
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

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