The other bugfix which made this element inherit from AbstractValue
caused AbstractValue:validate() to be inherited aswell
Now added an if so validate only runs if a datatype is set
(since Element is meant as a generic way to extend web-model without
modifying web-model - also to add custom inputs - just hiding it behind an if sounds like a sane solution)
I was made aware of a bug when submitting the form while the element is
disabled based on it's dependencies
The fix was to inherit from AbstractValue instead of just node
AbstractValue's AbstractValue:resolve_node_depends() in particular
solves the issue, but it made more sense to just use the full base class
This removes PKG_VERSION and PKG_RELEASE from most Makefiles, as the
value was never useful for Gluon packages; instead, PKG_VERSION is set
to 1 in gluon.mk.
It also removes two other weird definitions:
- gluon-iptables-clamp-mss-to-pmtu replicating the old PKG_VERSION logic
from gluon-core, but without the fixed PKG_BUILD_DIR to prevent
unnessary rebuilds
- gluon-hoodselector set GLUON_VERSION=3
This add support for a write() method on sections, in addition to the
value and form level write(). write() is only called when the section is
valid and visible. In addition, write() is empty by default, so it can be
overridden more easily.
Replace the ugly arrow shown in Firefox with a custom SVG arrow. Tested
and working in Firefox, Chrome and Edge. The arrow doesn't show in IE, but
the gluon-web-model JavaScript is already severely broken in IE, so we
don't care.
With 11a3b56617 ("gluon-web-model: add dependency support for
sections"), a "reset" function was added to all model nodes. This
conflicts with the "reset" field of the Form object, making reset
buttons show labels like "function: 0xbb8d50" and possibly breaking form
processing when packages override the reset field.
Validation errors are mostly handled in the frontend (by displaying
invalid fields with a red background). There was some code left in the
backend for handling different kinds of errors, and returning custom
error messages from validate(), but the resulting value was not used
anywhere.
- Add a dependency array to section template
- Lift dependency handling from AbstractValue to Node
- Split resolve_depends() into a function handling dependencies of a
node itself (resolve_node_depends()), which now is used for all nodes,
and the existing recursive descent through the node tree
- When any node's dependencies are not satisfied, all descendents are
reset recursively, meaning that an option in a section that is hidden
will always be ignored, as if the option's own dependencies were
unsatisfied
Fixes: #1349
Register to 'reset' event on form element and make call to 'update' function
delayed in 'data-update' handler to allow the form values to update beforehand.
When using a form's 'reset' button, form field visibility was not updated.
This could lead to situations where a checkbox had to be toggled again
twice to display the detail text inputs. (Example taken from private
wifi package)