Your IP : 192.168.165.1


Current Path : C:/xampp/htdocs/moodle/admin/tool/lp/amd/build/
Upload File :
Current File : C:/xampp/htdocs/moodle/admin/tool/lp/amd/build/course_competency_settings.min.js.map

{"version":3,"sources":["../src/course_competency_settings.js"],"names":["define","$","notification","Dialogue","str","ajax","templates","Pending","settingsMod","selector","on","configureSettings","bind","prototype","_dialogue","e","pendingPromise","courseid","target","closest","data","currentValue","preventDefault","when","get_string","render","settings","pushratingstouserplans","then","title","templateResult","addListeners","resolve","catch","exception","save","_find","saveSettings","cancel","cancelChanges","close","find","newValue","val","courseId","call","methodname","args","refreshCourseCompetenciesPage","moduleid","context","html","js","replaceNode"],"mappings":"AAuBAA,OAAM,sCAAC,CAAC,QAAD,CACC,mBADD,CAEC,kBAFD,CAGC,UAHD,CAIC,WAJD,CAKC,gBALD,CAMC,cAND,CAAD,CAQC,SAASC,CAAT,CAAYC,CAAZ,CAA0BC,CAA1B,CAAoCC,CAApC,CAAyCC,CAAzC,CAA+CC,CAA/C,CAA0DC,CAA1D,CAAmE,CAOtE,GAAIC,CAAAA,CAAW,CAAG,SAASC,CAAT,CAAmB,CACjCR,CAAC,CAACQ,CAAD,CAAD,CAAYC,EAAZ,CAAe,OAAf,CAAwB,KAAKC,iBAAL,CAAuBC,IAAvB,CAA4B,IAA5B,CAAxB,CACH,CAFD,CAKAJ,CAAW,CAACK,SAAZ,CAAsBC,SAAtB,CAAkC,IAAlC,CAQAN,CAAW,CAACK,SAAZ,CAAsBF,iBAAtB,CAA0C,SAASI,CAAT,CAAY,IAC9CC,CAAAA,CAAc,CAAG,GAAIT,CAAAA,CADyB,CAE9CU,CAAQ,CAAGhB,CAAC,CAACc,CAAC,CAACG,MAAH,CAAD,CAAYC,OAAZ,CAAoB,GAApB,EAAyBC,IAAzB,CAA8B,UAA9B,CAFmC,CAG9CC,CAAY,CAAGpB,CAAC,CAACc,CAAC,CAACG,MAAH,CAAD,CAAYC,OAAZ,CAAoB,GAApB,EAAyBC,IAAzB,CA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,MAAV,CAAiB,kCAAjB,CAAqDyB,CAArD,CACV,CAND,EAOCtB,IAPD,CAOM,SAASuB,CAAT,CAAeC,CAAf,CAAmB,CACrB9C,CAAS,CAAC+C,WAAV,CAAsBpD,CAAC,CAAC,0CAAD,CAAvB,CAAmEkD,CAAnE,CAAyEC,CAAzE,EACA,KAAKtC,SAAL,CAAe0B,KAAf,EAGH,CALK,CAKJ5B,IALI,CAKC,IALD,CAPN,EAaCgB,IAbD,CAaMZ,CAAc,CAACgB,OAbrB,EAcCC,KAdD,CAcO/B,CAAY,CAACgC,SAdpB,CAeH,CAnBD,CAqBA,MAAsE1B,CAAAA,CACzE,CA9IK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Change the course competency settings in a popup.\n *\n * @module     tool_lp/configurecoursecompetencysettings\n * @package    tool_lp\n * @copyright  2015 Damyon Wiese <damyon@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery',\n        'core/notification',\n        'tool_lp/dialogue',\n        'core/str',\n        'core/ajax',\n        'core/templates',\n        'core/pending'\n        ],\n       function($, notification, Dialogue, str, ajax, templates, Pending) {\n\n    /**\n     * Constructor\n     *\n     * @param {String} selector - selector for the links to open the dialogue.\n     */\n    var settingsMod = function(selector) {\n        $(selector).on('click', this.configureSettings.bind(this));\n    };\n\n    /** @type {Dialogue} Reference to the dialogue that we opened. */\n    settingsMod.prototype._dialogue = null;\n\n    /**\n     * Open the configure settings dialogue.\n     *\n     * @param {Event} e\n     * @method configureSettings\n     */\n    settingsMod.prototype.configureSettings = function(e) {\n        var pendingPromise = new Pending();\n        var courseid = $(e.target).closest('a').data('courseid');\n        var currentValue = $(e.target).closest('a').data('pushratingstouserplans');\n        var context = {\n            courseid: courseid,\n            settings: {pushratingstouserplans: currentValue}\n        };\n        e.preventDefault();\n\n        $.when(\n            str.get_string('configurecoursecompetencysettings', 'tool_lp'),\n            templates.render('tool_lp/course_competency_settings', context),\n        )\n        .then(function(title, templateResult) {\n            this._dialogue = new Dialogue(\n                title,\n                templateResult[0],\n                this.addListeners.bind(this)\n            );\n\n            return this._dialogue;\n        }.bind(this))\n        .then(pendingPromise.resolve)\n        .catch(notification.exception);\n    };\n\n    /**\n     * Add the save listener to the form.\n     *\n     * @method addSaveListener\n     */\n    settingsMod.prototype.addListeners = function() {\n        var save = this._find('[data-action=\"save\"]');\n        save.on('click', this.saveSettings.bind(this));\n        var cancel = this._find('[data-action=\"cancel\"]');\n        cancel.on('click', this.cancelChanges.bind(this));\n    };\n\n    /**\n     * Cancel the changes.\n     *\n     * @param {Event} e\n     * @method cancelChanges\n     */\n    settingsMod.prototype.cancelChanges = function(e) {\n        e.preventDefault();\n        this._dialogue.close();\n    };\n\n    /**\n     * Cancel the changes.\n     *\n     * @param {String} selector\n     * @return {JQuery}\n     */\n    settingsMod.prototype._find = function(selector) {\n        return $('[data-region=\"coursecompetencysettings\"]').find(selector);\n    };\n\n    /**\n     * Save the settings.\n     *\n     * @param {Event} e\n     * @method saveSettings\n     */\n    settingsMod.prototype.saveSettings = function(e) {\n        var pendingPromise = new Pending();\n        e.preventDefault();\n\n        var newValue = this._find('input[name=\"pushratingstouserplans\"]:checked').val();\n        var courseId = this._find('input[name=\"courseid\"]').val();\n        var settings = {pushratingstouserplans: newValue};\n\n        ajax.call([\n            {methodname: 'core_competency_update_course_competency_settings',\n              args: {courseid: courseId, settings: settings}}\n        ])[0]\n        .then(function() {\n            return this.refreshCourseCompetenciesPage();\n        }.bind(this))\n        .then(pendingPromise.resolve)\n        .catch(notification.exception);\n\n    };\n\n    /**\n     * Refresh the course competencies page.\n     *\n     * @param {Event} e\n     * @method saveSettings\n     */\n    settingsMod.prototype.refreshCourseCompetenciesPage = function() {\n        var courseId = this._find('input[name=\"courseid\"]').val();\n        var pendingPromise = new Pending();\n\n        ajax.call([\n            {methodname: 'tool_lp_data_for_course_competencies_page',\n              args: {courseid: courseId, moduleid: 0}}\n        ])[0]\n        .then(function(context) {\n            return templates.render('tool_lp/course_competencies_page', context);\n        })\n        .then(function(html, js) {\n            templates.replaceNode($('[data-region=\"coursecompetenciespage\"]'), html, js);\n            this._dialogue.close();\n\n            return;\n        }.bind(this))\n        .then(pendingPromise.resolve)\n        .catch(notification.exception);\n    };\n\n    return /** @alias module:tool_lp/configurecoursecompetencysettings */ settingsMod;\n});\n"],"file":"course_competency_settings.min.js"}