Module: Card::Set::Type::BootswatchSkin::HtmlViews::HtmlFormat

Extended by:
AbstractFormat
Defined in:
platypus/tmp/set/gem-defaults/mod024-bootstrap/type/bootswatch_skin/html_views.rb

Instance Method Summary collapse

Instance Method Details

#current_skin?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/type/bootswatch_skin/html_views.rb', line 41

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

#customize_button(text: "Customize") ⇒ Object



45
46
47
48
49
50
51
52
53
54
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/type/bootswatch_skin/html_views.rb', line 45

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

#new_skin_path_args(new_name) ⇒ Object



35
36
37
38
39
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/type/bootswatch_skin/html_views.rb', line 35

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

#use_as_current_buttonObject



56
57
58
59
60
61
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/type/bootswatch_skin/html_views.rb', line 56

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_bottomObject



75
76
77
78
79
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/type/bootswatch_skin/html_views.rb', line 75

view :bar_bottom do
  wrap_with :code do
    render_core
  end
end

#view: bar_leftObject



63
64
65
66
67
68
69
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/type/bootswatch_skin/html_views.rb', line 63

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_rightObject



71
72
73
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/type/bootswatch_skin/html_views.rb', line 71

view :bar_right do
  # customize_button
end

#view: coreObject



29
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/type/bootswatch_skin/html_views.rb', line 29

view :core, template: :haml

#view: customize_buttonObject



31
32
33
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/type/bootswatch_skin/html_views.rb', line 31

view :customize_button, cache: :never do
  customize_button
end

#view: one_line_contentObject



25
26
27
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/type/bootswatch_skin/html_views.rb', line 25

view :one_line_content do
  ""
end