57 lines
2.4 KiB
Plaintext
57 lines
2.4 KiB
Plaintext
- template = find_template(@section)
|
|
= render( template , section: @section)
|
|
|
|
.flex.flex-col.bg-white
|
|
.flex.items-center.justify-center.flex-1
|
|
.max-w-xl.px-4.py-8.mx-auto.text-center
|
|
%h1.text-3xl.font-bold.tracking-tight.text-gray-900
|
|
Page #{link_to @section.page.name, page_sections_url(@section.page.name), class: "underline"}
|
|
.flex.items-center.justify-center.flex-1
|
|
%h3.text-xl.font-bold.tracking-tight.text-gray-900
|
|
Cards for
|
|
= link_to "Section #{@section.index}", section_url( @section.id) , class: "underline"
|
|
|
|
|
|
.grid.grid-cols-4.gap-2.m-8
|
|
- @section.cards.each_with_index do |card , index|
|
|
.relative.block.border.border-gray-100
|
|
.p-4
|
|
%h3.mt-4.text-lg.font-bold Card #{index + 1}:#{card.header}
|
|
= blue_button( "Up" , card_move_url(card.id , dir: :up) )
|
|
= blue_button( "Down" , card_move_url(card.id , dir: :down) )
|
|
= form_tag( card_url(card.id) , {method: :delete } ) do
|
|
=submit_button( "Delete" , true)
|
|
.p-4
|
|
%h3.mt-4.text-lg.font-bold Image
|
|
= yellow_button("Change Image" , card_select_image_url(card.id) )
|
|
= red_button("Remove image", card_set_image_path( card.id , image: "") )
|
|
|
|
|
|
.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
|
|
%label.block
|
|
%h4.text-lg.font-bold Header
|
|
= text_field_tag( :header , card.header, class: "block w-full rounded-lg border-gray-200 p-4 pr-12 text-sm shadow-sm")
|
|
%label.block
|
|
%h4.mt-4.text-lg.font-bold Text
|
|
= text_area_tag( :text , card.text, rows: 5 , class: "w-full rounded-lg border-gray-200 p-4 pr-12 text-sm shadow-sm" )
|
|
=submit_button( "Update")
|
|
|
|
.relative.block.border.border-gray-100
|
|
%h3.mt-4.text-lg.font-bold Options
|
|
= form_tag( card_url(card.id) , {method: :patch , class: "mx-auto mt-8 mb-0 max-w space-y-4" }) do
|
|
- card.option_definitions.each do |option|
|
|
=render "merged/sections/option_form_#{option.type}" , section: card , option: option
|
|
-if card.option_definitions.empty?
|
|
%p No options
|
|
-else
|
|
= submit_button("Update")
|
|
%p
|
|
= green_button( "New Card" , new_section_card_url(@section.id) )
|