diff --git a/examples/todoapp/todoapp.nim b/examples/todoapp/todoapp.nim index 99f70ea..7aa90d1 100644 --- a/examples/todoapp/todoapp.nim +++ b/examples/todoapp/todoapp.nim @@ -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)) diff --git a/karax/karax.nim b/karax/karax.nim index d0ed73d..560d121 100644 --- a/karax/karax.nim +++ b/karax/karax.nim @@ -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))