added toChecked and toDisabled helpers

This commit is contained in:
Andreas Rumpf 2017-10-05 12:32:14 +02:00
commit 6bd32a0e88
2 changed files with 6 additions and 3 deletions

View file

@ -71,9 +71,6 @@ proc clearCompleted(ev: Event, n: VNode) =
proc toClass(completed: bool): cstring =
(if completed: cstring"completed" else: cstring(nil))
proc toChecked(checked: bool): cstring =
(if checked: cstring"checked" else: cstring(nil))
proc selected(v: Filter): cstring =
(if filter == v: cstring"selected" else: cstring(nil))

View file

@ -706,3 +706,9 @@ proc setInputText*(n: VNode; s: cstring) =
## Sets the text of input elements.
n.text = s
if n.dom != nil: n.dom.value = s
proc toChecked*(checked: bool): cstring =
(if checked: cstring"checked" else: cstring(nil))
proc toDisabled*(disabled: bool): cstring =
(if disabled: cstring"disabled" else: cstring(nil))