merged/app/views/merged/cards/index.haml

54 lines
2.3 KiB
Plaintext
Raw Normal View History

- content_for( :merged_menu ) do
= render "merged/sections/sections_pagination" , section: @section
.text-xl.text-gray-900
Cards for Section #{@section.index} -
= link_to @section.header , section_url( @section.id) , class: "underline"
= link_to( "New Card" , new_section_card_url(@section.id) , class: "p-2 border border-gray-200 font-bold rounded-lg hover:bg-sky-100")
2022-11-30 11:22:45 +02:00
= render "layouts/merged_header"
- template = find_template(@section)
= render( template , section: @section)
2022-12-02 23:22:43 +02:00
2022-12-13 19:52:09 +02:00
- @section.cards.each_with_index do |card , index|
.flex.gap-10.px-20.py-10{class: (card.index%2)==1 ? 'bg-cyan-50' : 'bg-red-50' , id: "card_#{card.id}"}
.basis-96
2022-11-30 11:22:45 +02:00
.p-4
2022-12-06 14:33:38 +02:00
%h3.mt-4.text-lg.font-bold Card #{index + 1}:#{card.header}
2022-12-14 13:41:26 +02:00
.flex.flex-wrap
= 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)
2022-11-30 23:49:23 +02:00
.p-4
%h3.mt-4.text-lg.font-bold Image
2022-12-19 09:53:25 +02:00
= yellow_button("Change Image" , images_url(card_id: card.id) )
2022-12-02 15:04:53 +02:00
= red_button("Remove image", card_set_image_path( card.id , image: "") )
2022-12-13 19:52:09 +02:00
.basis-96
%h3.mt-4.text-lg.font-bold Image
-if( card.image.blank? )
%p No image
-else
2022-12-17 15:00:47 +02:00
= image_for( card, "p-3")
2022-12-13 19:52:09 +02:00
.basis-72.grow
%h3.mt-4.text-lg.font-bold Fields
2022-12-14 13:41:26 +02:00
= form_tag( card_url(card.id) , {method: :patch , class: "mx-auto mt-8 mb-0 max-w space-y-4" } ) do
2022-12-02 15:04:53 +02:00
%label.block
2022-12-13 19:52:09 +02:00
.text-lg.font-bold Header
2022-12-02 15:04:53 +02:00
= 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
2022-12-13 19:52:09 +02:00
.mt-4.text-lg.font-bold Text
2022-12-02 15:04:53 +02:00
= text_area_tag( :text , card.text, rows: 5 , class: "w-full rounded-lg border-gray-200 p-4 pr-12 text-sm shadow-sm" )
2022-12-02 15:23:39 +02:00
=submit_button( "Update")
2022-12-13 19:52:09 +02:00
.basis-72.grow
.mt-4.text-lg.font-bold Options
2022-12-05 18:14:56 +02:00
= 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")