section move to other page

This commit is contained in:
Torsten 2023-01-20 15:40:41 +02:00
parent 8d650a82cc
commit d6dd0fd589
9 changed files with 30 additions and 31 deletions

View File

@ -1570,10 +1570,6 @@ select {
margin-top: 5rem; margin-top: 5rem;
} }
.mt-0 {
margin-top: 0px;
}
.block { .block {
display: block; display: block;
} }
@ -2252,6 +2248,10 @@ select {
background-position: right top; background-position: right top;
} }
.bg-right {
background-position: right;
}
.bg-right-bottom { .bg-right-bottom {
background-position: right bottom; background-position: right bottom;
} }
@ -2860,14 +2860,6 @@ select {
margin-right: 3rem; margin-right: 3rem;
} }
.md\:mt-0 {
margin-top: 0px;
}
.md\:mt-6 {
margin-top: 1.5rem;
}
.md\:grid { .md\:grid {
display: grid; display: grid;
} }
@ -2952,14 +2944,14 @@ select {
margin-top: 2rem; margin-top: 2rem;
} }
.lg\:mb-0 {
margin-bottom: 0px;
}
.lg\:mt-0 { .lg\:mt-0 {
margin-top: 0px; margin-top: 0px;
} }
.lg\:mb-0 {
margin-bottom: 0px;
}
.lg\:h-96 { .lg\:h-96 {
height: 24rem; height: 24rem;
} }

View File

@ -65,11 +65,7 @@ module Merged
end end
def update def update
@section.allowed_fields.each do |key| @section.update(params[:section])
if( params.has_key?(key) )
@section.update(key, params[key])
end
end
options = params[:option] options = params[:option]
@section.option_definitions.each do |option| @section.option_definitions.each do |option|
@section.set_option(option.name, options[option.name]) @section.set_option(option.name, options[option.name])

View File

@ -9,7 +9,7 @@ module Merged
"#{x} / #{y}" "#{x} / #{y}"
end end
def field_name(card) def card_field_name(card)
name = card.header name = card.header
name += "*" unless card.option("compulsory") == "no" name += "*" unless card.option("compulsory") == "no"
name name

View File

@ -27,7 +27,7 @@ module Merged
end end
if(align = section.option("image_align")) if(align = section.option("image_align"))
# for tailwind: bg-left-top bg-left bg-left-bottom # for tailwind: bg-left-top bg-left bg-left-bottom
# bg-top bg-center bg-bottom bg-right-top bg-right-center bg-right-bottom # bg-top bg-center bg-bottom bg-right-top bg-right bg-right-bottom
clazz += " bg-#{align}" clazz += " bg-#{align}"
end end
{class: clazz , style: style} {class: clazz , style: style}

View File

@ -33,6 +33,10 @@ module Merged
end end
end end
def allowed_fields
super + [:page_id]
end
def has_cards? def has_cards?
template_style.has_cards? template_style.has_cards?
end end

View File

@ -58,14 +58,16 @@ module Merged
end end
end end
def update(key , value) def update(hash)
raise "unsuported field #{key} for #{template}" unless allowed_fields.include?(key) hash.each do |key , value|
if(! attributes[key].nil? ) # first setting ok, types not (yet?) specified raise "unsuported field #{key} for #{template}:#{allowed_fields}" unless allowed_fields.include?(key.to_sym)
if( @attributes[key].class != value.class ) if(! attributes[key].nil? ) # first setting ok, types not (yet?) specified
raise "Type mismatch #{key} #{key.class}!=#{value.class}" if( @attributes[key].class != value.class )
raise "Type mismatch #{key} #{key.class}!=#{value.class}"
end
end end
attributes[key] = value
end end
attributes[key] = value
end end
#other may be nil #other may be nil

View File

@ -16,6 +16,11 @@
.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|
= 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"
=submit_button( "Move")
.basis-80.image .basis-80.image
= link_to(merged.images_path(section_id: @section.id)) do = link_to(merged.images_path(section_id: @section.id)) do

View File

@ -5,4 +5,4 @@
-else -else
.relative.z-0.mt-3 .relative.z-0.mt-3
%input.peer.block.w-full.appearance-none.border-0.border-b.border-gray-500.bg-transparent.px-0.text-sm.text-gray-900.focus:border-blue-600.focus:outline-none.focus:ring-0{:class => "py-2.5", :name => card.header, :placeholder => " " , "value" => params[card.header], :type => "text"} %input.peer.block.w-full.appearance-none.border-0.border-b.border-gray-500.bg-transparent.px-0.text-sm.text-gray-900.focus:border-blue-600.focus:outline-none.focus:ring-0{:class => "py-2.5", :name => card.header, :placeholder => " " , "value" => params[card.header], :type => "text"}
%label.absolute.top-3.-z-10.-translate-y-6.scale-75.transform.text-sm.text-gray-500.duration-300.peer-placeholder-shown:translate-y-0.peer-placeholder-shown:scale-100.peer-focus:left-0.peer-focus:-translate-y-6.peer-focus:scale-75.peer-focus:text-blue-600.peer-focus:dark:text-blue-500{:class => "origin-[0]"}= field_name(card) %label.absolute.top-3.-z-10.-translate-y-6.scale-75.transform.text-sm.text-gray-500.duration-300.peer-placeholder-shown:translate-y-0.peer-placeholder-shown:scale-100.peer-focus:left-0.peer-focus:-translate-y-6.peer-focus:scale-75.peer-focus:text-blue-600.peer-focus:dark:text-blue-500{:class => "origin-[0]"}= card_field_name(card)

View File

@ -114,6 +114,6 @@
:description: Alignment of images. This affect what stays visible :description: Alignment of images. This affect what stays visible
on different size screens. Default is center, but if the focus on different size screens. Default is center, but if the focus
of the image is left or right, that may be choosen. of the image is left or right, that may be choosen.
:values: left-top left left-bottom top center bottom right-top right-center right-bottom :values: left-top left left-bottom top center bottom right-top right right-bottom
:default: center :default: center
:id: 21 :id: 21