Sha256: c311e276c7cd02738f492241d44c3f6915b80fa024622efc971a7b2e2db7dc0c

Contents?: true

Size: 1.12 KB

Versions: 20

Compression:

Stored size: 1.12 KB

Contents

require "sassc"
include_set Abstract::Machine

store_machine_output filetype: "css"

def ok_to_read
  true
end

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 :input, template: :haml

  def themes
    card.rule_card(:content_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

20 entries across 20 versions & 2 rubygems

Version Path
card-mod-style-0.13.4 set/right/style.rb
card-mod-style-0.13.3 set/right/style.rb
card-mod-style-0.13.2 set/right/style.rb
card-mod-style-0.13.1 set/right/style.rb
card-mod-style-0.13.0 set/right/style.rb
card-mod-style-0.11.7 set/right/style.rb
card-mod-style-0.12.0 set/right/style.rb
card-mod-style-0.11.6 set/right/style.rb
card-mod-style-0.11.5 set/right/style.rb
card-mod-style-0.11.4 set/right/style.rb
card-mod-style-0.11.3 set/right/style.rb
card-mod-style-0.11.2 set/right/style.rb
card-mod-style-0.11.1 set/right/style.rb
card-mod-style-0.11.0 set/right/style.rb
card-1.100.0 mod/settings/set/right/style.rb
card-1.99.6 mod/settings/set/right/style.rb
card-1.99.5 mod/settings/set/right/style.rb
card-1.99.4 mod/settings/set/right/style.rb
card-1.99.1 mod/settings/set/right/style.rb
card-1.99.0 mod/settings/set/right/style.rb