Sha256: b3caedc2ae098744fe9994135a3e9adef08bb87a92eb862fa9bde0251b126745

Contents?: true

Size: 1.08 KB

Versions: 9

Compression:

Stored size: 1.08 KB

Contents

require "sass"
include_set Abstract::Machine

store_machine_output filetype: "css"

format do
  # turn off autodetection of uri's
  def chunk_list
    :nest_only
  end
end

format :html do
  HIDDEN_SKINS = %w[bootstrap_default_skin themeless_bootstrap_skin bootstrap_default_skin
                    classic_bootstrap_skin].freeze
  def default_item_view
    :bar
  end

  view :editor, template: :haml

  def themes
    card.rule_card(:options).item_cards
  end

  def selectable_themes
    themes.reject do |theme_card|
      theme_card.right&.codename == :stylesheets ||
        theme_card.key.in?(HIDDEN_SKINS)
    end
  end
end

event :customize_theme, :prepare_to_validate, on: :update, when: :customize_theme? do
  skin_name = free_skin_name
  add_subcard skin_name, type_id: CustomizedBootswatchSkinID
  self.content = "[[#{skin_name}]]"
end

def free_skin_name
  name = "#{@theme} skin customized"
  if Card.exist?(name)
    name = "#{name} 1"
    name.next! while Card.exist?(name)
  end
  name
end

def customize_theme?
  Env.params[:customize].present? && (@theme = Env.params[:theme]).present?
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
card-1.96.8 mod/settings/set/right/style.rb
card-1.96.7 mod/settings/set/right/style.rb
card-1.96.6 mod/settings/set/right/style.rb
card-1.96.5 mod/settings/set/right/style.rb
card-1.96.4 mod/settings/set/right/style.rb
card-1.96.3 mod/settings/set/right/style.rb
card-1.96.2 mod/settings/set/right/style.rb
card-1.96.1 mod/settings/set/right/style.rb
card-1.96.0 mod/settings/set/right/style.rb