Sha256: e03ede5e2bcb67155958fce2bfb026ead589a4c5ea2ba7287a237e46a41d45d5

Contents?: true

Size: 768 Bytes

Versions: 2

Compression:

Stored size: 768 Bytes

Contents

# fix sites still using no-longer supported skins and layouts
class MigrateClassicSkinsToBootstrap < ActiveRecord::Migration[5.2]
  UNSUPPORTED_SKINS = %w[
    classic_skin
    customized_classic_skin
    classic_bootstrap_skin
    simple_skin
    simple_bootstrap_skin
  ].freeze

  DEFAULT_SKIN = "yeti skin".freeze

  UNSUPPORTED_LAYOUT = "classic_layout".freeze

  DEFAULT_LAYOUT = "Default Layout".freeze

  def change
    style_rule = Card[:all, :style]
    if style_rule.item_names.first.key.in? UNSUPPORTED_SKINS
      style_rule.update_attributes! content: DEFAULT_SKIN
    end

    layout_rule = Card[:all, :layout]
    return unless layout_rule.item_names.first.key == UNSUPPORTED_LAYOUT
    layout_rule.update_attributes! content: DEFAULT_LAYOUT
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
card-1.96.7 mod/bootstrap/db/migrate_core_cards/data/20181108181219_migrate_classic_skins_to_bootstrap.rb
card-1.96.6 mod/bootstrap/db/migrate_core_cards/data/20181108181219_migrate_classic_skins_to_bootstrap.rb