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

View File

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

View File

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

View File

@ -27,7 +27,7 @@ module Merged
end
if(align = section.option("image_align"))
# 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}"
end
{class: clazz , style: style}

View File

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

View File

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

View File

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

View File

@ -5,4 +5,4 @@
-else
.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"}
%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
on different size screens. Default is center, but if the focus
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
:id: 21