Sha256: 7a6786709a69fc4f1a9b82701057a7430655ab852163c2746d4a4200a283e5c9

Contents?: true

Size: 1.68 KB

Versions: 13

Compression:

Stored size: 1.68 KB

Contents

include_set Abstract::Media
# include_set Abstract::BsBadge

def new_customized_name
  nname = "#{name} customized"
  if Card.exist?(nname)
    nname = "#{nname} 1"
    nname.next! while Card.exist?(nname)
  end
  nname
end

format :html do
  before :box do
    voo.show! :box_middle
  end

  view :one_line_content do
    ""
  end

  view :core, template: :haml

  view :customize_button, cache: :never do
    customize_button
  end

  def new_skin_path_args new_name
    { name: new_name,
      type: :bootswatch_skin,
      fields: { parent: card.name } }
  end

  def current_skin?
    Card[:all, :style].item_keys.include? card.key
  end

  def customize_button text: "Customize"
    return "" if card.parent?
    # remove? perhaps we should be able to further customize a customized skin

    new_name = card.new_customized_name
    link_to_card new_name, text,
                 path: { action: :create,
                         card:  new_skin_path_args(new_name) },
                 class: "btn btn-sm btn-outline-primary me-2"
  end

  def use_as_current_button
    link_to_card card, "Use as current",
                 path: { action: :update,
                         card: { trigger: "use_as_current_skin" } },
                 class: "btn btn-sm btn-outline-primary me-2"
  end

  view :bar_left do
    class_up "card-title", "my-0 ms-2"
    class_up "media-left", "m-0"
    text_with_image size: :medium, title: "", text: _render_title,
                    media_opts: { class: "align-items-center" }
    # field_nest(:image, view: :core) + wrap_with(:h4, render(:title))
  end

  view :bar_right do
    # customize_button
  end

  view :bar_bottom do
    wrap_with :code do
      render_core
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
card-mod-bootstrap-0.18.1 set/type/bootswatch_skin/html_views.rb
card-mod-bootstrap-0.18.0 set/type/bootswatch_skin/html_views.rb
card-mod-bootstrap-0.17.0 set/type/bootswatch_skin/html_views.rb
card-mod-bootstrap-0.16.0 set/type/bootswatch_skin/html_views.rb
card-mod-bootstrap-0.15.6 set/type/bootswatch_skin/html_views.rb
card-mod-bootstrap-0.15.5 set/type/bootswatch_skin/html_views.rb
card-mod-bootstrap-0.15.4 set/type/bootswatch_skin/html_views.rb
card-mod-bootstrap-0.15.3 set/type/bootswatch_skin/html_views.rb
card-mod-bootstrap-0.15.1.2 set/type/bootswatch_skin/html_views.rb
card-mod-bootstrap-0.15.2.pre1 set/type/bootswatch_skin/html_views.rb
card-mod-bootstrap-0.15.1.1 set/type/bootswatch_skin/html_views.rb
card-mod-bootstrap-0.15.1 set/type/bootswatch_skin/html_views.rb
card-mod-bootstrap-0.15.0 set/type/bootswatch_skin/html_views.rb