diff --git a/app/assets/images/merged/section_preview/section_text.png b/app/assets/images/merged/section_preview/section_text.png new file mode 100644 index 0000000..88a3d41 Binary files /dev/null and b/app/assets/images/merged/section_preview/section_text.png differ diff --git a/app/controllers/merged/pages_controller.rb b/app/controllers/merged/pages_controller.rb index b5226d8..441d2ac 100644 --- a/app/controllers/merged/pages_controller.rb +++ b/app/controllers/merged/pages_controller.rb @@ -5,6 +5,9 @@ module Merged def index @pages = Page.all + if(! params[:type].blank?) + @pages = @pages.where(type: params[:type]) + end @page_styles = PageStyle.all end @@ -22,7 +25,6 @@ module Merged options = params[:option] if options @page.option_definitions.each do |option| - puts "Option #{option.name}:#{options[option.name]}" @page.set_option(option.name, options[option.name]) end @page.edit_save(current_member.email) diff --git a/app/helpers/merged/options_helper.rb b/app/helpers/merged/options_helper.rb index 85a7b16..51d0c75 100644 --- a/app/helpers/merged/options_helper.rb +++ b/app/helpers/merged/options_helper.rb @@ -17,6 +17,7 @@ module Merged if( precision == "precise") return date.to_formatted_s(:short) + " " + date.year.to_s end + return Date.today if date.blank? if(date.day < 10) attr = "Beginning" elsif date.day < 20 diff --git a/app/views/merged/pages/index.haml b/app/views/merged/pages/index.haml index 589769c..da55d92 100644 --- a/app/views/merged/pages/index.haml +++ b/app/views/merged/pages/index.haml @@ -1,6 +1,8 @@ - content_for( :merged_menu ) do .text-xl.font-bold.text-gray-900 - All Pages + = link_to( "All" , merged.pages_path(type: '') , class: "p-2 px-4 border border-gray-200 font-bold rounded-lg hover:bg-sky-100 #{params[:type].blank? ? 'bg-blue-200':''}") + - @page_styles.each do |style| + = link_to( "Only #{style.type.capitalize}s" , merged.pages_path(type: style.type) , class: "p-2 px-4 border border-gray-200 font-bold rounded-lg hover:bg-sky-100 #{(params[:type] == style.type) ? 'bg-blue-200':''}") = render "layouts/merged_header" .overflow-hidden.overflow-x-auto.rounded-lg.border.border-gray-200.m-20 diff --git a/app/views/merged/view/_section_text.haml b/app/views/merged/view/_section_text.haml new file mode 100644 index 0000000..9406511 --- /dev/null +++ b/app/views/merged/view/_section_text.haml @@ -0,0 +1,9 @@ +%section{ options(section , :background , :margin)} + .px-4.py-16.mx-20{options(section , :text_align , :color)} + %h1.text-2xl.font-bold.tracking-tight.sm:text-4xl + = section.header + -if section.has_option?("subheader") + %h4.text-xl.mt-10.md:text-2xl + = section.option("subheader") + .prose.mt-4.text-lg.pt-10 + = markdown(section) diff --git a/config/merged/section_styles.yml b/config/merged/section_styles.yml index 7993ca0..be9d534 100644 --- a/config/merged/section_styles.yml +++ b/config/merged/section_styles.yml @@ -28,6 +28,18 @@ - item_align - button_link - button_text +- template: section_text + header: Text only section for longer passages of text, mostly news + text: Text may be markdown + fields: + - header + - text + options: + - background + - color + - margin + - subheader + - text_align - template: section_half_image header: Split section with image left or right text: Image on one side, header and text on the other. diff --git a/test/models/option_definition_test.rb b/test/models/option_definition_test.rb index 6d5c366..ce1d584 100644 --- a/test/models/option_definition_test.rb +++ b/test/models/option_definition_test.rb @@ -11,7 +11,7 @@ module Merged assert_equal OptionDefinition.first.class , OptionDefinition end def test_there_options - assert_equal OptionDefinition.all.length , 19 + assert_equal OptionDefinition.all.length , 20 end def test_has_option_objects assert_equal first.class , OptionDefinition diff --git a/test/models/section_style_test.rb b/test/models/section_style_test.rb index 15d46e0..37e4cd7 100644 --- a/test/models/section_style_test.rb +++ b/test/models/section_style_test.rb @@ -12,7 +12,7 @@ module Merged assert spacer end def test_has_sections - assert_equal SectionStyle.all.length , 7 + assert_equal SectionStyle.all.length , 9 end def test_finds_section_by_template spacer = SectionStyle.find_by_template("section_spacer")