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/grade_dialogue.min.js.map

{"version":3,"sources":["../src/grade_dialogue.js"],"names":["define","$","Notification","Templates","Dialogue","EventBase","Str","Grade","ratingOptions","prototype","constructor","apply","_ratingOptions","Object","create","_popup","_afterRender","btnRate","_find","lstRating","txtComment","click","e","preventDefault","_trigger","close","bind","change","node","val","prop","display","M","util","js_pending","when","get_string","_render","then","title","templateResult","js_complete","catch","exception","selector","getContent","find","context","cangrade","_canGrade","ratings","render"],"mappings":"AAuBAA,OAAM,0BAAC,CAAC,QAAD,CACC,mBADD,CAEC,gBAFD,CAGC,kBAHD,CAIC,oBAJD,CAKC,UALD,CAAD,CAME,SAASC,CAAT,CAAYC,CAAZ,CAA0BC,CAA1B,CAAqCC,CAArC,CAA+CC,CAA/C,CAA0DC,CAA1D,CAA+D,CAMnE,GAAIC,CAAAA,CAAK,CAAG,SAASC,CAAT,CAAwB,CAChCH,CAAS,CAACI,SAAV,CAAoBC,WAApB,CAAgCC,KAAhC,CAAsC,IAAtC,CAA4C,EAA5C,EACA,KAAKC,cAAL,CAAsBJ,CACzB,CAHD,CAIAD,CAAK,CAACE,SAAN,CAAkBI,MAAM,CAACC,MAAP,CAAcT,CAAS,CAACI,SAAxB,CAAlB,CAGAF,CAAK,CAACE,SAAN,CAAgBM,MAAhB,CAAyB,IAAzB,CAEAR,CAAK,CAACE,SAAN,CAAgBG,cAAhB,CAAiC,IAAjC,CAQAL,CAAK,CAACE,SAAN,CAAgBO,YAAhB,CAA+B,UAAW,CACtC,GAAIC,CAAAA,CAAO,CAAG,KAAKC,KAAL,CAAW,wBAAX,CAAd,CACIC,CAAS,CAAG,KAAKD,KAAL,CAAW,mBAAX,CADhB,CAEIE,CAAU,CAAG,KAAKF,KAAL,CAAW,oBAAX,CAFjB,CAIA,KAAKA,KAAL,CAAW,0BAAX,EAAqCG,KA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CACVmC,CADU,CAEVC,CAAc,CAAC,CAAD,CAFJ,CAGV,UAAW,CACP,KAAKxB,YAAL,GACAgB,CAAC,CAACC,IAAF,CAAOQ,WAAP,CAAmB,gCAAnB,CACH,CAHD,CAGEf,IAHF,CAGO,IAHP,CAHU,CAAd,CASA,MAAO,MAAKX,MACf,CAXK,CAWJW,IAXI,CAWC,IAXD,CAJC,EAgBNgB,KAhBM,CAgBAxC,CAAY,CAACyC,SAhBb,CAiBV,CAnBD,CA6BApC,CAAK,CAACE,SAAN,CAAgBS,KAAhB,CAAwB,SAAS0B,CAAT,CAAmB,CACvC,MAAO3C,CAAAA,CAAC,CAAC,KAAKc,MAAL,CAAY8B,UAAZ,EAAD,CAAD,CAA4BC,IAA5B,CAAiCF,CAAjC,CACV,CAFD,CAWArC,CAAK,CAACE,SAAN,CAAgB4B,OAAhB,CAA0B,UAAW,CACjC,GAAIU,CAAAA,CAAO,CAAG,CACVC,QAAQ,CAAE,KAAKC,SADL,CAEVC,OAAO,CAAE,KAAKtC,cAFJ,CAAd,CAIA,MAAOT,CAAAA,CAAS,CAACgD,MAAV,CAAiB,2BAAjB,CAA8CJ,CAA9C,CACV,CAND,CAQA,MAAmDxC,CAAAA,CAEtD,CAlIK,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 * Grade dialogue.\n *\n * @package    tool_lp\n * @copyright  2016 Frédéric Massart - FMCorz.net\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery',\n        'core/notification',\n        'core/templates',\n        'tool_lp/dialogue',\n        'tool_lp/event_base',\n        'core/str'],\n        function($, Notification, Templates, Dialogue, EventBase, Str) {\n\n    /**\n     * Grade dialogue class.\n     * @param {Array} ratingOptions\n     */\n    var Grade = function(ratingOptions) {\n        EventBase.prototype.constructor.apply(this, []);\n        this._ratingOptions = ratingOptions;\n    };\n    Grade.prototype = Object.create(EventBase.prototype);\n\n    /** @type {Dialogue} The dialogue. */\n    Grade.prototype._popup = null;\n    /** @type {Array} Array of objects containing, 'value', 'name' and optionally 'selected'. */\n    Grade.prototype._ratingOptions = null;\n\n    /**\n     * After render hook.\n     *\n     * @method _afterRender\n     * @protected\n     */\n    Grade.prototype._afterRender = function() {\n        var btnRate = this._find('[data-action=\"rate\"]'),\n            lstRating = this._find('[name=\"rating\"]'),\n            txtComment = this._find('[name=\"comment\"]');\n\n        this._find('[data-action=\"cancel\"]').click(function(e) {\n            e.preventDefault();\n            this._trigger('cancelled');\n            this.close();\n        }.bind(this));\n\n        lstRating.change(function() {\n            var node = $(this);\n            if (!node.val()) {\n                btnRate.prop('disabled', true);\n            } else {\n                btnRate.prop('disabled', false);\n            }\n        }).change();\n\n        btnRate.click(function(e) {\n            e.preventDefault();\n            var val = lstRating.val();\n            if (!val) {\n                return;\n            }\n            this._trigger('rated', {\n                'rating': val,\n                'note': txtComment.val()\n            });\n            this.close();\n        }.bind(this));\n    };\n\n    /**\n     * Close the dialogue.\n     *\n     * @method close\n     */\n    Grade.prototype.close = function() {\n        this._popup.close();\n        this._popup = null;\n    };\n\n    /**\n     * Opens the picker.\n     *\n     * @param {Number} competencyId The competency ID of the competency to work on.\n     * @method display\n     * @return {Promise}\n     */\n    Grade.prototype.display = function() {\n        M.util.js_pending('tool_lp/grade_dialogue:display');\n        return $.when(\n            Str.get_string('rate', 'tool_lp'),\n            this._render()\n        )\n        .then(function(title, templateResult) {\n            this._popup = new Dialogue(\n                title,\n                templateResult[0],\n                function() {\n                    this._afterRender();\n                    M.util.js_complete('tool_lp/grade_dialogue:display');\n                }.bind(this)\n            );\n\n            return this._popup;\n        }.bind(this))\n        .catch(Notification.exception);\n    };\n\n    /**\n     * Find a node in the dialogue.\n     *\n     * @param {String} selector\n     * @method _find\n     * @returns {node} The node\n     * @protected\n     */\n    Grade.prototype._find = function(selector) {\n        return $(this._popup.getContent()).find(selector);\n    };\n\n    /**\n     * Render the dialogue.\n     *\n     * @method _render\n     * @protected\n     * @return {Promise}\n     */\n    Grade.prototype._render = function() {\n        var context = {\n            cangrade: this._canGrade,\n            ratings: this._ratingOptions\n        };\n        return Templates.render('tool_lp/competency_grader', context);\n    };\n\n    return /** @alias module:tool_lp/grade_dialogue */ Grade;\n\n});\n"],"file":"grade_dialogue.min.js"}