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: Updated by:
= card.updated_by = card.updated_by
.basis-full.mb-3 .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) =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 .basis-80
= link_to(merged.images_path(card_id: card.id)) do = link_to(merged.images_path(card_id: card.id)) do
@ -49,17 +53,15 @@
%h3.mt-4.text-lg.font-bold No image %h3.mt-4.text-lg.font-bold No image
%button.my-3.bg-cyan-200{class: button_classes} Add Image %button.my-3.bg-cyan-200{class: button_classes} Add Image
.basis-72.grow .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
%label.block %h4.text-lg.font-bold Texts
.text-lg.font-bold Header = simple_form_for( card , method: :patch) do |f|
= 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") = f.input :header
%label.block = f.input :text , as: :text , input_html: {rows: rows(card)}
.mt-4.text-lg.font-bold Text .mt-4= submit_button("Update Texts")
= 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")
.basis-72.grow .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| - card.option_definitions.each do |option|
.grid.grid-cols-3 .grid.grid-cols-3
=render "merged/sections/option_form_#{option.type}" , section: card , option: option =render "merged/sections/option_form_#{option.type}" , section: card , option: option

View File

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