//>>built
require({cache:{"url:app/ui/managers/templates/SourcesManager.html":'\x3cdiv\x3e\n  \x3cdiv class\x3d"row relation-row" style\x3d"margin-bottom: 5px;"\x3e\n    \x3cdiv class\x3d"large-offset-10 large-2 columns"\x3e\n      \x3ca style\x3d"float: right;" href\x3d"#" class\x3d"button tiny" data-dojo-attach-event\x3d"onClick: _addSource" title\x3d"Add source"\x3eAdd Source\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" style\x3d"padding: 0;"\x3e\n      \x3cdiv data-dojo-attach-point\x3d"sourcesGridNode" style\x3d"max-height: 350px;"\x3e\x3c/div\x3e\n    \x3c/div\x3e\n  \x3c/div\x3e\n\x3c/div\x3e'}});
define("app/ui/managers/SourcesManager","dojo/_base/declare dojo/_base/array dojo/_base/lang dojo/dom-construct dojo/dom-class dojo/dom-style dojo/json dojo/on dojo/topic dijit/_WidgetBase dijit/_TemplatedMixin dojo/text!./templates/SourcesManager.html dstore/Memory dstore/Trackable dgrid/OnDemandGrid dgrid/extensions/DijitRegistry dgrid/extensions/ColumnResizer ../../utils/DomUtils ../dialogs/SourcesDialog".split(" "),function(b,f,c,d,v,w,x,g,y,l,m,n,h,k,p,q,r,z,t){return b([l,m],{templateString:n,
baseClass:"sources-manager",languageController:null,listController:null,concept:null,languageList:null,_sourcesStore:null,_sourcesGrid:null,_sourcesDialog:null,_index:0,postCreate:function(){this.inherited(arguments);this.trackableMemory=b([h,k]);this._sourcesStore=new this.trackableMemory({data:[]});this.concept&&f.forEach(this.concept.sources,c.hitch(this,function(a){a.id=this._index++;this._sourcesStore.put(a)}));this._createGrid({collection:this._sourcesStore},this.sourcesGridNode);this._sourcesDialog=
new t({parentNode:this});g(this._sourcesDialog,"add.source",c.hitch(this,function(a){this._doAddSource(a)}));g(this._sourcesDialog,"edit.source",c.hitch(this,function(a){this._doEditSource(a)}))},startup:function(){this.inherited(arguments);this._sourcesDialog.startup();this._sourcesGrid.startup();this._sourcesGrid.resize()},reset:function(){this._sourcesDialog&&this._sourcesDialog.reset();this._sourcesStore=new (b([h,k]))({data:[]});this._sourcesGrid.set("collection",this._sourcesStore)},_createGrid:function(a,
u){var e={citation:{label:"Citation",field:"citation",renderCell:function(a){if(a)return d.create("div",{innerHTML:a.citation})}},actions:{label:"",renderCell:c.hitch(this,function(a){if(void 0===a.id)return null;var b=d.create("div",{"class":"dGridHyperlink"});d.create("a",{href:"#",title:"Edit source",className:"fa fa-pencil",innerHTML:"",style:"margin-right: 12px;",onclick:c.hitch(this,function(b){b.preventDefault();this._editSource(a)})},b);d.create("a",{href:"#",title:"Remove source",className:"fa fa-trash",
innerHTML:"",onclick:c.hitch(this,function(b){b.preventDefault();this._removeRow(a.id)})},b);return b})}};this._sourcesGrid=e=new (b([p,q,r]))({collection:a.collection,columns:e,showHeader:!1,noDataMessage:"No sources found",loadingMessage:"Fetching data.."},u);e.on("dgrid-error",function(a){})},getData:function(){return{sources:this._sourcesStore.data}},setConcept:function(a){a&&(this.concept=a,this._sourcesStore=new this.trackableMemory({data:[]}),f.forEach(this.concept.sources,c.hitch(this,function(a){a.id=
this._index++;this._sourcesStore.put(a)})),this._sourcesGrid.set("collection",this._sourcesStore))},_addSource:function(a){a?a.preventDefault():null;this._sourcesDialog.show()},_editSource:function(a){this._sourcesDialog.show(a)},_doAddSource:function(a){this._sourcesStore.add({citation:a.citation})},_doEditSource:function(a){this._sourcesStore.put({citation:a.citation,id:a.id})},_removeRow:function(a){this._sourcesStore.remove(a)}})});
//# sourceMappingURL=SourcesManager.js.map