Skip to content

Commit bfdc024

Browse files
committed
Merge branch 'MDL-65788-37' of git://github.com/Chocolate-lightning/moodle into MOODLE_37_STABLE
2 parents f7ade22 + ebe8a67 commit bfdc024

File tree

6 files changed

+14
-22
lines changed

6 files changed

+14
-22
lines changed

admin/tool/policy/amd/build/policyactions.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

admin/tool/policy/amd/src/policyactions.js

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,18 @@ define([
2929
'core/modal_events'],
3030
function($, Ajax, Notification, ModalFactory, ModalEvents) {
3131

32-
/**
33-
* List of action selectors.
34-
*
35-
* @type {{VIEW_POLICY: string}}
36-
*/
37-
var ACTIONS = {
38-
VIEW_POLICY: '[data-action="view"]'
39-
};
40-
4132
/**
4233
* PolicyActions class.
4334
*/
44-
var PolicyActions = function() {
45-
this.registerEvents();
35+
var PolicyActions = function(root) {
36+
this.registerEvents(root);
4637
};
4738

4839
/**
4940
* Register event listeners.
5041
*/
51-
PolicyActions.prototype.registerEvents = function() {
52-
$(ACTIONS.VIEW_POLICY).click(function(e) {
42+
PolicyActions.prototype.registerEvents = function(root) {
43+
root.on("click", function(e) {
5344
e.preventDefault();
5445

5546
var versionid = $(this).data('versionid');
@@ -127,8 +118,9 @@ function($, Ajax, Notification, ModalFactory, ModalEvents) {
127118
* @method init
128119
* @return {PolicyActions}
129120
*/
130-
'init': function() {
131-
return new PolicyActions();
121+
'init': function(root) {
122+
root = $(root);
123+
return new PolicyActions(root);
132124
}
133125
};
134126
});

admin/tool/policy/classes/form/accept_policy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function definition() {
111111
}
112112
}
113113

114-
$PAGE->requires->js_call_amd('tool_policy/policyactions', 'init');
114+
$PAGE->requires->js_call_amd('tool_policy/policyactions', 'init', ['[data-action="view"]']);
115115
}
116116

117117
/**
@@ -197,4 +197,4 @@ public function process() {
197197
}
198198
}
199199
}
200-
}
200+
}

admin/tool/policy/templates/guestconsent.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ require(['jquery', 'tool_policy/jquery-eu-cookie-law-popup', 'tool_policy/policy
5858
"<ul>{{#policies}}" +
5959
"<li>" +
6060
"<a href=\"{{pluginbaseurl}}/view.php?versionid={{id}}{{#returnurl}}&amp;returnurl={{.}}{{/returnurl}}\" " +
61-
" data-action=\"view\" data-versionid=\"{{id}}\" data-behalfid=\"1\" >" +
61+
" data-action=\"view-guest\" data-versionid=\"{{id}}\" data-behalfid=\"1\" >" +
6262
"{{{name}}}" +
6363
"</a>" +
6464
"</li>" +
@@ -81,7 +81,7 @@ require(['jquery', 'tool_policy/jquery-eu-cookie-law-popup', 'tool_policy/policy
8181
{{/haspolicies}}
8282

8383
// Initialise the JS for the modal window which displays the policy versions.
84-
ActionsMod.init();
84+
ActionsMod.init('[data-action="view-guest"]');
8585
});
8686
});
8787

admin/tool/policy/templates/page_agreedocs.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,6 @@
143143
{{#js}}
144144
// Initialise the JS for the modal window which displays the policy versions.
145145
require(['tool_policy/policyactions'], function(ActionsMod) {
146-
ActionsMod.init();
146+
ActionsMod.init('[data-action="view"]');
147147
});
148148
{{/js}}

admin/tool/policy/templates/page_nopermission.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,6 @@
7373
{{#js}}
7474
// Initialise the JS for the modal window which displays the policy versions.
7575
require(['tool_policy/policyactions'], function(ActionsMod) {
76-
ActionsMod.init();
76+
ActionsMod.init('[data-action="view"]');
7777
});
7878
{{/js}}

0 commit comments

Comments
 (0)