Skip to content

Commit

Permalink
MBS-9310: Cleanup mustache files for pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
PhMemmel committed Aug 26, 2024
1 parent 279495f commit 5129438
Show file tree
Hide file tree
Showing 16 changed files with 161 additions and 406 deletions.
59 changes: 0 additions & 59 deletions templates/admin_setting_tabs.mustache

This file was deleted.

27 changes: 27 additions & 0 deletions templates/ai_info_warning.mustache
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
}}
{{!
@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"
}
}}
<div class="local_ai_manager-info-warning">
<p class="local_ai_manager-info-warning-text">{{#str}}aiwarning, local_ai_manager{{/str}}</p>
{{#showaiwarninglink}}
Expand Down
10 changes: 3 additions & 7 deletions templates/confirm_ai_usage.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,13 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@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"
}
}}
<div class="local_ai_manager-confirm_ai_usage mt-0 mb-5">
Expand Down
10 changes: 3 additions & 7 deletions templates/edit_instance_heading.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}}
<div class="d-flex justify-content-between mb-5 align-items-center w-100" style="max-width: 80%">
Expand Down
8 changes: 2 additions & 6 deletions templates/infobox.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}}
<div class="local_ai_manager-infobox">
Expand Down
19 changes: 13 additions & 6 deletions templates/instanceaddmodal.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
39 changes: 30 additions & 9 deletions templates/instancetable.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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": "<a href=\"...\">Not assigned to any purposes</a>"
},
{
"name": "my second instance",
"toolname": "dalle",
"model": "dalle-3",
"purposes": [
{
"fullname": "Image generation"
}
],
"nopurposeslink": "<a href=\"...\">Not assigned to any purposes</a>"
}
]
}
}}
<hr>
Expand Down
38 changes: 26 additions & 12 deletions templates/purpose_info.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}
}}
<div class="local_ai_manager-purposeinfo">
Expand All @@ -48,26 +60,28 @@

<h4>{{#str}}privacy_terms_heading, local_ai_manager{{/str}}</h4>
<p>
{{#str}}privacy_terms_text1, local_ai_manager{{/str}}<br/>
{{#str}}privacy_terms_text1, local_ai_manager{{/str}}<br>
{{{termsofuse}}}
</p>
<p>{{#str}}privacy_terms_text2, local_ai_manager{{/str}}</p>
</div>

<table class="table table-bordered">
<thead>
<th>{{#str}}table_heading_purpose, local_ai_manager{{/str}}</th>
<th>{{#str}}table_heading_instance_name, local_ai_manager{{/str}}</th>
<th>{{#str}}table_heading_model, local_ai_manager{{/str}}</th>
<th>{{#str}}table_heading_infolink, local_ai_manager{{/str}}</th>
<tr>
<th>{{#str}}table_heading_purpose, local_ai_manager{{/str}}</th>
<th>{{#str}}table_heading_instance_name, local_ai_manager{{/str}}</th>
<th>{{#str}}table_heading_model, local_ai_manager{{/str}}</th>
<th>{{#str}}table_heading_infolink, local_ai_manager{{/str}}</th>
</tr>
</thead>
<tbody>
{{#purposes}}
<tr class="{{#highlight}}alert-info{{/highlight}}">
<td>{{purpose}}</td>
<td>{{name}}</td>
<td>{{model}}</td>
<td><a href="{{infolink}}">{{infolink}}</a></td>
<td><a href="{{{infolink}}}">{{infolink}}</a></td>
</tr>
{{/purposes}}
</tbody>
Expand Down
12 changes: 5 additions & 7 deletions templates/tenantenable.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@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"
}
}}
<div class="local_ai_manager-tenantenable mt-0 mb-5">
Expand Down
35 changes: 25 additions & 10 deletions templates/tenantnavbar.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
}
}}
<div class="secondary-navigation">
Expand All @@ -49,7 +64,7 @@
aria-expanded="false">
{{#str}} userconfig, local_ai_manager {{/str}}
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<div class="dropdown-menu">
<a class="dropdown-item{{#quotaconfigactive}} active active_tree_node{{/quotaconfigactive}}"{{!
}} href="{{config.wwwroot}}/local/ai_manager/quota_config.php?tenant={{tenantidentifier}}">
{{#str}} quotaconfig, local_ai_manager {{/str}}
Expand All @@ -63,12 +78,12 @@

{{#showstatistics}}
<li class="navitem dropdown">
<a class="nav-link dropdown-toggle{{#statisticsactive}} active active_tree_node{{/statisticsactive}}" href="#" id="local_ai_manager_user_configuration_dropdown"
<a class="nav-link dropdown-toggle{{#statisticsactive}} active active_tree_node{{/statisticsactive}}" href="#" id="local_ai_manager_statistics_configuration_dropdown"
role="button" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false">{{!
}} {{#str}} heading_statistics, local_ai_manager {{/str}}
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<div class="dropdown-menu">
<a class="dropdown-item{{#statisticsoverviewactive}} active active_tree_node{{/statisticsoverviewactive}}"{{!
}} href="{{config.wwwroot}}/local/ai_manager/statistics.php?tenant={{tenantidentifier}}&tsort=requestcount&tdir=3">
{{#str}} statisticsoverview, local_ai_manager {{/str}}
Expand Down
Loading

0 comments on commit 5129438

Please sign in to comment.