Class: Maglove::Widget::LegacyCard

Inherits:
V1
  • Object
show all
Defined in:
lib/maglove/widget/card.rb

Instance Attribute Summary

Attributes inherited from Base

#options, #scope

Instance Method Summary collapse

Methods inherited from V1

#drop_container, #widget_options

Methods inherited from Base

#initialize, #style_string, #widget_options

Constructor Details

This class inherits a constructor from Maglove::Widget::Base

Instance Method Details

#defaultsObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/maglove/widget/card.rb', line 14

def defaults
  {
    background_color: "#fff",
    margin_bottom: "10px",
    border_radius: "2px",
    title: "Card Title",
    subtitle: "This is the card subtitle",
    title_heading_type: "h2",
    subtitle_heading_type: "h4",
    style:""
  }
end

#identifierObject



10
11
12
# File 'lib/maglove/widget/card.rb', line 10

def identifier
  "card"
end

#render(&block) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/maglove/widget/card.rb', line 27

def render(&block)
  super do
    haml_tag :div, class: "card #{options[:style]}", style: style_string(options, :margin_bottom, :background_color, :border_radius) do
      haml_tag :a, href: (options[:href] or "#") do
        haml_tag options[:title_heading_type], class: "card-title" do
          haml_concat(options[:title])
        end
        if options[:subtitle] != ""
          haml_tag options[:subtitle_heading_type], class: "card-subtitle" do
            haml_concat(options[:subtitle])
          end
        end
        haml_tag :hr, class: "solid dark-maroon"
        yield self if block_given?
      end
    end
  end
end