Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mod/assign/feedback/onenote/amd/build/onenotedelete.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 20 additions & 11 deletions mod/assign/feedback/onenote/amd/src/onenotedelete.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
define(['jquery', 'core/templates', 'core/ajax', 'core/notification', 'core/str', 'core/modal_factory', 'core/modal_events'],
function($, templates, ajax, notification, Str, ModalFactory, ModalEvents) {
define(['jquery', 'core/ajax', 'core/notification', 'core/str', 'core/modal_delete_cancel', 'core/modal_events'],
function($, ajax, notification, Str, ModalDeleteCancel, ModalEvents) {
Comment thread
patmr7 marked this conversation as resolved.
return {
init: function() {
var trigger = $('#deleteuserfeedback');
var gradeid = $(trigger).attr('gradeid');
var contextid = $(trigger).attr('contextid');
var userid = $(trigger).attr('userid');
ModalFactory.create({
type: ModalFactory.types.SAVE_CANCEL,
title: Str.get_string('deletefeedbackconfirm', 'assignfeedback_onenote'),
body: Str.get_string('deletefeedbackconfirmdetail', 'assignfeedback_onenote'),
}, trigger)
.done(function(modal) {
modal.getRoot().on(ModalEvents.save, function(e) {
// Stop the default save button behaviour which is to close the modal.

trigger.on('click', function(e) {
e.preventDefault();
Str.get_strings([
{key: 'deletefeedbackconfirm', component: 'assignfeedback_onenote'},
{key: 'deletefeedbackconfirmdetail', component: 'assignfeedback_onenote'},
]).then(function(strings) {
return ModalDeleteCancel.create({
title: strings[0],
body: strings[1],
});
}).then(function(modal) {
modal.getRoot().on(ModalEvents.delete, function(e) {
// Stop the default delete button behaviour which is to close the modal.
e.preventDefault();
Comment thread
Copilot marked this conversation as resolved.
var requests = ajax.call([{
methodname: 'mod_assign_feedback_onenote_delete',
Expand All @@ -24,7 +30,10 @@ define(['jquery', 'core/templates', 'core/ajax', 'core/notification', 'core/str'
location.reload();
}).fail(notification.exception);
});
});
modal.show();
return modal;
}).catch(notification.exception);
});
}
};
}
Expand Down