%PDF- %PDF-
Direktori : /home/vacivi36/ava/message/amd/build/ |
Current File : /home/vacivi36/ava/message/amd/build/preferences_processor_form.min.js |
/** * Manages the processor form on the message preferences page. * * @module core_message/preferences_processor_form * @copyright 2016 Ryan Wyllie <ryan@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define("core_message/preferences_processor_form",["jquery","core/ajax","core/notification"],(function($,Ajax,Notification){var ProcessorForm=function(element){this.root=$(element),this.userId=this.root.attr("data-user-id"),this.name=this.root.attr("data-processor-name"),this.root.find("form").on("submit",function(e){e.preventDefault(),this.save().done((function(){$(element).trigger("mpp:formsubmitted")}))}.bind(this))};return ProcessorForm.prototype.startLoading=function(){this.root.addClass("loading")},ProcessorForm.prototype.stopLoading=function(){this.root.removeClass("loading")},ProcessorForm.prototype.isLoading=function(){return this.root.hasClass("loading")},ProcessorForm.prototype.save=function(){if(this.isLoading())return $.Deferred();this.startLoading();var data=this.root.find("form").serializeArray(),request={methodname:"core_message_message_processor_config_form",args:{userid:this.userId,name:this.name,formvalues:data}};return Ajax.call([request])[0].fail(Notification.exception).always(function(){this.stopLoading()}.bind(this))},ProcessorForm})); //# sourceMappingURL=preferences_processor_form.min.js.map