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