fixing demo errors, rename template to style

This commit is contained in:
Torsten 2023-01-03 19:37:31 +02:00
parent 693d121c0f
commit 9bcd43215b
11 changed files with 14 additions and 16 deletions

View File

@ -45,7 +45,7 @@ module Merged
@card.option_definitions.each do |option| @card.option_definitions.each do |option|
@card.set_option(option.name, options[option.name]) @card.set_option(option.name, options[option.name])
end if options end if options
@card.save(current_member.email) @card.edit_save(current_member.email)
redirect_to section_cards_url(@card.section.id) , notice: "Updated #{@card.header}" redirect_to section_cards_url(@card.section.id) , notice: "Updated #{@card.header}"
end end

View File

@ -53,7 +53,7 @@ module Merged
end end
def destroy def destroy
@page.delete() @page.delete_save!
redirect_to pages_url, notice: "Page #{@page.name} was removed." redirect_to pages_url, notice: "Page #{@page.name} was removed."
end end

View File

@ -27,7 +27,7 @@ module Merged
end end
def destroy def destroy
@section.delete @section.delete_save!
redirect_to page_sections_url(@section.page.id) , notice: "Section #{@section.header} removed" redirect_to page_sections_url(@section.page.id) , notice: "Section #{@section.header} removed"
end end

View File

@ -5,7 +5,8 @@ module Merged
def rows( text ) def rows( text )
return 5 if text.blank? return 5 if text.blank?
text = text.text unless text.is_a?(String) text = text.text unless text.is_a?(String)
rows = (text.length / 60).to_i return 5 if text.blank?
rows = (text.length / 50).to_i
return 5 if rows < 5 return 5 if rows < 5
rows rows
end end

View File

@ -12,6 +12,7 @@ module Merged
end end
def zero def zero
[Page, Section, Card].each { |m| m.reload(true) }
@adds = [] @adds = []
@edits = [] @edits = []
@deletes = [] @deletes = []

View File

@ -41,9 +41,9 @@
=submit_button( "Delete" , true) =submit_button( "Delete" , true)
.basis-72 .basis-72
%h3.mt-4.text-lg.font-bold Template %h3.mt-4.text-lg.font-bold Style
= link_to(merged.section_select_template_path(section.id)) do = link_to(merged.section_select_template_path(section.id)) do
%p= section.template %p= section.template_style.header
= section_preview(section , class: "object-contain") = section_preview(section , class: "object-contain")
.basis-52.grow .basis-52.grow
%h3.mt-4.text-lg.font-bold Header %h3.mt-4.text-lg.font-bold Header

View File

@ -2,7 +2,7 @@
.text-xl.font-bold.text-gray-900 .text-xl.font-bold.text-gray-900
Page #{link_to @section.page.name, merged.page_sections_path(@section.page.id), class: "underline"} Page #{link_to @section.page.name, merged.page_sections_path(@section.page.id), class: "underline"}
.text-xl.text-gray-900 .text-xl.text-gray-900
Select Card Template for Section #{@section.index} - #{@section.header} Select Card Style for Section #{@section.index} - #{@section.header}
= render "layouts/merged_header" = render "layouts/merged_header"
.grid.grid-cols-4.gap-6.m-8 .grid.grid-cols-4.gap-6.m-8

View File

@ -2,7 +2,7 @@
.text-xl.font-bold.text-gray-900 .text-xl.font-bold.text-gray-900
Page #{link_to @section.page.name, merged.page_sections_path(@section.page.id), class: "underline"} Page #{link_to @section.page.name, merged.page_sections_path(@section.page.id), class: "underline"}
.text-xl.text-gray-900 .text-xl.text-gray-900
Select Template for Section #{@section.index} - #{@section.header} Select Style for Section #{@section.index} - #{@section.header}
= render "layouts/merged_header" = render "layouts/merged_header"

View File

@ -8,9 +8,9 @@
.flex.gap-4.m-8.flex-wrap .flex.gap-4.m-8.flex-wrap
.basis-96 .basis-96
%h3.mt-4.text-lg.font-bold Template #{@section.template} %h3.mt-4.text-lg.font-bold= @section.template_style.header
= section_preview(@section , class: "w-full object-contain my-4") = section_preview(@section , class: "w-full object-contain my-4")
= yellow_button( "Change Template" , merged.section_select_template_path(@section.id)) = yellow_button( "Change Style" , merged.section_select_template_path(@section.id))
= green_button( "New Section" , merged.new_page_section_path(@section.page.id , template: @section.template) ) = green_button( "New Section" , merged.new_page_section_path(@section.page.id , template: @section.template) )
.basis-full.mt-3 .basis-full.mt-3
Updated at: Updated at:
@ -48,10 +48,10 @@
- if( @section.has_cards? ) - if( @section.has_cards? )
.basis-full.h-0 .basis-full.h-0
.basis-96 .basis-96
.mx-3.text-lg.font-bold Card Template #{@section.card_template} .mx-3.text-lg.font-bold Card Style #{@section.card_template}
=card_preview(@section , class: "my-3") =card_preview(@section , class: "my-3")
%p.py-3 %p.py-3
=yellow_button("Change Card Template", merged.section_select_card_template_path(@section.id)) =yellow_button("Change Card Style", merged.section_select_card_template_path(@section.id))
.basis-96.grow .basis-96.grow
%h3.mt-4.text-lg.font-bold #{@section.cards.length} Cards %h3.mt-4.text-lg.font-bold #{@section.cards.length} Cards

View File

@ -10,9 +10,6 @@
= section.option("subheader") = section.option("subheader")
%p.prose.mt-8.md:block %p.prose.mt-8.md:block
= markdown(section) = markdown(section)
-if section.has_option?("text")
%p.prose.mt-8.md:block
= markdown section.option("text")
-if section.has_option?("button_text") -if section.has_option?("button_text")
.mt-8.md:mt-8 .mt-8.md:mt-8
= render 'merged/view/elements/button' , section: section = render 'merged/view/elements/button' , section: section

View File

@ -51,7 +51,6 @@
- background - background
- color - color
- subheader - subheader
- text
- text_align - text_align
- button_link - button_link
- button_text - button_text