class Maglove::Widget::LegacyListitem
Public Instance Methods
defaults()
click to toggle source
# File lib/maglove/widget/listitem.rb, line 32 def defaults { background_color: "#18B545", title_color: "#111111", subtitle_color: "#111111", arrow_color: "#FFFFFF", size: "md", badge: nil, badge_color: "#FFFFFF", badge_background: "rgba(255, 255, 255, 0.25)", badge_width: "24px", title: "Title", subtitle: nil, subtitle_style: "normal", image_source: nil } end
identifier()
click to toggle source
# File lib/maglove/widget/listitem.rb, line 28 def identifier "listitem" end
render(&block)
click to toggle source
Calls superclass method
Maglove::Widget::V1#render
# File lib/maglove/widget/listitem.rb, line 50 def render(&block) super do haml_tag :a, { class: "list-item list-item-#{options[:size]}", href: (options[:href] or "#"), style: style_string(options, :border_color, :background_color) } do if options[:icon] haml_tag :i, { class: "list-item-icon fa fa-#{options[:icon]}" } end if options[:image_source] image_style = style_string(options) do |sb| sb.add(:background_image, 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: #{options[:title_color]}" } do haml_concat(options[:title]) end if options[:subtitle] haml_tag :div, { class: "list-item-subtitle", style: "color: #{options[:subtitle_color]}; font-style: #{options[:subtitle_style]}" } do haml_concat(options[:subtitle]) end end end if options[:badge] haml_tag :div, { class: "list-item-badge" } do haml_tag :span, { style: "color: #{options[:badge_color]}; background-color: #{options[:badge_background]}; width: #{options[:badge_width]};" } do haml_concat(options[:badge]) end end end if options[:href] haml_tag :i, { class: "list-item-arrow fa fa-angle-right", style: "color: #{options[:arrow_color]}" } end end end end