change forms for simple_form

This commit is contained in:
Torsten 2023-01-20 16:49:22 +02:00
parent fba9f3d2fb
commit e752c46d96
5 changed files with 24 additions and 25 deletions

View File

@ -29,8 +29,12 @@
Updated by:
= card.updated_by
.basis-full.mb-3
= form_tag( merged.card_path(card.id) , {method: :delete } ) do
= form_for( card , {method: :delete } ) do
=submit_button( "Delete Card" , true)
= simple_form_for( card , method: :post ) do |f|
= f.input :section_id , label: "move to section" , include_blank: false ,
collection: Merged::Page.all.collect{|p| [p.name , p.id]}
=submit_button( "Move")
.basis-80
= link_to(merged.images_path(card_id: card.id)) do
@ -49,17 +53,15 @@
%h3.mt-4.text-lg.font-bold No image
%button.my-3.bg-cyan-200{class: button_classes} Add Image
.basis-72.grow
= form_tag( merged.card_path(card.id) , {method: :patch , class: "mx-auto mb-0 max-w space-y-4" } ) do
%label.block
.text-lg.font-bold Header
= text_field_tag( :header , card.header, class: "mt-2 block w-full rounded-lg border-gray-200 p-4 pr-12 text-sm shadow-sm")
%label.block
.mt-4.text-lg.font-bold Text
= text_area_tag( :text , card.text, rows: 5 , class: "mt-2 w-full rounded-lg border-gray-200 p-4 pr-12 text-sm shadow-sm" )
=submit_button( "Update Texts")
%label.block
%h4.text-lg.font-bold Texts
= simple_form_for( card , method: :patch) do |f|
= f.input :header
= f.input :text , as: :text , input_html: {rows: rows(card)}
.mt-4= submit_button("Update Texts")
.basis-72.grow
= form_tag( merged.card_path(card.id) , {method: :patch , class: "mx-auto mb-0 max-w space-y-4" }) do
= form_for( card , {method: :patch }) do
- card.option_definitions.each do |option|
.grid.grid-cols-3
=render "merged/sections/option_form_#{option.type}" , section: card , option: option

View File

@ -1,4 +1,4 @@
%label.block
.mt-4.text-lg.font-bold
= option.name.camelcase
.col-span-2= select_date section.option(option.name) , :prefix => "option[#{option.name}]"
.col-span-2= select_date section.option(option.name) , :prefix => "options[#{option.name}]"

View File

@ -1,4 +1,4 @@
%label.block
.mt-4.text-lg.font-bold
= option.name.camelcase
.col-span-2= select_tag( "option[#{option.name}]" , options_for_select(option.values, section.option(option.name)), class: "w-full rounded-lg border-gray-200 p-4 pr-12 text-sm shadow-sm")
.col-span-2= select_tag( "options[#{option.name}]" , options_for_select(option.values, section.option(option.name)), class: "w-full rounded-lg border-gray-200 p-4 pr-12 text-sm shadow-sm")

View File

@ -1,4 +1,4 @@
%label.block
.mt-4.text-lg.font-bold
= option.name.camelcase
.col-span-2= text_field_tag( "option[#{option.name}]" , section.option(option.name), class: "w-full rounded-lg border-gray-200 p-4 pr-12 text-sm shadow-sm")
.col-span-2= text_field_tag( "options[#{option.name}]" , section.option(option.name), class: "w-full rounded-lg border-gray-200 p-4 pr-12 text-sm shadow-sm")

View File

@ -16,10 +16,9 @@
.basis-full.mb-3
Updated by:
= @section.updated_by
= simple_form_for( @section , method: :patch , class: "mx-auto mb-2 max-w space-y-4") do |f|
= f.input :page_id , label: "move to page" , include_blank: false ,
collection: Merged::Page.all.collect{|p| [p.name , p.id]} ,
class: "w-full rounded-lg border-gray-200 p-4 pr-12 text-sm shadow-sm"
= simple_form_for( @section , method: :patch ) do |f|
= f.input :page_id , label: "move to page" , include_blank: false ,
collection: Merged::Page.all.collect{|p| [p.name , p.id]}
=submit_button( "Move")
.basis-80.image
@ -40,13 +39,11 @@
.mt-3= red_button( "Remove image", merged.section_set_image_path( @section.id , image: "")) if( @section.image )
.basis-80.grow.content_update
= form_tag( merged.section_path( @section.id) , method: :patch , class: "mx-auto mb-2 max-w space-y-4") do
%label.block
%h4.text-lg.font-bold Header
= text_field_tag( :header , @section.header, class: "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 , @section.text, rows: rows(@section) ,class: "w-full rounded-lg border-gray-200 p-4 pr-12 text-sm shadow-sm")
%label.block
%h4.text-lg.font-bold Texts
= simple_form_for( @section , method: :patch) do |f|
= f.input :header
= f.input :text , as: :text , input_html: {rows: rows(@section)}
.mt-4= submit_button("Update Texts")
- if( @section.has_cards? )
@ -67,7 +64,7 @@
= blue_button( "New Card" , merged.new_section_card_path(@section.id) )
.basis-80.grow
= form_tag( merged.section_path( @section.id) , method: :patch , class: "mx-auto mb-0 max-w space-y-4") do
= simple_form_for( @section , method: :patch , class: "mx-auto mb-0 max-w space-y-4") do
- @section.option_definitions.each do |option|
.grid.grid-cols-3
=render "option_form_#{option.type}" , section: @section , option: option