Proyectos de Subversion Moodle

Rev

Autoría | Ultima modificación | Ver Log |

{"version":3,"file":"competency_outcomes.min.js","sources":["../src/competency_outcomes.js"],"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 * Competency rule config.\n *\n * @module     tool_lp/competency_outcomes\n * @copyright  2015 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/str'],\n        function($, Str) {\n\n    var OUTCOME_NONE = 0,\n        OUTCOME_EVIDENCE = 1,\n        OUTCOME_COMPLETE = 2,\n        OUTCOME_RECOMMEND = 3;\n\n    return {\n\n        NONE: OUTCOME_NONE,\n        EVIDENCE: OUTCOME_EVIDENCE,\n        COMPLETE: OUTCOME_COMPLETE,\n        RECOMMEND: OUTCOME_RECOMMEND,\n\n        /**\n         * Get all the outcomes.\n         *\n         * @return {Object} Indexed by outcome code, contains code and name.\n         * @method getAll\n         */\n        getAll: function() {\n            var self = this;\n            return Str.get_strings([\n                {key: 'competencyoutcome_none', component: 'tool_lp'},\n                {key: 'competencyoutcome_evidence', component: 'tool_lp'},\n                {key: 'competencyoutcome_recommend', component: 'tool_lp'},\n                {key: 'competencyoutcome_complete', component: 'tool_lp'},\n            ]).then(function(strings) {\n                var outcomes = {};\n                outcomes[self.NONE] = {code: self.NONE, name: strings[0]};\n                outcomes[self.EVIDENCE] = {code: self.EVIDENCE, name: strings[1]};\n                outcomes[self.RECOMMEND] = {code: self.RECOMMEND, name: strings[2]};\n                outcomes[self.COMPLETE] = {code: self.COMPLETE, name: strings[3]};\n                return outcomes;\n            });\n        },\n\n        /**\n         * Get the string for an outcome.\n         *\n         * @param  {Number} id The outcome code.\n         * @return {Promise} Resolved with the string.\n         * @method getString\n         */\n        getString: function(id) {\n            var self = this,\n                all = self.getAll();\n\n            return all.then(function(outcomes) {\n                if (typeof outcomes[id] === 'undefined') {\n                    return $.Deferred().reject().promise();\n                }\n                return outcomes[id].name;\n            });\n        }\n    };\n});\n"],"names":["define","$","Str","NONE","EVIDENCE","COMPLETE","RECOMMEND","getAll","self","this","get_strings","key","component","then","strings","outcomes","code","name","getString","id","Deferred","reject","promise"],"mappings":";;;;;;;AAuBAA,qCAAO,CAAC,SACA,aACA,SAASC,EAAGC,WAOT,CAEHC,KAPe,EAQfC,SAPmB,EAQnBC,SAPmB,EAQnBC,UAPoB,EAepBC,OAAQ,eACAC,KAAOC,YACJP,IAAIQ,YAAY,CACnB,CAACC,IAAK,yBAA0BC,UAAW,WAC3C,CAACD,IAAK,6BAA8BC,UAAW,WAC/C,CAACD,IAAK,8BAA+BC,UAAW,WAChD,CAACD,IAAK,6BAA8BC,UAAW,aAChDC,MAAK,SAASC,aACTC,SAAW,UACfA,SAASP,KAAKL,MAAQ,CAACa,KAAMR,KAAKL,KAAMc,KAAMH,QAAQ,IACtDC,SAASP,KAAKJ,UAAY,CAACY,KAAMR,KAAKJ,SAAUa,KAAMH,QAAQ,IAC9DC,SAASP,KAAKF,WAAa,CAACU,KAAMR,KAAKF,UAAWW,KAAMH,QAAQ,IAChEC,SAASP,KAAKH,UAAY,CAACW,KAAMR,KAAKH,SAAUY,KAAMH,QAAQ,IACvDC,aAWfG,UAAW,SAASC,WACLV,KACIF,SAEJM,MAAK,SAASE,sBACO,IAAjBA,SAASI,IACTlB,EAAEmB,WAAWC,SAASC,UAE1BP,SAASI,IAAIF"}