diff --git a/app/assets/images/merged/section_preview/section_full_left2.png b/app/assets/images/merged/section_preview/section_full_left.png similarity index 100% rename from app/assets/images/merged/section_preview/section_full_left2.png rename to app/assets/images/merged/section_preview/section_full_left.png diff --git a/app/assets/images/merged/section_preview/section_half_left.png b/app/assets/images/merged/section_preview/section_half_image.png similarity index 100% rename from app/assets/images/merged/section_preview/section_half_left.png rename to app/assets/images/merged/section_preview/section_half_image.png diff --git a/app/assets/images/merged/section_preview/section_half_right.png b/app/assets/images/merged/section_preview/section_half_right.png deleted file mode 100644 index 5eee23b..0000000 Binary files a/app/assets/images/merged/section_preview/section_half_right.png and /dev/null differ diff --git a/app/helpers/merged/merged_helper.rb b/app/helpers/merged/merged_helper.rb index b1327e7..c7557a5 100644 --- a/app/helpers/merged/merged_helper.rb +++ b/app/helpers/merged/merged_helper.rb @@ -19,6 +19,13 @@ module Merged end end + def order_option(section) + return {} unless section.has_option?("order") + puts "Option #{section.option('order')}" + return {} if section.option("order") == "left" + {class: "order-first"} + end + def button(text , url , color) link_to(url) do content_tag(:button , class: color + " " + button_classes ) do diff --git a/app/models/merged/style.rb b/app/models/merged/style.rb index f97f7e0..8f57635 100644 --- a/app/models/merged/style.rb +++ b/app/models/merged/style.rb @@ -32,9 +32,9 @@ module Merged option_defs = [] @content["options"].each do |name| option = Style.options[name] - raise "no option for #{name}:name.class" if option.blank? + raise "no option for #{name}:#{name.class}" if option.blank? option_defs << option - end + end if @content["options"] option_defs end diff --git a/app/views/merged/sections/show.html.haml b/app/views/merged/sections/show.html.haml index 994083a..110597a 100644 --- a/app/views/merged/sections/show.html.haml +++ b/app/views/merged/sections/show.html.haml @@ -59,4 +59,7 @@ = section_form( class: "mx-auto mt-8 mb-0 max-w space-y-4") do - @section.option_definitions.each do |option| =render "option_form_#{option.type}" , section: @section , option: option - = submit_button("Update") + -if @section.option_definitions.empty? + %p No options + -else + = submit_button("Update") diff --git a/app/views/merged/view/_section_full_left2.haml b/app/views/merged/view/_section_full_left.haml similarity index 100% rename from app/views/merged/view/_section_full_left2.haml rename to app/views/merged/view/_section_full_left.haml diff --git a/app/views/merged/view/_section_full_left1.haml b/app/views/merged/view/_section_full_left1.haml deleted file mode 100644 index fae3682..0000000 --- a/app/views/merged/view/_section_full_left1.haml +++ /dev/null @@ -1,13 +0,0 @@ -%section.overflow-hidden.bg-cover.bg-center.bg-no-repeat{style: bg(section)} - .p-8.md:p-12.lg:px-16.lg:py-24 - .max-w-lg.text-center.sm:text-left{:class => "bg-black/25"} - %h2.text-2xl.font-bold.text-white.sm:text-3xl.md:text-5xl - = section.header - %p.hidden.max-w-md.md:mt-6.md:block.md:text-lg.md:leading-relaxed{:class => "text-white/90"} - = section.text - -if section.has_option?("button_text") - .mt-4.sm:mt-8 - %a.inline-flex.items-center.rounded-full.bg-indigo-700.px-8.py-3.text-white.shadow-lg.transition.hover:bg-indigo-600.focus:outline-none.focus:ring{:href => section["button_link"]} - %span.text-sm.font-medium section.option("button_text") - %svg.ml-3.h-5.w-5{:fill => "none", :stroke => "currentColor", :viewbox => "0 0 24 24", :xmlns => "http://www.w3.org/2000/svg"} - %path{:d => "M17 8l4 4m0 0l-4 4m4-4H3", "stroke-linecap" => "round", "stroke-linejoin" => "round", "stroke-width" => "2"} diff --git a/app/views/merged/view/_section_half_left.haml b/app/views/merged/view/_section_half_image.haml similarity index 85% rename from app/views/merged/view/_section_half_left.haml rename to app/views/merged/view/_section_half_image.haml index e504b77..a2131f4 100644 --- a/app/views/merged/view/_section_half_left.haml +++ b/app/views/merged/view/_section_half_image.haml @@ -1,6 +1,6 @@ %section.overflow-hidden.sm:grid.sm:grid-cols-2 = image_for( section , "p-5 h-56 w-full object-cover sm:h-full") - .p-8.m-5.bg-cyan-100.md:p-12.lg:px-16.lg:py-24 + .p-8.m-5.bg-cyan-100.md:p-12.lg:px-16.lg:py-24{ order_option(section)} .mx-auto.max-w-xl.text-center.sm:text-left %h2.text-2xl.font-bold.text-gray-900.md:text-3xl = section.header diff --git a/app/views/merged/view/_section_half_right.haml b/app/views/merged/view/_section_half_right.haml deleted file mode 100644 index 2e726f5..0000000 --- a/app/views/merged/view/_section_half_right.haml +++ /dev/null @@ -1,11 +0,0 @@ -%section.overflow-hidden.sm:grid.sm:grid-cols-2 - .p-8.m-5.bg-cyan-100.md:p-12.lg:px-16.lg:py-24 - .mx-auto.max-w-xl.text-center.sm:text-left - %h2.text-2xl.font-bold.text-gray-900.md:text-3xl - = section.header - %p.hidden.text-gray-500.md:mt-4.md:block - = section.text - .mt-4.md:mt-8 - -if section.has_option?("button_text") - = render 'merged/view/elements/button' , section: section - = image_for( section , "p-5 h-56 w-full object-cover sm:h-full") diff --git a/config/styles.yaml b/config/styles.yaml index fe91341..fa82c60 100644 --- a/config/styles.yaml +++ b/config/styles.yaml @@ -14,16 +14,18 @@ sections: fields: - header - text -- template: section_half_right - header: Split section image right - text: Image right, header and text on the left. Optional button. +- template: section_half_image + header: Split section with image left or right + text: Image on one side, header and text on the other. + Order depends on order option. Optional button. fields: - header - text options: - button_link - button_text -- template: section_full_left2 + - order +- template: section_full_left header: Full image header, text left text: Large picture background with Header and text towards the left. Text is slightly shaded for readability @@ -32,12 +34,6 @@ sections: - text options: - fixed -- template: section_half_left - header: Split section image left - text: Image left, header and text on the right. Optional button. - fields: - - header - - text - template: section_spacer header: Spacer text: Just for extra padding @@ -56,6 +52,12 @@ options: during scrolling values: on off default: off + - name: order + desciption: + For two column layout determine order of sub-cards + Values of left and right usually refer to where the image is + values: left right + default: left - name: button_text desciption: Text for an optional button. Must also set button_link