21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/maglove/widgets/paragraph.rb', line 21
def paragraph_widget(options = {}, contents = nil, &block)
if options.class.name == "String"
contents = options
options = {}
end
widget_block(Widgets::Paragraph.new(options)) do |widget|
haml_tag :div, style: style_string(widget.options, :margin, :padding), class: "paragraph #{widget.options[:style]} align-#{widget.options[:align]} size-#{widget.options[:size]}" do
unless widget.options[:drop_cap].empty?
haml_tag :span, class: "__dropcap", style: "color: #{widget.options[:drop_cap_color]};" do
haml_concat(widget.options[:drop_cap])
end
end
haml_tag :span, class: "paragraph-content _typeloft_editable _typeloft_widget_autoselect", style: style_string(widget.options, :line_height) do
haml_concat(contents) if contents
yield if block
end
end
end
end
|