From a2431db277eaf86bd8c03ea6ee8f233ca0d3b6eb Mon Sep 17 00:00:00 2001 From: totoro Date: Tue, 25 May 2021 08:49:01 +0900 Subject: [PATCH] add get_tristate from web_arg. This let use the jquery.tristate.js. get_tristate return a Maybe(Bool) which the following values are: success(true) = checked, success(false) = unchecked, failure = intermediate. --- web/web_arg_utils.anubis | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+), 0 deletions(-) diff --git a/web/web_arg_utils.anubis b/web/web_arg_utils.anubis index be6afed..8f351dc 100644 --- a/web/web_arg_utils.anubis +++ b/web/web_arg_utils.anubis @@ -360,6 +360,26 @@ public define Maybe(Bool) // println("value = '"+value+"' result = "+to_String(return_v)+" success("+to_String(return_v)+")"); success(return_v) }. + +public define Maybe(Bool) + get_tristate + ( + List(Web_arg) lwa, + String arg_name + ) = +// println("get_mb_Bool "+arg_name); + if web_arg_value(lwa, arg_name) is + { + not_found then failure + found(value) then + if value = "checked" then success(true) + else if value = "unchecked" then success(false) + else if value = "intermediate" then failure + else failure, +// println("value = '"+value+"' result = "+to_String(return_v)+" success("+to_String(return_v)+")"); + + } +. public define Bool get_Bool -- libgit2 0.21.4