inclide card editors and clean up layout

This commit is contained in:
Torsten 2022-12-01 16:26:20 +02:00
parent 2363f24aef
commit 33ea800735
18 changed files with 21 additions and 67 deletions

View File

@ -1,9 +0,0 @@
.relative.block.border.border-gray-100
%h3.mt-4.text-lg.font-bold= key.upcase
%p
.font-bold Text
= value["text"]
.relative.block.border.border-gray-100
%p
.font-bold Link
= value["link"]

View File

@ -1,6 +0,0 @@
.relative.block.border.border-gray-100
%h3.mt-4.text-lg.font-bold Header
= form_tag( card_url(card.id) , {method: :patch } ) do
= text_field_tag( :header , card.content["header"], class: "w-full rounded-lg border-gray-200 p-4 pr-12 text-sm shadow-sm")
%button.ml-3.inline-block.rounded-lg.bg-blue-500.px-5.py-3.text-sm.font-medium.text-white{:type => "submit"}
Update

View File

@ -1,5 +0,0 @@
.relative.block.border.border-gray-100
-if( value.blank? )
No image
-else
= image_tag( "cms/" + value)

View File

@ -1,6 +0,0 @@
.relative.block.border.border-gray-100
%h3.mt-4.text-lg.font-bold= key.upcase + " : " + value
%button.ml-3.inline-block.rounded-lg.bg-blue-500.px-5.py-3.text-md.font-medium.text-white
=link_to "Change Template" , section_select_template_url(@section.id)
.relative.block.border.border-gray-100
=image_tag("merged/section_preview/#{section.template}" , class: "w-full object-contain")

View File

@ -1,6 +0,0 @@
.relative.block.border.border-gray-100
%h3.mt-4.text-lg.font-bold Text
= form_tag( card_url(card.id) , {method: :patch } ) do
= text_area_tag( :text , card.content["text"], class: "w-full rounded-lg border-gray-200 p-4 pr-12 text-sm shadow-sm")
%button.ml-3.inline-block.rounded-lg.bg-blue-500.px-5.py-3.text-sm.font-medium.text-white{:type => "submit"}
Update

View File

@ -18,8 +18,6 @@
=link_to( "Up" , "/index")
%button.mt-4.rounded-lg.bg-yellow-500.p-4
=link_to "Down" , "/index"
%button.mt-4.rounded-lg.bg-blue-400.p-4
=link_to "Edit" , card_path( @section.id)
%button.mt-4.rounded-lg.bg-cyan-400.p-4
=link_to "New" , "/index"
%button.mt-4.rounded-lg.bg-red-400.p-4
@ -31,5 +29,21 @@
%button.ml-3.inline-block.rounded-lg.bg-red-500.px-5.py-3.text-md.font-medium.text-white
= link_to( "Remove image" , card_set_image_path( card.id , image: ""))
- card.content.each do |key , value|
= render "merged/cards/editors/#{key}", card: card , key: key , value: value
.relative.block.border.border-gray-100
%h3.mt-4.text-lg.font-bold Image
-if( card.image.blank? )
%p No image
-else
= image_tag( "cms/" + card.image , class: "p-3")
.relative.block.border.border-gray-100
= form_tag( card_url(card.id) , {method: :patch } ) do
%h3.mt-4.text-lg.font-bold Header
= text_field_tag( :header , card.content["header"], class: "w-full rounded-lg border-gray-200 p-4 pr-12 text-sm shadow-sm")
%h3.mt-4.text-lg.font-bold Text
= text_area_tag( :text , card.content["text"], class: "w-full rounded-lg border-gray-200 p-4 pr-12 text-sm shadow-sm")
%button.ml-3.inline-block.rounded-lg.bg-blue-500.px-5.py-3.text-sm.font-medium.text-white{:type => "submit"}
Update
.relative.block.border.border-gray-100
%h3.mt-4.text-lg.font-bold Options
To be done

View File

@ -1,8 +0,0 @@
.p-6
%h3.mt-4.text-lg.font-bold= key.upcase
%p
.font-bold Text
= value["text"]
%p
.font-bold Link
= value["link"]

View File

@ -1,5 +0,0 @@
.p-6
%h3.mt-4.text-lg.font-bold= key.upcase
%p= value
=image_tag("merged/card_preview/#{value}" , class: "w-full object-contain")
%p #{section.content['cards'].length} cards

View File

@ -1,3 +0,0 @@
.p-6
%h3.mt-4.text-lg.font-bold= key.upcase
%p= value

View File

@ -1,6 +0,0 @@
.p-6
%h3.mt-4.text-lg.font-bold= key.upcase
-if value
= image_tag "cms/" + value
-else
No image

View File

@ -1,4 +0,0 @@
.p-6
%h3.mt-4.text-lg.font-bold= key.upcase
%p= value
=image_tag("merged/section_preview/#{section.template}" , class: "w-full object-contain")

View File

@ -1,3 +0,0 @@
.p-6
%h3.mt-4.text-lg.font-bold= key.upcase
%p= value

View File

@ -31,7 +31,8 @@
.relative.block.border.border-gray-100.p-4
- if section.cards?
%h3.mt-4.text-lg.font-bold #{section.content['cards'].length} Cards
=card_preview(section , class: "w-full object-contain")
=link_to section_cards_url(section.id) do
=card_preview(section , class: "w-full object-contain")
- else
%h3.mt-4.text-lg.font-bold Image
-if section.image

View File

@ -22,7 +22,7 @@
%h3.text-lg.font-medium.text-gray-900
Cards
%p.mt-2.text-sm.leading-relaxed.text-gray-500.line-clamp-3
-if(style.cards)
-if(style.cards?)
Section may include cards. See card styles below
-else
Section may not include cards