Sha256: 7196baaef91f60cb8124e75170cca0e78f64f13081b8d1110cf38c96a2225d42

Contents?: true

Size: 1.02 KB

Versions: 12

Compression:

Stored size: 1.02 KB

Contents

# -*- encoding : utf-8 -*-

require_relative "lib/skin"

class AddTypeBootswatchSkin < Cardio::Migration::Core
  STYLE_INPUT_SEARCH = <<-JSON.strip_heredoc
    {"type": {"codename": ["in", "skin", "bootswatch_skin", "customized_bootswatch_skin"]}, "sort": "name"}
  JSON
  def up
    ensure_card "style: mods", codename: "style_mods",
                               type_id: Card::PointerID
    ensure_card "style: right sidebar", codename: "style_right_sidebar"
    Card::Cache.reset_all

    ensure_card "Bootswatch skin", type_id: Card::CardtypeID,
                                   codename: "bootswatch_skin"
    update_card! %i[style right options], content: STYLE_INPUT_SEARCH
    Card::Cache.reset_all
    change_type_of_skins
  end

  def change_type_of_skins
    Skin.themes.each do |theme_name|
      skin_name = Skin.new(theme_name).skin_name
      puts "updating #{skin_name}"
      card = Card.fetch(skin_name)
      next puts "card not found" unless card

      card.update! type_id: Card::BootswatchSkinID
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
card-mod-bootstrap-0.14.2 db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-mod-bootstrap-0.14.1 db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-mod-bootstrap-0.14.0 db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-mod-bootstrap-0.13.4 db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-mod-bootstrap-0.13.3 db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-mod-bootstrap-0.13.2 db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-mod-bootstrap-0.13.1 db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-mod-bootstrap-0.13.0 db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-mod-bootstrap-0.11.7 db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-mod-bootstrap-0.12.0 db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-mod-bootstrap-0.11.6 db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-mod-bootstrap-0.11.5 db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb