//>>built
require({cache:{"url:app/ui/dialogs/templates/ManageLanguagesDialog.html":'\x3cdiv class\x3d"dijitDialog" role\x3d"dialog" aria-labelledby\x3d"manageLanguagesDialog_title"\x3e\n  \x3cdiv data-dojo-attach-point\x3d"titleBar" class\x3d"dijitDialogTitleBar"\x3e\n    \x3cspan data-dojo-attach-point\x3d"titleNode" class\x3d"dijitDialogTitle" role\x3d"heading"\x3e\x3c/span\x3e\n\t\t\x3cspan data-dojo-attach-point\x3d"closeButtonNode" class\x3d"dijitDialogCloseIcon"\n          data-dojo-attach-event\x3d"ondijitclick: onCancel" title\x3d"Annuleren" role\x3d"button" tabIndex\x3d"-1"\x3e\n\t\t\t\x3cspan data-dojo-attach-point\x3d"closeText" class\x3d"closeText" title\x3d"Annuleren" tabIndex\x3d"-1"\x3e\n        \x3ci class\x3d"fa fa-times"\x3e\x3c/i\x3e\x3c/span\x3e\n\t\t\x3c/span\x3e\n  \x3c/div\x3e\n  \x3cdiv data-dojo-attach-point\x3d"containerNode" class\x3d"dijitDialogPaneContent"\x3e\n    \x3cdiv class\x3d"row"\x3e\n      \x3cdiv class\x3d"large-12 columns"\x3e\n        \x3ch5 style\x3d"margin-top: 0;"\x3eAdd a language\x3c/h5\x3e\n      \x3c/div\x3e\n    \x3c/div\x3e\n    \x3cdiv class\x3d"row"\x3e\n      \x3cdiv class\x3d"large-3 columns"\x3e\n        \x3cdiv class\x3d"placeholder-container"\x3e\n          \x3clabel for\x3d"codeInputNode-${id}"\x3eCode\x3c/label\x3e\n          \x3cinput type\x3d"text" id\x3d"codeInputNode-${id}" data-dojo-attach-point\x3d"codeInputNode" /\x3e\n        \x3c/div\x3e\n      \x3c/div\x3e\n      \x3cdiv class\x3d"large-7 columns"\x3e\n        \x3cdiv class\x3d"placeholder-container"\x3e\n          \x3clabel for\x3d"nameInputNode-${id}"\x3eName\x3c/label\x3e\n          \x3cinput type\x3d"text" id\x3d"nameInputNode-${id}" data-dojo-attach-point\x3d"nameInputNode" /\x3e\n        \x3c/div\x3e\n      \x3c/div\x3e\n      \x3cdiv class\x3d"large-2 columns" style\x3d"padding: 0;"\x3e\n        \x3ca href\x3d"#" data-dojo-attach-event\x3d"onClick: _addLangClick" data-dojo-attach-point\x3d"addButtonNode" style\x3d"float: left; height: 39px;" class\x3d"button tiny"\x3eAdd\x26nbsp;\x26nbsp;\x3ci class\x3d"fa fa-plus"\x3e\x3c/i\x3e\x3c/a\x3e\n      \x3c/div\x3e\n    \x3c/div\x3e\n    \x3cdiv class\x3d"row"\x3e\n      \x3cdiv class\x3d"large-12 columns"\x3e\n        \x3ch5 style\x3d"margin-top: 0; margin-bottom: 10px;"\x3eYou can use \x3ca href\x3d"http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry" target\x3d"_blank" style\x3d"text-decoration: underline;"\x3ethis\x3c/a\x3e list as a reference.\x3c/h5\x3e\n      \x3c/div\x3e\n    \x3c/div\x3e\n    \x3cdiv class\x3d"row"\x3e\n      \x3cdiv class\x3d"large-12 columns"\x3e\n        \x3cdiv data-dojo-attach-point\x3d"langGridNode"\x3e\n        \x3c/div\x3e\n      \x3c/div\x3e\n    \x3c/div\x3e\n    \x3cdiv class\x3d"row footerButtons"\x3e\n      \x3cdiv class\x3d"large-12 columns text-center"\x3e\n        \x3c!--?\x3ca href\x3d"#" data-dojo-attach-event\x3d"onClick: _okClick" data-dojo-attach-point\x3d"okButtonNode" class\x3d"button tiny"\x3eOK\x3c/a\x3e--\x3e\n        \x3ca href\x3d"#" data-dojo-attach-event\x3d"onClick: _cancelClick" class\x3d"button tiny"\x3eClose\x3c/a\x3e\n      \x3c/div\x3e\n    \x3c/div\x3e\n  \x3c/div\x3e\n\x3c/div\x3e'}});
define("app/ui/dialogs/ManageLanguagesDialog","dojo/_base/declare dijit/_TemplatedMixin dijit/_WidgetsInTemplateMixin dijit/Dialog dojo/topic dojo/_base/lang dojo/query dojo/on dojo/when dojo/_base/array dojo/dom-construct dgrid/OnDemandGrid dgrid/extensions/DijitRegistry dgrid/extensions/ColumnResizer dojo/text!./templates/ManageLanguagesDialog.html dijit/ConfirmDialog ../../utils/DomUtils ./LanguageDialog dojo/NodeList-manipulate".split(" "),function(h,m,n,p,d,e,q,f,k,l,g,r,t,u,v,w,y,x){return h([p,
m,n],{templateString:v,parentNode:null,baseClass:"manage-languages-dialog",title:"Manage languages",languageController:null,_langStore:null,_langGrid:null,postCreate:function(){this.inherited(arguments);this._langStore=this.languageController.getLanguageStore();this._langGrid=this._createGrid({collection:this._langStore},this.langGridNode);this._editLanguageDialog=new x({edit:!0});this._editLanguageDialog.startup();f(this._editLanguageDialog,"edit.language",e.hitch(this,function(b){this._editLanguage(b.language)}))},
startup:function(){this.inherited(arguments);this._langGrid.startup();this._langGrid.resize()},_createGrid:function(b,a){var c={id:{label:"ID",field:"id"},name:{label:"Name",field:"name"},actions:{label:"",renderCell:e.hitch(this,function(c){if(void 0===c.id)return null;var a=g.create("div",{"class":"dGridHyperlink"});g.create("a",{href:"#",title:"Edit language",className:"fa fa-pencil",innerHTML:"",onclick:e.hitch(this,function(a){a.preventDefault();this._showEditLanguageDialog(c)})},a);g.create("a",
{href:"#",title:"Remove language",className:"fa fa-trash",innerHTML:"",style:"margin-left: 10px;",onclick:e.hitch(this,function(a){a.preventDefault();this._removeRow(c)})},a);return a})}},c=new (h([r,t,u]))({collection:b.collection,columns:c,noDataMessage:"No languages found",loadingMessage:"Fetching data.."},a);c.on("dgrid-error",function(a){});return c},hide:function(){this.inherited(arguments)},show:function(){this.inherited(arguments);this._reset()},_addLangClick:function(b){b.preventDefault();
this._validate()?k(this._langStore.add({id:this.codeInputNode.value,name:this.nameInputNode.value})).then(e.hitch(this,function(a){d.publish("dGrowl","New language added: "+a.name,{title:"Languages",sticky:!1,channel:"info"});this.languageController.updateLanguageStore();this._langGrid.refresh();this._reset()}),function(a){a=JSON.parse(a.response.data);var c="",b=null;l.forEach(a.errors,function(a){for(b in a)c+="-\x3cem\x3e",c+=b,c+="\x3c/em\x3e: ",c+=a[b],c+="\x3cbr\x3e"});d.publish("dGrowl",c,
{title:a.message,sticky:!0,channel:"error"})}):d.publish("dGrowl","-Please fill in a language code to add a new language.",{title:"Invalid values",sticky:!0,channel:"error"})},_cancelClick:function(b){b.preventDefault();this.hide()},_reset:function(){this._langGrid.resize();this.codeInputNode.value="";this.nameInputNode.value=""},_validate:function(){return""!==this.codeInputNode.value.trim()&&""!==this.codeInputNode.value.trim()?!0:!1},_removeRow:function(b){var a=new w({title:"Delete language",
content:'\x3cp style\x3d"font-size: 15px;"\x3eAre you sure you want to remove \x3cstrong\x3e'+b.name+"\x3c/strong\x3e (ID: "+b.id+")?\x3c/p\x3e",baseClass:"confirm-dialog"});q(".dijitButton",a.domNode).addClass("button tiny");a.closeText.innerHTML='\x3ci class\x3d"fa fa-times"\x3e\x3c/i\x3e';f(a,"close",function(){a.destroy()});f(a,"execute",e.hitch(this,function(){this._langStore.remove(b.id).then(function(a){d.publish("dGrowl","Language removed: "+a.name+" ("+a.id+")",{title:"Languages",sticky:!1,
channel:"info"});this.languageController.updateLanguageStore();this._langGrid.refresh();this._reset()},function(a){(a.response&&"409"===a.response.status||409===a.response.status)&&d.publish("dGrowl",b.name+" ("+b.id+") is in use and can't be removed",{title:"Languages",sticky:!1,channel:"warn"})})}));a.show()},_showEditLanguageDialog:function(b){this._editLanguageDialog&&this._editLanguageDialog.show(b)},_editLanguage:function(b){k(this._langStore.add(b)).then(e.hitch(this,function(a){d.publish("dGrowl",
"Language edited: "+a.name,{title:"Languages",sticky:!1,channel:"info"});this.languageController.updateLanguageStore();this._langGrid.refresh();this._reset()}),function(a){a=JSON.parse(a.response.data);var c="",b=null;l.forEach(a.errors,function(a){for(b in a)c+="-\x3cem\x3e",c+=b,c+="\x3c/em\x3e: ",c+=a[b],c+="\x3cbr\x3e"});d.publish("dGrowl",c,{title:a.message,sticky:!0,channel:"error"})})}})});
//# sourceMappingURL=ManageLanguagesDialog.js.map