diff --git a/app/helpers/merged/options_helper.rb b/app/helpers/merged/options_helper.rb index 37a735f..6c43175 100644 --- a/app/helpers/merged/options_helper.rb +++ b/app/helpers/merged/options_helper.rb @@ -18,7 +18,7 @@ module Merged {class: clazz} end - def align_option(section , clazz = "") + def text_align_option(section , clazz = "") if section.has_option?("align") # text-center , text-left , text-right , leave comment for tailwind clazz += " text-#{section.option('align')}" diff --git a/app/views/merged/view/_section_full_up.haml b/app/views/merged/view/_section_full_up.haml index 7b6a763..2755908 100644 --- a/app/views/merged/view/_section_full_up.haml +++ b/app/views/merged/view/_section_full_up.haml @@ -1,6 +1,6 @@ .flex.flex-col{ options(section , :background , :color , :margin)} .flex.items-center.justify-center.flex-1 - .max-w-prose.px-4.py-16.mx-auto.text-center{options(section , :align , :color)} + .max-w-prose.px-4.py-16.mx-auto.text-center{options(section , :text_align , :color)} %h1.text-2xl.font-bold.tracking-tight.sm:text-4xl = section.header -if section.has_option?("subheader") diff --git a/app/views/merged/view/_section_half_image.haml b/app/views/merged/view/_section_half_image.haml index 382d68c..c151c9b 100644 --- a/app/views/merged/view/_section_half_image.haml +++ b/app/views/merged/view/_section_half_image.haml @@ -2,7 +2,7 @@ %div{ order_option(section)} = image_for( section , "h-56 w-full object-cover sm:h-full") .p-8.md:p-12.lg:px-16.lg:py-24{ background_option(section)} - .mx-auto.max-w-xl{options(section , :align , :color)} + .mx-auto.max-w-xl{options(section , :text_align , :color)} %h2.mt-12.text-2xl.font-bold.md:text-4xl = section.header -if section.has_option?("subheader") diff --git a/app/views/merged/view/cards/_card_full_image.haml b/app/views/merged/view/cards/_card_full_image.haml index 393d20e..6591a39 100644 --- a/app/views/merged/view/cards/_card_full_image.haml +++ b/app/views/merged/view/cards/_card_full_image.haml @@ -1,7 +1,7 @@ .group.m-8.overflow-hidden.relative.flex.h-96.items-end = image_for( card , "absolute inset-0 h-full w-full object-cover hover:scale-110 ease-in duration-700") - .relative.w-full.m-2.p-4.tracking-widest{align_option(card ,"sm:w-1/2")} - %div.transition-colors.group-hover:bg-black.group-hover:text-white{options(card , :align , :color , :background)} + .relative.w-full.m-2.p-4.tracking-widest{text_align_option(card ,"sm:w-1/2")} + %div.transition-colors.group-hover:bg-black.group-hover:text-white{options(card , :text_align , :color , :background)} .relative.w-full.m-2.p-4 %h3.text-lg = card.header diff --git a/app/views/merged/view/cards/_card_gap_square.haml b/app/views/merged/view/cards/_card_gap_square.haml index 45acd11..bdea508 100644 --- a/app/views/merged/view/cards/_card_gap_square.haml +++ b/app/views/merged/view/cards/_card_gap_square.haml @@ -1,7 +1,7 @@ .grid.grid-cols-1.gap-16.m-16 %div{ order_option(card)} = image_for( card , "h-70 w-full object-cover grid") - %div.grid.h-70{options(card , :align , :color , :background )} + %div.grid.h-70{options(card , :text_align , :color , :background )} %h3.p-4.mt-10.text-3xl.font-bold= card.header -if card.has_option?("subheader") %h4.p-4.text-xl= card.option("subheader") diff --git a/app/views/merged/view/cards/_card_normal_round.haml b/app/views/merged/view/cards/_card_normal_round.haml index f211217..761a92b 100644 --- a/app/views/merged/view/cards/_card_normal_round.haml +++ b/app/views/merged/view/cards/_card_normal_round.haml @@ -1,7 +1,7 @@ .fex.flex-col.overflow-hidden.rounded-lg.border.border-gray-100.shadow-sm.m-10 = image_for( card , class: "object-fill") - %h3.p-5.text-2xl.bg-gray-100.text-black.font-bold{ align_option(card)}= card.header + %h3.p-5.text-2xl.bg-gray-100.text-black.font-bold{ text_align_option(card)}= card.header %div.h-full{background_option(card)} - .p-5{options(card , :align , :color)} + .p-5{options(card , :text_align , :color)} %p.m-2.text-sm.leading-relaxed.line-clamp-3 = markdown(card) diff --git a/app/views/merged/view/cards/_card_normal_square.haml b/app/views/merged/view/cards/_card_normal_square.haml index 25a7183..3a9fc8e 100644 --- a/app/views/merged/view/cards/_card_normal_square.haml +++ b/app/views/merged/view/cards/_card_normal_square.haml @@ -1,6 +1,6 @@ .m-10{background_option(card)} = image_for( card , "h-96 w-full object-cover") - .m-6{options(card , :align , :color)} + .m-6{options(card , :text_align , :color)} %h3.p-4.text-2xl.font-bold= card.header -if card.has_option?("subheader") %h4.p-4.text-xl= card.option("subheader") diff --git a/config/merged/card_styles.yml b/config/merged/card_styles.yml index 6d276ac..074fa9d 100644 --- a/config/merged/card_styles.yml +++ b/config/merged/card_styles.yml @@ -8,7 +8,7 @@ options: - background - color - - align + - text_align - template: card_gap_square header: Narrow card with up down section text: Smaller image, large margins, possible subheader @@ -20,7 +20,7 @@ - background - color - order - - align + - text_align - subheader - template: card_normal_square header: Standard card with square image @@ -31,7 +31,7 @@ options: - background - color - - align + - text_align - subheader - template: card_normal_round header: Standard card with square image @@ -42,7 +42,7 @@ options: - background - color - - align + - text_align - template: form_field header: A single field in a form text: The header is the Name of the field, the description diff --git a/config/merged/option_definitions.yml b/config/merged/option_definitions.yml index 80e29d8..ec35a91 100644 --- a/config/merged/option_definitions.yml +++ b/config/merged/option_definitions.yml @@ -27,7 +27,7 @@ :values: none black_25 white_25 light_red_25 light_blue_25 solid_blue_25 solid_red_25 :default: none :id: 5 -- :name: align +- :name: text_align :description: Align text of children. Normal Word meaning :values: left center right :default: left @@ -87,3 +87,9 @@ :values: FormHandler :default: FormHandler :id: 16 +- :name: item_align + :description: Alignment of actual children. Usually some kind of boxes. + Does not affect text, see text_align + :values: left center right + :default: left + :id: 17 diff --git a/config/merged/section_styles.yml b/config/merged/section_styles.yml index 6835013..a9efc13 100644 --- a/config/merged/section_styles.yml +++ b/config/merged/section_styles.yml @@ -37,13 +37,13 @@ - color - subheader - text - - align + - text_align - button_link - button_text - template: section_full_image header: Full image header with adjustable text text: Large picture background with Header and text on top. - Adjustable alignment (left, center, right). + Adjustable text text alignment (left, center, right). Text may be slightly shaded for readability, text color can be changed too. fields: @@ -52,12 +52,12 @@ options: - fixed - color - - align + - text_align - shade_color - template: section_large_image header: Two third image header with adjustable text text: Large picture background with Header and text offset. - Adjustable alignment (left, center, right). + Adjustable text alignment (left, center, right). Text section may have background color. Text color can be changed too fields: diff --git a/spec/models/merged/option_definition_spec.rb b/spec/models/merged/option_definition_spec.rb index f526f8d..bd9d623 100644 --- a/spec/models/merged/option_definition_spec.rb +++ b/spec/models/merged/option_definition_spec.rb @@ -8,7 +8,7 @@ module Merged expect(OptionDefinition.first.class).to be OptionDefinition end it "there are options" do - expect(OptionDefinition.all.length).to be 16 + expect(OptionDefinition.all.length).to be 17 end it "has option objects" do expect(first.class).to be OptionDefinition