From cebdf6b741e45dcc0d60b51891690681cb4b09bb Mon Sep 17 00:00:00 2001 From: totoro Date: Sun, 20 Aug 2023 11:17:35 +0200 Subject: [PATCH] [+] add dialog showing available language. The argument 'action' is a call back for action when one of the flag is clicked. Generally it's javascript function call during onclick event. So this function action let add at the end the language argument into javascript calling function. --- web_controllers/language/language_management.anubis | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+), 0 deletions(-) diff --git a/web_controllers/language/language_management.anubis b/web_controllers/language/language_management.anubis index 6f8a2f1..1c6d36d 100644 --- a/web_controllers/language/language_management.anubis +++ b/web_controllers/language/language_management.anubis @@ -163,6 +163,19 @@ define HTML_Off_Form event(onclick, "language_changed('"+language_code+"');")], text(language)) . +define HTML_Off_Form + language_line + ( + String language_code, + String language, + String -> String action + )= + div([class("clickable"), event(onclick, action(language_code))],[ + img("/xlib/flags/24x24/"+language_code+".png"), + text(language) + ]) +. + public define HTML_Partial_Content flags_menu ( @@ -214,3 +227,49 @@ public define HTML_Partial_Content flags_menu(app_dictionnary, lang, show_symbolic) . + +public define HTML_Partial_Content + choose_lang_dialog + ( + String dictionary_collection_name, + String -> String action, + Bool show_symbolic, + )= + with make_line = (L3LangDicProperty dico_prop) |-> + if dico_prop is l3LangDicProperty( _, sha1, lang_code, user_def, creat, update) then + with lang_info = l3_get_language_info(lang_code), + language_line(lang_code, self_name(lang_info), action), + + partial_content([ + css(css_file("/xlib/css/flags_menu.css")), + js(js_file("/xlib/js/xlib.js")) + ], + [ + dl([ + //img([event(onmouseover, "showObject('l3-flag');"), event(onmouseout, "hideObject('l3-flag');")], "/xlib/flags/24x24/"+lang+".png" ), + dd([style("display: block"),id("l3-flag")], + ul( + map(make_line, l3_get_all_dicos(dictionary_collection_name))+ + [ + if show_symbolic then + language_line("symb", "symbolic", action) + else + empty + ] + )), + ]) //!dl + ] + ) +. + +public define HTML_Partial_Content + choose_lang_dialog + ( + WEB_Session _session, + String -> String action + ) = + with lang = _session.language, + app_dictionnary = get_dictionary(_session), + + choose_lang_dialog(app_dictionnary, action, false) +. -- libgit2 0.21.4