on-demand release 4.0dev+
[moodle.git] / message / amd / build / preferences_processor_form.min.js
CommitLineData
195ea448
RW
1define ("core_message/preferences_processor_form",["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))};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))};return d});
2//# sourceMappingURL=preferences_processor_form.min.js.map