From 6bd32a0e8855302dca7a74031a78fd255a9a474f Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Thu, 5 Oct 2017 12:32:14 +0200 Subject: [PATCH] added toChecked and toDisabled helpers --- examples/todoapp/todoapp.nim | 3 --- karax/karax.nim | 6 ++++++ 2 files changed, 6 insertions(+), 3 deletions(-) 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))