30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/maglove/widgets/listitem.rb', line 30
def listitem_widget(options = {})
widget_block(Widgets::Listitem.new(options)) do |widget|
haml_tag :a, { class: "list-item list-item-#{widget.options[:size]}", href: (widget.options[:href] or "#"), style: widget.styles } do
if widget.options[:icon]
haml_tag :i, { class: "list-item-icon fa fa-#{widget.options[:icon]}" }
end
if widget.options[:image_source]
image_style = style_string(widget.options) do |sb|
sb.add(:background_image, widget.options[:image_source], "url(<%= value %>)")
end
haml_tag :div, { class: "list-item-image", style: image_style }
end
haml_tag :div, { class: "list-item-main" } do
haml_tag :div, { class: "list-item-title", style: "color: #{widget.options[:text_color]}" } do
haml_concat(widget.options[:title])
end
if widget.options[:subtitle]
haml_tag :div, { class: "list-item-subtitle", style: "color: #{widget.options[:text_color]}; font-style: #{widget.options[:subtitle_style]}" } do
haml_concat(widget.options[:subtitle])
end
end
end
if widget.options[:badge]
haml_tag :div, { class: "list-item-badge" } do
haml_tag :span, { style: "color: #{widget.options[:badge_color]}; background-color: #{widget.options[:badge_background]}; width: #{widget.options[:badge_width]};" } do
haml_concat(widget.options[:badge])
end
end
end
if widget.options[:href]
haml_tag :i, { class: "list-item-arrow fa fa-angle-right", style: "color: #{widget.options[:arrow_color]}" }
end
end
end
end
|