From 51294382a971a9b84120c48181bba011daac7a2b Mon Sep 17 00:00:00 2001 From: Philipp Memmel Date: Mon, 26 Aug 2024 12:45:32 +0200 Subject: [PATCH] MBS-9310: Cleanup mustache files for pipeline --- templates/admin_setting_tabs.mustache | 59 ------------- templates/ai_info_warning.mustache | 27 ++++++ templates/confirm_ai_usage.mustache | 10 +-- templates/edit_instance_heading.mustache | 10 +-- templates/infobox.mustache | 8 +- templates/instanceaddmodal.mustache | 19 +++-- templates/instancetable.mustache | 39 +++++++-- templates/purpose_info.mustache | 38 ++++++--- templates/tenantenable.mustache | 12 ++- templates/tenantnavbar.mustache | 35 +++++--- templates/toggle.mustache | 15 ++-- templates/userquota.mustache | 27 ++++-- tools/chatgpt/templates/settings.mustache | 85 ------------------- tools/dalle/templates/settings.mustache | 13 --- tools/gemini/templates/settings.mustache | 85 ------------------- .../templates/settings.mustache | 85 ------------------- 16 files changed, 161 insertions(+), 406 deletions(-) delete mode 100644 templates/admin_setting_tabs.mustache delete mode 100644 tools/chatgpt/templates/settings.mustache delete mode 100644 tools/dalle/templates/settings.mustache delete mode 100644 tools/gemini/templates/settings.mustache delete mode 100644 tools/googlesynthesize/templates/settings.mustache diff --git a/templates/admin_setting_tabs.mustache b/templates/admin_setting_tabs.mustache deleted file mode 100644 index ecdee6c..0000000 --- a/templates/admin_setting_tabs.mustache +++ /dev/null @@ -1,59 +0,0 @@ -{{! - This file is part of Moodle - http://moodle.org/ - - Moodle is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Moodle is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Moodle. If not, see . -}} -{{! - @template local_ai_manager/admin_setting_tabs - - - Example context (json): - { - "tabs": [ - { - "name": "tab1", - "active": 0, - "displayname": "Inactive tab1", - 'description' => "Settings", - "html": "

Tab 1 content

" - }, - { - "name": "tab2", - "active": 1, - "displayname": "Active tab2", - 'description' => "Very important settings.", - "html": "

Tab 2 content

" - } - ] - } -}} - -
- {{#tabs}} -
- {{#description}} -
-

{{description}}

-
- {{/description }} - {{{html}}} -
- {{/tabs}} -
diff --git a/templates/ai_info_warning.mustache b/templates/ai_info_warning.mustache index 2c7938a..b73e4f7 100644 --- a/templates/ai_info_warning.mustache +++ b/templates/ai_info_warning.mustache @@ -1,3 +1,30 @@ +{{! + This file is part of Moodle - http://moodle.org/ + + Moodle is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Moodle is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Moodle. If not, see . +}} +{{! + @template local_ai_manager/ai_info_warning + + Template for the AI info warning box. + + Example context (json): + { + "showaiwarninglink": true, + "aiwarningurl": "https://www.someexternalpage.com/info_about_ai_content.html" + } +}}

{{#str}}aiwarning, local_ai_manager{{/str}}

{{#showaiwarninglink}} diff --git a/templates/confirm_ai_usage.mustache b/templates/confirm_ai_usage.mustache index 58fdf1d..7457ed7 100644 --- a/templates/confirm_ai_usage.mustache +++ b/templates/confirm_ai_usage.mustache @@ -15,17 +15,13 @@ along with Moodle. If not, see . }} {{! - @template local_ai_manager/tenantnavbar + @template local_ai_manager/confirm_ai_usage - Admin text setting template. - - Context variables required for this template: - * label - form element name - * href - element id - * forceltr - always display as ltr + Template for the confirmation page. Example context (json): { + "termsofuse": "This are the terms of use which you need to accept" } }}
diff --git a/templates/edit_instance_heading.mustache b/templates/edit_instance_heading.mustache index e120eca..3371bbe 100644 --- a/templates/edit_instance_heading.mustache +++ b/templates/edit_instance_heading.mustache @@ -17,15 +17,11 @@ {{! @template local_ai_manager/edit_instance_heading - Admin text setting template. - - Context variables required for this template: - * label - form element name - * href - element id - * forceltr - always display as ltr - Example context (json): { + "heading": "Edit the 'Chat' instance", + "showdeletebutton": true, + "deleteurl": "https://mymoodle.com/editinstance.php?id=5&delete=1" } }}
diff --git a/templates/infobox.mustache b/templates/infobox.mustache index b18b313..3304550 100644 --- a/templates/infobox.mustache +++ b/templates/infobox.mustache @@ -17,15 +17,11 @@ {{! @template local_ai_manager/infobox - Admin text setting template. - - Context variables required for this template: - * label - form element name - * href - element id - * forceltr - always display as ltr + Template for displaying the local_ai_manager infobox. Example context (json): { + "aiinfourl": "https://mymoodle.com/local/ai_manager/ai_info.php?option=someoption" } }}
diff --git a/templates/instanceaddmodal.mustache b/templates/instanceaddmodal.mustache index b0f9f51..60561fa 100644 --- a/templates/instanceaddmodal.mustache +++ b/templates/instanceaddmodal.mustache @@ -17,15 +17,22 @@ {{! @template local_ai_manager/instanceaddmodal - Admin text setting template. - - Context variables required for this template: - * label - form element name - * href - element id - * forceltr - always display as ltr + Template for the modal to add an instance. Example context (json): { + "tools": [ + { + "linklabel": "Add test tool", + "addurl": "https://mymoodle.com/addtool?tool=testtool", + "adddescription": "This tool is a very great tool to add" + }, + { + "linklabel": "Add another test tool", + "addurl": "https://mymoodle.com/addtool?tool=anothertesttool", + "adddescription": "This tool is another very great tool to add" + } + ] } }} {{< core/modal}} diff --git a/templates/instancetable.mustache b/templates/instancetable.mustache index 96d4cd7..72ed542 100644 --- a/templates/instancetable.mustache +++ b/templates/instancetable.mustache @@ -17,18 +17,39 @@ {{! @template local_ai_manager/instancetable - Admin text setting template. - - Context variables required for this template: - * label - form element name - * href - element id - * forceltr - always display as ltr + Template for the table that shows the current instances. Example context (json): { - "label": "button label", - "href": "http://google.com", - "forceltr": false + "tenant": "sometenantname", + "purposesheading": "Purposes (3 of 6 configured)", + "instances": [ + { + "name": "my first instance", + "toolname": "chatgpt", + "model": "chatgpt4o", + "purposes": [ + { + "fullname": "Chat" + }, + { + "fullname": "Translate" + } + ], + "nopurposeslink": "Not assigned to any purposes" + }, + { + "name": "my second instance", + "toolname": "dalle", + "model": "dalle-3", + "purposes": [ + { + "fullname": "Image generation" + } + ], + "nopurposeslink": "Not assigned to any purposes" + } + ] } }}
diff --git a/templates/purpose_info.mustache b/templates/purpose_info.mustache index 2717ed4..a51909e 100644 --- a/templates/purpose_info.mustache +++ b/templates/purpose_info.mustache @@ -17,15 +17,27 @@ {{! @template local_ai_manager/purpose_info - Admin text setting template. - - Context variables required for this template: - * label - form element name - * href - element id - * forceltr - always display as ltr + Template for showing the purpose info. Example context (json): { + "termsofuse": "This are the terms of use which you need to accept", + "purposes": [ + { + "highlight": true, + "purpose": "chat", + "name": "Instance for ChatGPT 4o", + "model": "chatgpt4o", + "infolink": "https://someexternallinkwithadditionalinfo.com/chatgpt" + }, + { + "highlight": false, + "purpose": "translate", + "name": "Instance for Google Gemini", + "model": "gemini-flash-1.5", + "infolink": "https://someexternallinkwithadditionalinfo.com/googlegemini" + } + ] } }}
@@ -48,7 +60,7 @@

{{#str}}privacy_terms_heading, local_ai_manager{{/str}}

- {{#str}}privacy_terms_text1, local_ai_manager{{/str}}
+ {{#str}}privacy_terms_text1, local_ai_manager{{/str}}
{{{termsofuse}}}

{{#str}}privacy_terms_text2, local_ai_manager{{/str}}

@@ -56,10 +68,12 @@ - - - - + + + + + + {{#purposes}} @@ -67,7 +81,7 @@ - + {{/purposes}} diff --git a/templates/tenantenable.mustache b/templates/tenantenable.mustache index 5ed7307..5006bdb 100644 --- a/templates/tenantenable.mustache +++ b/templates/tenantenable.mustache @@ -15,17 +15,15 @@ along with Moodle. If not, see . }} {{! - @template local_ai_manager/tenantnavbar + @template local_ai_manager/tenantenable - Admin text setting template. - - Context variables required for this template: - * label - form element name - * href - element id - * forceltr - always display as ltr + Template for enabling/disabling the tenant. Example context (json): { + "tenantfullname": "My own tenant", + "checked": true, + "rightsconfiglink": "https://mymoodle.com/linktotherightsconfigtable.php" } }}
diff --git a/templates/tenantnavbar.mustache b/templates/tenantnavbar.mustache index 4464ea7..4c9983c 100644 --- a/templates/tenantnavbar.mustache +++ b/templates/tenantnavbar.mustache @@ -17,15 +17,30 @@ {{! @template local_ai_manager/tenantnavbar - Admin text setting template. - - Context variables required for this template: - * label - form element name - * href - element id - * forceltr - always display as ltr - Example context (json): { + "tenantidentifier": "tenantname", + "homeactive": true, + "purposeconfigactive": false, + "userconfigactive": false, + "quotaconfigactive": false, + "rightsconfigactive": false, + "statisticsactive": false, + "statisticsoverviewactive": false, + "showstatistics": true, + "showuserstatistics": true, + "statisticspurposes": [ + { + "pluginname": "chat", + "fullname": "Chat", + "active": true + }, + { + "pluginname": "imggen", + "fullname": "Image Generation", + "active": false + } + ] } }}
@@ -49,7 +64,7 @@ aria-expanded="false"> {{#str}} userconfig, local_ai_manager {{/str}} -
{{#str}}table_heading_purpose, local_ai_manager{{/str}}{{#str}}table_heading_instance_name, local_ai_manager{{/str}}{{#str}}table_heading_model, local_ai_manager{{/str}}{{#str}}table_heading_infolink, local_ai_manager{{/str}}
{{#str}}table_heading_purpose, local_ai_manager{{/str}}{{#str}}table_heading_instance_name, local_ai_manager{{/str}}{{#str}}table_heading_model, local_ai_manager{{/str}}{{#str}}table_heading_infolink, local_ai_manager{{/str}}
{{purpose}} {{name}} {{model}}{{infolink}}{{infolink}}