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.15 app/seeds/workarea/browsing_pages_seeds.rb
workarea-core-3.4.36 app/seeds/workarea/browsing_pages_seeds.rb
workarea-core-3.5.14 app/seeds/workarea/browsing_pages_seeds.rb
workarea-core-3.4.35 app/seeds/workarea/browsing_pages_seeds.rb
workarea-core-3.5.13 app/seeds/workarea/browsing_pages_seeds.rb
workarea-core-3.4.34 app/seeds/workarea/browsing_pages_seeds.rb
workarea-core-3.5.12 app/seeds/workarea/browsing_pages_seeds.rb
workarea-core-3.4.33 app/seeds/workarea/browsing_pages_seeds.rb
workarea-core-3.5.11 app/seeds/workarea/browsing_pages_seeds.rb
workarea-core-3.5.10 app/seeds/workarea/browsing_pages_seeds.rb
workarea-core-3.4.32 app/seeds/workarea/browsing_pages_seeds.rb
workarea-core-3.5.9 app/seeds/workarea/browsing_pages_seeds.rb
workarea-core-3.4.31 app/seeds/workarea/browsing_pages_seeds.rb
workarea-core-3.5.8 app/seeds/workarea/browsing_pages_seeds.rb
workarea-core-3.4.30 app/seeds/workarea/browsing_pages_seeds.rb
workarea-core-3.5.7 app/seeds/workarea/browsing_pages_seeds.rb
workarea-core-3.4.29 app/seeds/workarea/browsing_pages_seeds.rb
workarea-core-3.5.6 app/seeds/workarea/browsing_pages_seeds.rb
workarea-core-3.4.28 app/seeds/workarea/browsing_pages_seeds.rb
workarea-core-3.5.5 app/seeds/workarea/browsing_pages_seeds.rb