From 14e3564fa4b506f97edd3b71e81150e7b212c032 Mon Sep 17 00:00:00 2001 From: Torsten Date: Thu, 5 Jan 2023 17:47:50 +0200 Subject: [PATCH] make card section work without header and text --- app/helpers/merged/options_helper.rb | 4 ++++ app/views/merged/view/_section_cards.haml | 16 +++++++++++----- config/merged/section_styles.yml | 1 + 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/helpers/merged/options_helper.rb b/app/helpers/merged/options_helper.rb index 70ea604..7ebef5d 100644 --- a/app/helpers/merged/options_helper.rb +++ b/app/helpers/merged/options_helper.rb @@ -117,6 +117,10 @@ module Merged columns = "grid-cols-1 md:grid-cols-2 lg:grid-cols-3" when "4" columns = "grid-cols-1 md:grid-cols-2 lg:grid-cols-4" + when "5" + columns = "grid-cols-1 md:grid-cols-3 lg:grid-cols-5" + when "6" + columns = "grid-cols-2 md:grid-cols-4 lg:grid-cols-6" else # two columns = "grid-cols-1 md:grid-cols-2" end diff --git a/app/views/merged/view/_section_cards.haml b/app/views/merged/view/_section_cards.haml index ebffa3d..b8956d7 100644 --- a/app/views/merged/view/_section_cards.haml +++ b/app/views/merged/view/_section_cards.haml @@ -1,10 +1,16 @@ %section.m-5.md:m-12.lg:m-20{ options(section , :background , :color)} .flex.justify-center - .max-w-prose.px-4.py-16{ options(section , :text_align)} - %h1.text-2xl.font-bold.tracking-tight.sm:text-4xl - = section.header - .mt-4.text-lg.pt-10{ prose_classes } - = markdown(section) + - unless section.header.blank? and section.text.blank? + .max-w-prose.px-4.py-16{ options(section , :text_align)} + - unless section.header.blank? + %h1.text-2xl.font-bold.tracking-tight.sm:text-4xl + = section.header + - if section.has_option?("subheader") + %h2.text-xl.pt-10.font-bold.tracking-tight.sm:text-2xl + = section.option("subheader") + - unless section.text.blank? + .text-lg.pt-10{ prose_classes } + = markdown(section) - template = "merged/view/cards/" + section.card_template .grid{ column_option(section)} - section.cards.each do |card| diff --git a/config/merged/section_styles.yml b/config/merged/section_styles.yml index 92e38b5..0c22843 100644 --- a/config/merged/section_styles.yml +++ b/config/merged/section_styles.yml @@ -10,6 +10,7 @@ options: - background - columns + - subheader - color - text_align - template: section_full_up