MDL-61575 message_notification: replace lp/dialogue with core/modal
[moodle.git] / message / amd / build / preferences_processor_form.min.js
1 define(["jquery","core/ajax","core/notification"],function(a,b,c){var d=function(b){this.root=a(b),this.userId=this.root.attr("data-user-id"),this.name=this.root.attr("data-processor-name"),this.root.find("form").on("submit",function(c){c.preventDefault(),this.save().done(function(){a(b).trigger("mpp:formsubmitted")})}.bind(this))};return d.prototype.startLoading=function(){this.root.addClass("loading")},d.prototype.stopLoading=function(){this.root.removeClass("loading")},d.prototype.isLoading=function(){return this.root.hasClass("loading")},d.prototype.save=function(){if(this.isLoading())return a.Deferred();this.startLoading();var d=this.root.find("form").serializeArray(),e={methodname:"core_message_message_processor_config_form",args:{userid:this.userId,name:this.name,formvalues:d}};return b.call([e])[0].fail(c.exception).always(function(){this.stopLoading()}.bind(this))},d});