mirror of
https://github.com/zedeus/nitter
synced 2026-09-06 07:09:31 +00:00
Simplify pref macros
This commit is contained in:
parent
84dfcd089a
commit
8879612594
2 changed files with 16 additions and 28 deletions
|
|
@ -92,17 +92,15 @@ macro genUpdatePrefs*(): untyped =
|
|||
|
||||
case pref.kind
|
||||
of checkbox:
|
||||
result.add quote do:
|
||||
prefs.`ident` = `value` == "on"
|
||||
result.add quote do: prefs.`ident` = `value` == "on"
|
||||
of input:
|
||||
result.add quote do: prefs.`ident` = `value`
|
||||
of select:
|
||||
let options = pref.options
|
||||
let default = pref.defaultOption
|
||||
result.add quote do:
|
||||
if `value` in `options`: prefs.`ident` = `value`
|
||||
else: prefs.`ident` = `default`
|
||||
of input:
|
||||
result.add quote do:
|
||||
prefs.`ident` = `value`
|
||||
|
||||
result.add quote do:
|
||||
cache(prefs)
|
||||
|
|
|
|||
Loading…
Reference in a new issue