better option display

This commit is contained in:
Torsten 2023-01-09 00:22:47 +02:00
parent d522fc7600
commit a8523d474e
5 changed files with 11 additions and 10 deletions

View File

@ -12,7 +12,7 @@
- @section.cards.each_with_index do |card , index| - @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}"} .flex.gap-10.px-20.py-10{class: (card.index%2)==1 ? 'bg-cyan-50' : 'bg-red-50' , id: "card_#{card.id}"}
.basis-96 .basis-80
.p-4 .p-4
%h3.mt-4.text-lg.font-bold Card #{index + 1}:#{card.header} %h3.mt-4.text-lg.font-bold Card #{index + 1}:#{card.header}
.flex.flex-wrap .flex.flex-wrap
@ -21,17 +21,16 @@
= form_tag( merged.card_path(card.id) , {method: :delete } ) do = form_tag( merged.card_path(card.id) , {method: :delete } ) do
=submit_button( "Delete" , true) =submit_button( "Delete" , true)
.p-4 .p-4
%h3.mt-4.text-lg.font-bold.image_button Image
= yellow_button("Change Image" , merged.images_path(card_id: card.id) ) = yellow_button("Change Image" , merged.images_path(card_id: card.id) )
= red_button("Remove image", merged.card_set_image_path( card.id , image: "") )
.basis-full.mt-3 .basis-full.mt-3
Updated at: Updated at:
= distance_of_time_in_words_to_now(card.updated_at) = distance_of_time_in_words_to_now(card.updated_at)
.basis-full.mb-3 .basis-full.mb-3
Updated by: Updated by:
= card.updated_by = card.updated_by
= red_button("Remove image", merged.card_set_image_path( card.id , image: "") )
.basis-96 .basis-80
= link_to(merged.images_path(card_id: card.id)) do = link_to(merged.images_path(card_id: card.id)) do
-if card.image -if card.image
%h3.mt-4.text-lg.font-bold Image #{card.image.name} %h3.mt-4.text-lg.font-bold Image #{card.image.name}
@ -58,6 +57,7 @@
.mt-4.text-lg.font-bold Options .mt-4.text-lg.font-bold Options
= form_tag( merged.card_path(card.id) , {method: :patch , class: "mx-auto mt-8 mb-0 max-w space-y-4" }) do = form_tag( merged.card_path(card.id) , {method: :patch , class: "mx-auto mt-8 mb-0 max-w space-y-4" }) do
- card.option_definitions.each do |option| - card.option_definitions.each do |option|
.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
-if card.option_definitions.empty? -if card.option_definitions.empty?
%p No options %p No options

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
= select_date section.option(option.name) , :prefix => "option[#{option.name}]" .col-span-2= select_date section.option(option.name) , :prefix => "option[#{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
= 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( "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")

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
= 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( "option[#{option.name}]" , section.option(option.name), class: "w-full rounded-lg border-gray-200 p-4 pr-12 text-sm shadow-sm")

View File

@ -72,6 +72,7 @@
%h3.mt-4.text-lg.font-bold Options %h3.mt-4.text-lg.font-bold Options
.grid.grid-cols-2.gap-3.mx-10 .grid.grid-cols-2.gap-3.mx-10
- section.options.each do|name , value| - section.options.each do|name , value|
-unless value.blank?
.font-bold.mt-1= name.camelcase .font-bold.mt-1= name.camelcase
.font-xl= value .font-xl= value
.grid.grid-cols-2.gap-2.m-8 .grid.grid-cols-2.gap-2.m-8