Commit Graph

17 Commits

Author SHA1 Message Date
Maciej Krüger
1f451d4021
gluon-web-model: fix issue with warning blocking save on private-wifi
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)
2023-01-28 20:42:52 +01:00
Maciej Krüger
a0db0a46b3
gluon-web-model: resolve hang when submitting form with disabled element
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
2022-12-13 21:18:41 +01:00
Maciej Krüger
30a6b76520
gluon-web-model: add Section:element and Element, add Warning template 2022-12-10 22:49:18 +01:00
Matthias Schiffer
df9fa32d58
gluon-web-model: add state tracking to sections
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.
2021-05-15 00:02:44 +02:00
Matthias Schiffer
e8c65ef75f
gluon-web-model: fix conflicting table fields "reset"
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.
2020-06-06 17:23:21 +02:00
Matthias Schiffer
45b518df11 gluon-web-model: remove unused field error message code
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.
2020-06-05 21:46:30 +02:00
Matthias Schiffer
e6859ca031 gluon-web-model: remove unused tag_invalid and tag_missing fields 2020-06-05 21:46:30 +02:00
Matthias Schiffer
11a3b56617 gluon-web-model: add dependency support for sections
- 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
2020-06-04 22:54:28 +02:00
Matthias Schiffer
3951607e53 gluon-web-model: fix deplist() argument list
Fixes dependency tracking for individual <option> elements (currently
unused).
2020-06-04 22:54:28 +02:00
bobcanthelpyou
f2305faea8 gluon-web-model: fix return value of resolve_depends() 2019-06-16 22:51:53 +02:00
bobcanthelpyou
4249d65af7 treewide: fix luacheck warnings 2019-06-16 22:51:53 +02:00
Matthias Schiffer
da45bd5987
treewide: do not use Lua module() 2019-06-16 15:51:43 +02:00
Matthias Schiffer
9a732f30dd
gluon-web-model: reorder Node arguments so Section:option() can just pass them through 2018-09-01 11:28:12 +02:00
Matthias Schiffer
653c132013
gluon-web-model: remove unused Section attribute "fields" 2018-09-01 11:28:12 +02:00
Matthias Schiffer
06a9d61523
gluon-web-*: replace nixio with luaposix 2018-07-17 20:08:16 +02:00
Matthias Schiffer
9648489a01
gluon-web: reorganize layout handling
Also bring back gluon-web-theme's i18n strings.
2018-02-26 00:07:12 +01:00
Matthias Schiffer
c3e4ceed28
gluon-web: split out model support into a separate package 2018-02-26 00:07:08 +01:00