unified option handling more
This commit is contained in:
parent
b606caf2b8
commit
f32e6c105c
@ -20,6 +20,8 @@ module Merged
|
||||
text
|
||||
end
|
||||
end
|
||||
|
||||
def button_classes
|
||||
"mr-3 inline-block rounded-lg px-4 py-3 text-md font-medium text-white"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -13,49 +13,47 @@ module Merged
|
||||
|
||||
def order_option(section , clazz = "")
|
||||
if section.has_option?("order")
|
||||
option = section.option('order')
|
||||
puts "Order #{option}"
|
||||
clazz += " order-last" if option == "right"
|
||||
clazz += " order-last" if section.option('order') == "right"
|
||||
end
|
||||
{class: clazz}
|
||||
end
|
||||
|
||||
def align_option(section)
|
||||
return {} unless section.has_option?("align")
|
||||
option = section.option('align')
|
||||
puts "align #{option}"
|
||||
def align_option(section , clazz = "")
|
||||
if section.has_option?("align")
|
||||
# text-center , text-left , text-right , leave comment for tailwind
|
||||
{class: "text-#{option}"}
|
||||
clazz += " text-#{section.option('align')}"
|
||||
end
|
||||
{class: clazz}
|
||||
end
|
||||
|
||||
def background_option(section)
|
||||
return {} unless section.has_option?("background")
|
||||
def background_option(section , clazz = "")
|
||||
if section.has_option?("background")
|
||||
option = section.option('background')
|
||||
puts "Background #{option}"
|
||||
background = bg_for(option)
|
||||
background += " text-white" if option.include?("solid")
|
||||
{class: background}
|
||||
clazz += bg_for(option)
|
||||
clazz += " text-white" if option.include?("solid")
|
||||
end
|
||||
{class: clazz}
|
||||
end
|
||||
|
||||
def margin_option(section)
|
||||
return {} unless section.has_option?("margin")
|
||||
option = section.option('margin')
|
||||
puts "Margin #{option}"
|
||||
{class: margin_for(option)}
|
||||
def margin_option(section , clazz = "")
|
||||
if section.has_option?("margin")
|
||||
clazz += margin_for(section.option("margin"))
|
||||
end
|
||||
{class: clazz}
|
||||
end
|
||||
|
||||
def color_option(section)
|
||||
return {} unless section.has_option?("color")
|
||||
option = section.option('color')
|
||||
puts "Text color #{option} , #{color_for(option)}"
|
||||
{class: color_for(option) }
|
||||
def color_option(section , clazz = "")
|
||||
if section.has_option?("color")
|
||||
clazz += color_for(section.option("color"))
|
||||
end
|
||||
{class: clazz }
|
||||
end
|
||||
|
||||
def shade_option(section)
|
||||
return {} unless section.has_option?("shade_color")
|
||||
option = section.option('shade_color')
|
||||
puts "Shade color #{option} , #{shade_for(option)}"
|
||||
{class: shade_for(option) }
|
||||
if section.has_option?("shade_color")
|
||||
clazz += shade_for(section.option("shade_color"))
|
||||
end
|
||||
{class: clazz }
|
||||
end
|
||||
|
||||
def column_option(section)
|
||||
|
@ -1,6 +1,7 @@
|
||||
module Merged
|
||||
module ViewHelper
|
||||
include OptionsHelper
|
||||
include MergedHelper
|
||||
# section should be hash with at least 'template' key
|
||||
def find_template(section)
|
||||
"merged/view/" + section.template
|
||||
@ -33,9 +34,6 @@ module Merged
|
||||
end
|
||||
end
|
||||
end
|
||||
def button_classes
|
||||
"ml-3 inline-block rounded-lg px-4 py-3 text-md font-medium text-white"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -78,6 +78,10 @@ cards:
|
||||
fields:
|
||||
- header
|
||||
- text
|
||||
options:
|
||||
- background
|
||||
- color
|
||||
- align
|
||||
- template: card_normal_square
|
||||
header: Standard card with square image
|
||||
text: Image, header, text, normal stuff
|
||||
@ -117,7 +121,7 @@ options:
|
||||
desciption:
|
||||
Text colors. Don't use with solid background colors.
|
||||
Same colors as background available. Default none, meas as parent.
|
||||
values: none white light_blue light_gray solid_black solid_blue solid_red solid_indigo
|
||||
values: none white black light_blue light_gray solid_black solid_blue solid_red solid_indigo
|
||||
default: none
|
||||
- name: shade_color
|
||||
desciption:
|
||||
|
Loading…
Reference in New Issue
Block a user