mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-50308 tool_lp: Big javascript cleanup
This includes: * Move all JS modules from lib/amd to admin/tool/lp/amd * Add all jsdocs * fix all jshint warnings * Rewrite the actionmenu wrapper to a real amd module
This commit is contained in:
parent
d629323f72
commit
7e8d4dac9b
41 changed files with 1805 additions and 398 deletions
|
@ -20,7 +20,7 @@
|
|||
Classes required for JS:
|
||||
|
||||
Data attibutes required for JS:
|
||||
* data-enhance=tree
|
||||
* data-enhance=movetree
|
||||
|
||||
Context variables required for this template:
|
||||
* framework -
|
||||
|
|
|
@ -56,51 +56,54 @@
|
|||
</p>
|
||||
{{#canmanage}}
|
||||
<div data-region="competencyactions">
|
||||
<div class="btn-group">
|
||||
<button class="btn" data-action="add" disabled="disabled">{{#pix}}t/add{{/pix}} {{#str}}addcompetency, tool_lp{{/str}}</button>
|
||||
</div>
|
||||
<div data-region="competencyactionsmenu">
|
||||
<ul class="competencyactionsmenu">
|
||||
<span data-region="competencyactionsmenu">
|
||||
<ul title="{{#str}}edit{{/str}}" class="competencyactionsmenu">
|
||||
<li>
|
||||
<a href="#" data-action="edit">
|
||||
{{#pix}}t/edit{{/pix}}{{#str}}edit{{/str}}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" data-action="move">
|
||||
{{#pix}}t/move{{/pix}}{{#str}}movetonewparent, tool_lp{{/str}}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" data-action="delete">
|
||||
{{#pix}}t/delete{{/pix}}{{#str}}delete{{/str}}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" data-action="moveup">
|
||||
{{#pix}}t/up{{/pix}}{{#str}}moveup{{/str}}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" data-action="movedown">
|
||||
{{#pix}}t/down{{/pix}}{{#str}}movedown{{/str}}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" data-action="linkedcourses">
|
||||
{{#pix}}t/viewdetails{{/pix}}{{#str}}linkedcourses, tool_lp{{/str}}
|
||||
</a>
|
||||
<a href="#">{{#str}}edit{{/str}}</a><b class="caret"></b>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<a href="#" data-action="edit">
|
||||
{{#pix}}t/edit{{/pix}} {{#str}}edit{{/str}}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" data-action="move">
|
||||
{{#pix}}t/move{{/pix}} {{#str}}movetonewparent, tool_lp{{/str}}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" data-action="delete">
|
||||
{{#pix}}t/delete{{/pix}} {{#str}}delete{{/str}}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" data-action="moveup">
|
||||
{{#pix}}t/up{{/pix}} {{#str}}moveup{{/str}}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" data-action="movedown">
|
||||
{{#pix}}t/down{{/pix}} {{#str}}movedown{{/str}}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" data-action="linkedcourses">
|
||||
{{#pix}}t/viewdetails{{/pix}} {{#str}}linkedcourses, tool_lp{{/str}}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{{/canmanage}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{#js}}
|
||||
// Initialise the JS.
|
||||
require(['core/tree', 'tool_lp/competencytree', 'tool_lp/competencyactions' ], function(ariatree, treeModel, actions) {
|
||||
require(['tool_lp/tree', 'tool_lp/competencytree', 'tool_lp/competencyactions' ], function(ariatree, treeModel, actions) {
|
||||
|
||||
treeModel.init({{framework.id}});
|
||||
|
||||
|
|
|
@ -50,20 +50,23 @@
|
|||
<td>{{competencies_count}}</td>
|
||||
<td>
|
||||
{{#canmanage}}
|
||||
<div style="display: inline-block;">
|
||||
<ul class="competencyframeworkactions hide">
|
||||
<ul title="{{#str}}edit{{/str}}" class="competencyframeworkactions">
|
||||
<li>
|
||||
<a href="{{pluginbaseurl}}/editcompetencyframework.php?id={{id}}">
|
||||
{{#pix}}t/edit{{/pix}}{{#str}}editthiscompetencyframework, tool_lp{{/str}}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a data-action="deletecompetencyframework" data-frameworkid="{{id}}" href="#">
|
||||
{{#pix}}t/delete{{/pix}}{{#str}}deletethiscompetencyframework, tool_lp{{/str}}
|
||||
</a>
|
||||
<a href="#">{{#str}}edit{{/str}}</a><b class="caret"></b>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<a href="{{pluginbaseurl}}/editcompetencyframework.php?id={{id}}">
|
||||
{{#pix}}t/edit{{/pix}} {{#str}}editthiscompetencyframework, tool_lp{{/str}}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a data-action="deletecompetencyframework" data-frameworkid="{{id}}" href="#">
|
||||
{{#pix}}t/delete{{/pix}} {{#str}}deletethiscompetencyframework, tool_lp{{/str}}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{{/canmanage}}
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -85,14 +88,15 @@
|
|||
{{#js}}
|
||||
// Initialise the JS.
|
||||
require(['tool_lp/frameworkdelete',
|
||||
'core/menu',
|
||||
'tool_lp/menubar',
|
||||
'tool_lp/frameworkmove'],
|
||||
function(deleteMod, menu, moveMod) {
|
||||
function(deleteMod, menubar, moveMod) {
|
||||
|
||||
deleteMod.init();
|
||||
moveMod.init();
|
||||
|
||||
menu.menu('{{#str}}edit{{/str}}', '.competencyframeworkactions');
|
||||
menubar.enhance('.competencyframeworkactions', {
|
||||
"[data-action='deletecompetencyframework']": deleteMod.deleteHandler
|
||||
});
|
||||
});
|
||||
|
||||
{{/js}}
|
||||
|
|
|
@ -48,20 +48,23 @@
|
|||
<td><span class="drag-handlecontainer"></span><span><a href="{{pluginbaseurl}}/templatecompetencies.php?templateid={{id}}">{{shortname}} {{idnumber}}</a></span> {{^visible}}{{#str}}hiddenhint, tool_lp{{/str}}{{/visible}}</td>
|
||||
<td>
|
||||
{{#canmanage}}
|
||||
<div style="display: inline-block;">
|
||||
<ul class="templateactions hide">
|
||||
<ul class="templateactions">
|
||||
<li>
|
||||
<a href="{{pluginbaseurl}}/edittemplate.php?id={{id}}">
|
||||
{{#pix}}t/edit{{/pix}}{{#str}}editthistemplate, tool_lp{{/str}}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a data-action="deletetemplate" data-templateid="{{id}}" href="#">
|
||||
{{#pix}}t/delete{{/pix}}{{#str}}deletethistemplate, tool_lp{{/str}}
|
||||
</a>
|
||||
<a href="#">{{#str}}edit{{/str}}</a><b class="caret"></b>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<a href="{{pluginbaseurl}}/edittemplate.php?id={{id}}">
|
||||
{{#pix}}t/edit{{/pix}} {{#str}}editthistemplate, tool_lp{{/str}}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a data-action="deletetemplate" data-templateid="{{id}}" href="#">
|
||||
{{#pix}}t/delete{{/pix}} {{#str}}deletethistemplate, tool_lp{{/str}}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{{/canmanage}}
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -83,14 +86,15 @@
|
|||
{{#js}}
|
||||
// Initialise the JS.
|
||||
require(['tool_lp/templatedelete',
|
||||
'core/menu',
|
||||
'tool_lp/menubar',
|
||||
'tool_lp/templatemove'],
|
||||
function(deleteMod, menu, moveMod) {
|
||||
function(deleteMod, menubar, moveMod) {
|
||||
|
||||
deleteMod.init();
|
||||
moveMod.init();
|
||||
|
||||
menu.menu('{{#str}}edit{{/str}}', '.templateactions');
|
||||
menubar.enhance('.templateactions', {
|
||||
'[data-action="deletetemplate"]': deleteMod.deleteHandler
|
||||
});
|
||||
});
|
||||
|
||||
{{/js}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue