ips.templates.set('templates.editor.newTab',"  <li data-fileid='{{fileid}}' data-location='{{location}}'>  <a href='#' class='ipsTabs_item' id='{{id}}'>{{title}} <span data-action='closeTab'><i class='fa fa-times'></i></span></a> </li>");ips.templates.set('templates.editor.tabPanel',"  <div data-fileid='{{fileid}}' id='ipsTabs_elTemplateEditor_tabbar_tab_{{fileid}}_panel' class='ipsTabs_panel' style='display: none' data-location='{{location}}' data-type='{{type}}' data-group='{{group}}' data-name='{{name}}' data-type='{{type}}' data-itemID='{{id}}' data-inherited-value='{{inherited}}'>  {{{content}}} </div>");ips.templates.set('templates.editor.tabContent',"  <input data-role='group' type='hidden' name='group_{{fileid}}' value=\"{{{group}}}\"> <input data-role='variables' type='hidden' name='variables_{{fileid}}' value=\"{{{variables}}}\"> <input data-role='title' type='hidden' name='title_{{fileid}}' value=\"{{{title}}}\"> <input data-role='description' type='hidden' name='description_{{fileid}}' value=\"{{{description}}}\"> <textarea data-fileid='{{fileid}}' id='editor_{{fileid}}'>{{{content}}}</textarea>");ips.templates.set('templates.editor.unsaved',"  <i class='fa fa-circle'></i>");ips.templates.set('templates.editor.saved',"  <i class='fa fa-times'></i>");;
;(function($,_,undefined){"use strict";ips.controller.register('core.admin.templates.addForm',{initialize:function(){this.on('submit','form.ipsForm',this.submitForm);this.on(document,'fileListRefreshed.templates',this.closeDialog);},submitForm:function(e){e.preventDefault();var self=this;if(!$(e.currentTarget).attr('data-bypassValidation')){return;}
ips.getAjax()($(e.currentTarget).attr('action'),{dataType:'json',data:$(e.currentTarget).serialize(),type:'post'}).done(function(response){self.trigger('addedFile.templates',{type:self.scope.attr('data-type'),fileID:response.id,name:response.name});});},closeDialog:function(e,data){this.trigger('closeDialog');}});}(jQuery,_));;
;(function($,_,undefined){"use strict";ips.controller.register('core.admin.templates.conflict',{initialize:function(){this.on('click','.ipsButton',this.makeSelection);this.setup();},setup:function(){$('span[data-conflict-name] input[type=radio]').hide();},makeSelection:function(e){var span=$(e.target).closest('span');var radio=$(span).find('input[type=radio]');var name=$(span).attr('data-conflict-name');var id=$(radio).attr('name').replace(/conflict_/,'');if(span.hasClass('ipsButton_disabled')){return false;}
else if(span.hasClass('ipsButton_alternate')){radio.removeAttr('checked');span.removeClass('ipsButton_alternate').addClass('ipsButton_primary').find('strong').html(ips.getString('sc_use_this_version'));$('input[type=radio][name=conflict_'+id+']').closest('span.ipsButton[data-conflict-name='+(name=='new'?'old':'new')+']').removeClass('ipsButton_disabled');$('th span[data-conflict-id='+id+'][data-conflict-name='+name+']').removeClass('ipsPos_left ipsBadge ipsBadge_positive');ips.utils.anim.go('blindDown',this.scope.find('div[data-conflict-id='+id+']'));}
else
{radio.attr('checked','checked');span.removeClass('ipsButton_primary').addClass('ipsButton_alternate').find('strong').html(ips.getString('sc_remove_selection'));$('input[type=radio][name=conflict_'+id+']').closest('span.ipsButton[data-conflict-name='+(name=='new'?'old':'new')+']').addClass('ipsButton_disabled');$('th span[data-conflict-id='+id+'][data-conflict-name='+name+']').addClass('ipsPos_left ipsBadge ipsBadge_positive');ips.utils.anim.go('fadeOut',this.scope.find('div[data-conflict-id='+id+']'));}}});}(jQuery,_));;
;(function($,_,undefined){"use strict";ips.controller.register('cms.admin.templates.fileEditor',{_tabBar:null,_tabContent:null,_fileStore:{},_ajaxURL:'',_cmInstances:{},_currentHeight:0,_editorPreferences:{wrap:true,lines:false},initialize:function(){this.on(document,'openFile.templates',this.openFile);this.on(document,'variablesUpdated.templates',this.updateVariables);this.on('tabChanged',this.changedTab);this.on('click','[data-action="closeTab"]',this.closeTab);this.on('click','[data-action="save"]',this.save);this.on('click','[data-action="revert"]:not( .ipsButton_disabled )',this.revert);this.on('savedFile.templates',this.updateFile);this.on('revertedFile.templates',this.updateFile);this.on('openDialog',this.openedDialog);this.on('menuItemSelected',this.menuSelected);var debounce=_.debounce(_.bind(this._recalculatePanelWrapper,this),100);this.on(window,'resize',debounce);this.setup();},setup:function(){var self=this;this._tabBar=this.scope.find('#elTemplateEditor_tabbar');this._tabContent=this.scope.find('#elTemplateEditor_panels');this._currentHeight=this._tabBar.outerHeight();this._ajaxURL=this.scope.closest('[data-ajaxURL]').attr('data-ajaxURL');this._normalURL=this.scope.closest('[data-normalURL]').attr('data-normalURL');this._editorPreferences['wrap']=ips.utils.db.get('templateEditor','wrap');this._editorPreferences['lines']=ips.utils.db.get('templateEditor','lines');if(this._editorPreferences['wrap']){$('#elTemplateEditor_preferences_menu').find('[data-ipsMenuValue="wrap"]').addClass('ipsMenu_itemChecked');}
if(this._editorPreferences['lines']){$('#elTemplateEditor_preferences_menu').find('[data-ipsMenuValue="lines"]').addClass('ipsMenu_itemChecked');}
this._tabContent.find('[data-group]').each(function(i,item){var original=self._tabContent.find('[data-fileid="'+$(item).attr('data-fileid')+'"] input[data-role="variables"]');if(original.length){original.after($('<input/>').attr('type','hidden').attr('name',original.attr('name')).attr('value',original.attr('value')).attr('data-role','variables'))
original.remove();}
ips.loader.get(['core/interface/codemirror/diff_match_patch.js','core/interface/codemirror/codemirror.js']).then(function(){self._initCodeMirror($(item).attr('data-fileid'),$(item).attr('data-type'));});});},menuSelected:function(e,data){if(data.originalEvent){data.originalEvent.preventDefault();}
if(data.triggerID=='elTemplateEditor_preferences'){if(data.selectedItemID=='wrap'){this._changeEditorPreference(!ips.utils.db.get('templateEditor','wrap'),'wrap','lineWrapping');}else{this._changeEditorPreference(!ips.utils.db.get('templateEditor','lines'),'lines','lineNumbers');}}},_changeEditorPreference:function(toValue,type,cmName){if(toValue){$('#elTemplateEditor_preferences_menu').find('[data-ipsMenuValue="'+type+'"]').addClass('ipsMenu_itemChecked');}else{$('#elTemplateEditor_preferences_menu').find('[data-ipsMenuValue="'+type+'"]').removeClass('ipsMenu_itemChecked');}
this._editorPreferences[type]=toValue;ips.utils.db.set('templateEditor',type,toValue);for(var i in this._cmInstances){this._cmInstances[i].setOption(cmName,toValue);}},openedDialog:function(e,data){if(data.elemID=='elTemplateEditor_variables'||data.elemID=='elTemplateEditor_attributes'){this._insertVariablesIntoDialog(data);}},_insertVariablesIntoDialog:function(data){var active=this._getActiveTab();if(!active.tabPanel){return;}
var variablesValue=$.trim(active.tabPanel.find('[data-role="variables"]').val());var descriptionValue=$.trim(active.tabPanel.find('[data-role="description"]').val());var titleValue=$.trim(active.tabPanel.find('[data-role="title"]').val());var groupValue=$.trim(active.tabPanel.find('[data-role="group"]').val());data.dialog.find('[data-role="variables"]').val(variablesValue).end().find('[data-role="description"]').val(descriptionValue).end().find('[name="_variables_fileid"]').val(active.tabPanel.attr('data-fileid')).end().find('[name="_variables_location"]').val(active.tabPanel.attr('data-location')).end().find('[data-role="title"]').val(titleValue);data.dialog.find('select[data-container-type]').addClass('ipsHide');data.dialog.find('select[data-container-type='+active.tabPanel.attr('data-location')+']').removeClass('ipsHide');data.dialog.find('select[data-container-type='+active.tabPanel.attr('data-location')+']').val(groupValue);data.dialog.find('#elTemplateEditor_container_title').show();data.dialog.find('[data-role="container"]').show();data.dialog.find('[data-role="variables"]').show();data.dialog.find('#elTemplateEditor_attributes_title').show();if(active.tabPanel.attr('data-type')!='template')
{data.dialog.find('#elTemplateEditor_group_title').hide();data.dialog.find('[data-role="variables"]').hide();data.dialog.find('#elTemplateEditor_attributes_title').hide();}
else if(active.tabPanel.attr('data-location')=='block')
{data.dialog.find('#elTemplateEditor_group_title').hide();data.dialog.find('[data-role="group"]').hide();}
else if(active.tabPanel.attr('data-location')=='database')
{data.dialog.find('#elTemplateEditor_group_title').hide();data.dialog.find('[data-role="group"]').hide();data.dialog.find('#elTemplateEditor_title_title').hide();data.dialog.find('[data-role="title"]').hide();}
else if(active.tabPanel.attr('data-location')=='page')
{data.dialog.find('[data-role="variables"]').show();data.dialog.find('#elTemplateEditor_attributes_title').show();data.dialog.find('select[data-container-type='+active.tabPanel.attr('data-location')+']').show();}},updateVariables:function(e,data){this._tabContent.find('[data-fileid="'+data.fileID+'"]').find('[data-role="variables"]').val(data.value).end().find('[data-role="title"]').val(data.title).end().find('[data-role="description"]').val(data.description).end().find('[data-role="group"]').val(data.group);this._updateTabLabel(data.fileID,data.title);},save:function(e){e.preventDefault();var self=this;var active=this._getActiveTab();var panel=active.tabPanel;var key=panel.attr('data-fileid');if(!active.tab||!active.tabPanel){Debug.warn('No active tab or tab panel');return;}
var save=this._getParametersFromPanel(panel);this._cmInstances[key].save();save['editor_'+key]=this.scope.find('#editor_'+key).val();_.extend(save,{'t_name':panel.find('[data-role="title"]').val()});_.extend(save,{'t_description':panel.find('[data-role="description"]').val()});_.extend(save,{'t_group':panel.find('input[data-role="group"]').val()});if(panel.attr('data-location')=='block'||panel.attr('data-location')=='database'||panel.attr('data-location')=='page'){_.extend(save,{'t_variables':panel.find('[data-role="variables"]').val()});}
this.trigger('savingFile.templates');ips.getAjax()(this._normalURL+'&do=save',{dataType:'json',data:save,type:'post'}).done(function(response){if(response.msg)
{ips.ui.alert.show({type:'alert',message:response.msg,icon:'warn'});}
else
{self.trigger('savedFile.templates',{key:key,oldID:parseInt(panel.attr('data-itemID')),newID:parseInt(response.template_id),newTitle:response.template_title,oldContainer:parseInt(panel.attr('data-container')),newContainer:parseInt(response.template_container),status:(response.template_user_added==1)?'custom':'changed'});self._setChanged(false,key);self._updateToolbar(active.tab);self._updateTabLabel(key,response.template_title);}}).fail(function(){ips.ui.alert.show({type:'alert',message:ips.getString('saveThemeError'),icon:'warn'});}).always(function(){self.trigger('saveFileFinished.templates');});},revert:function(e,bypass){e.preventDefault();var self=this;var active=this._getActiveTab();var panel=active.tabPanel;var key=panel.attr('data-fileid');var message=($(e.currentTarget).attr('data-actionType')=='revert')?ips.getString('skin_revert_confirm'):ips.getString('skin_delete_confirm');if(bypass!==true){ips.ui.alert.show({type:'confirm',message:message,icon:'warn',callbacks:{ok:function(){self.revert(e,true);}}});return;}
var save=this._getParametersFromPanel(panel);ips.getAjax()(this._normalURL+'&do=delete&wasConfirmed=1',{dataType:'json',data:save,type:'post'}).done(function(response){if(response.template_id){self._revertedFile(response,key,active);}else{self._deletedFile(key,active);}});},_revertedFile:function(response,key,active){this.trigger('revertedFile.templates',{key:key,oldID:parseInt(active.tabPanel.attr('data-itemID')),newID:parseInt(response.template_id),status:response.InheritedValue});$('#editor_'+key).val(response.template_content);this._cmInstances[key].setValue(response.template_content);this._setChanged(false,key);this._updateToolbar(active.tab);},_deletedFile:function(key,active){this.trigger('deletedFile.templates',{key:key,fileID:active.tabPanel.attr('data-itemID'),location:active.tabPanel.attr('data-location'),type:active.tabPanel.attr('data-type')});active.tab.find('[data-action="closeTab"]').click();},_getParametersFromPanel:function(panel){return{t_type:panel.attr('data-type'),t_location:panel.attr('data-location'),t_item_id:panel.attr('data-itemID'),t_container:panel.find('input[data-role=container]').val(),t_group:panel.attr('data-group'),t_name:panel.attr('data-name'),t_key:panel.attr('data-fileid')};},updateFile:function(e,data){this.scope.find('[data-itemID="'+data.oldID+'"]').attr('data-itemID',data.newID).attr('data-container',data.newContainer).attr('data-inherited-value',data.status);},closeTab:function(e){var tab=$(e.currentTarget).closest('.ipsTabs_item');this._doCloseTab(tab);},_doCloseTab:function(tab,bypass){var self=this;var tabParent=tab.closest('[data-fileid]');var key=tabParent.attr('data-fileid');var allTabs=this._tabBar.find('.ipsTabs_item').closest('[data-fileid]');var newTab=null;if(tabParent.attr('data-state')=='unsaved'&&bypass!=true){ips.ui.alert.show({type:'confirm',message:ips.getString('themeUnsavedContent'),icon:'warn',callbacks:{ok:function(){self._doCloseTab(tab,true);}}});return;}
var active=tab.hasClass('ipsTabs_activeItem');this.trigger('closedTab.templates',{fileID:key});$(this._cmInstances[key].getWrapperElement()).remove();delete(this._cmInstances[key]);if(active&&allTabs.length>1){if(allTabs.first().attr('data-fileid')==tabParent.attr('data-fileid')){newTab=tabParent.next();}else{newTab=tabParent.prev();}}
if(newTab){newTab.find('> a').click();}
ips.utils.anim.go('fadeOutDown fast',tabParent).done(function(){tabParent.remove();self._recalculatePanelWrapper();});this._tabContent.find('[data-fileid="'+key+'"]').remove();},changedTab:function(e,data){var tab=data.tab;if(!_.isUndefined(tab.closest('[data-fileid]').attr('data-fileid'))){this.trigger('fileSelected.templates',{fileID:tab.closest('[data-fileid]').attr('data-fileid')});}
this._updateToolbar(tab);},_updateToolbar:function(tab){var tabParent=tab.closest('[data-fileid]').attr('data-fileid');var tabPanel=this._tabContent.find('[data-fileid="'+tabParent+'"]');var status=tabPanel.attr('data-inherited-value');var type=tabPanel.attr('data-type');var revert=this.scope.find('[data-action="revert"]');switch(status){case'original':case'inherit':revert.addClass('ipsButton_disabled')
break;case'custom':revert.html(ips.getString('skin_delete')).removeClass('ipsButton_disabled').attr('data-actionType','delete').show();break;case'changed':revert.html(ips.getString('skin_revert')).removeClass('ipsButton_disabled').attr('data-actionType','revert').show();break;}
$('#elTemplateEditor_variables').show();$('#elTemplateEditor_attributes').hide();},openFile:function(e,data){if(!this._tabBar.find('[data-fileid="'+data.meta.key+'"]').length){this._buildTab(data.meta);}else{this._tabBar.find('[data-fileid="'+data.meta.key+'"] > a').click();}},_buildTab:function(meta){var self=this;this._tabContent.attr('data-haseditor','true');this.scope.find('#elTemplateEditor_panels_empty').hide();this._tabBar.append(ips.templates.render('templates.editor.newTab',{title:meta.title,fileid:meta.key,location:meta.location,group:meta.group,container:meta.container,id:'tab_'+meta.key}));this._tabContent.append(ips.templates.render('templates.editor.tabPanel',{fileid:meta.key,name:meta.name,type:meta.type,location:meta.location,container:meta.container,group:meta.group,id:meta.id,inherited:meta.inherited}));this._recalculatePanelWrapper();this._tabBar.find('[data-fileid="'+meta.key+'"] > a').click();this._tabContent.addClass('ipsLoading ipsTabs_loadingContent');ips.getAjax()(this._ajaxURL+'&do=loadTemplate&show=json',{dataType:'json',data:{'t_container':meta.container,'t_group':meta.group,'t_name':meta.name,'t_key':meta.key,'t_location':meta.location,'t_type':meta.type}}).done(function(response){self._postProcessNewTab(response,meta);}).always(function(){self._tabContent.removeClass('ipsLoading ipsTabs_loadingContent');});},_updateTabLabel:function(key,title)
{var span=this._tabBar.find('[data-fileid="'+key+'"] > a span').clone();this._tabBar.find('[data-fileid="'+key+'"] > a').html(title).append(span);},_postProcessNewTab:function(response,meta){var content=ips.templates.render('templates.editor.tabContent',{fileid:meta.key,content:response.template_content,variables:response.template_params,description:response.template_desc,title:response.template_title,container:response.template_container,group:response.template_group});this._tabContent.find('[data-fileid="'+meta.key+'"]').html(content);this._initCodeMirror(meta.key,meta.type);},_initCodeMirror:function(key,type){var self=this;this._cmInstances[key]=CodeMirror.fromTextArea(document.getElementById('editor_'+key),{mode:(type=='template'?'htmlmixed':'css'),lineWrapping:this._editorPreferences['wrap'],lineNumbers:this._editorPreferences['lines']});this._cmInstances[key].setSize(null,this._getTabContentHeight());this._cmInstances[key].on('change',function(doc,cm){self._setChanged(true,key);});},_setChanged:function(state,key){if(state==true){this._tabBar.find('[data-fileid="'+key+'"]').attr('data-state','unsaved').find('[data-action="closeTab"]').html(ips.templates.render('templates.editor.unsaved'));}else{this._tabBar.find('[data-fileid="'+key+'"]').attr('data-state','saved').find('[data-action="closeTab"]').html(ips.templates.render('templates.editor.saved'));}},_recalculatePanelWrapper:function(){var tabHeight=this._tabBar.outerHeight();this._tabContent.css({top:tabHeight+'px'});var contentHeight=this._getTabContentHeight();this._tabContent.find('.CodeMirror').css({height:contentHeight+'px'});this._currentHeight=tabHeight;},_getActiveTab:function(){var toReturn={tab:null,tabPanel:null};var tab=this._tabBar.find('.ipsTabs_item.ipsTabs_activeItem').first().parent();if(!tab.length){return toReturn;}
toReturn={tab:tab,tabPanel:this._tabContent.find('[data-fileid="'+tab.attr('data-fileid')+'"]')};return toReturn;},_getTabContentHeight:function(){var tabContentTop=this._tabContent.offset().top;var windowHeight=$(window).height();var infoHeight=this.scope.find('#elTemplateEditor_info').outerHeight();this._panelHeight=windowHeight-tabContentTop-infoHeight-31;return this._panelHeight;}});}(jQuery,_));;
;(function($,_,undefined){"use strict";ips.controller.register('cms.admin.templates.fileList',{_tabBar:null,_tabContent:null,initialize:function(){this.on('click','[data-action="openFile"]',this.openFile);this.on('click','[data-action="toggleBranch"]',this.toggleBranch);this.on('modifiedFile.templates',this.refreshFileList);this.on(document,'fileSelected.templates',this.selectFile);this.on(document,'savedFile.templates revertedFile.templates',this.updateItemMeta);this.on(document,'savedFile.templates revertedFile.templates',this.fileChangedStatus);this.on(document,'addedFile.templates',this.refreshFileList);this.on(document,'deletedFile.templates',this.refreshFileList);var debounce=_.debounce(_.bind(this.resizeFileList,this),100);this.on(window,'resize',debounce);this.setup();},setup:function(){this._tabBar=this.scope.find('#elTemplateEditor_typeTabs');this._tabContent=this.scope.find('#elTemplateEditor_fileList');this.resizeFileList();},resizeFileList:function(){var fileListTop=this._tabContent.offset().top;var infoHeight=this.scope.find('#elTemplateEditor_info').height();var browserHeight=$(window).height();var fileListNewTop=browserHeight-fileListTop-infoHeight-30;this._tabContent.css({height:fileListNewTop+'px'});},refreshFileList:function(e,data){var self=this;var type=data.type;var panel=this._tabContent.find('.cTemplateList[data-type="'+type+'"]');var activeItem=panel.find('.cTemplateList_activeNode > a').attr('data-key');if(!panel.length){this._tabBar.find('[data-type="'+type+'"]').click();}else{var open=this._getOpenNodes(panel);var url=this._tabBar.find('[data-type]').attr('data-tabURL');ips.getAjax()(url).done(function(response){panel.html(response);self._openNodes(open,panel,activeItem);if(data.fileID){panel.find('[data-itemid="'+data.fileID+'"]').click();}
self.trigger('fileListRefreshed.templates');});}},_openNodes:function(toOpen,panel,activeItem){var selector=[];if(toOpen.locations.length){for(var i=0;i<toOpen.locations.length;i++){selector.push('[data-location="'+toOpen.locations[i]+'"]');}}
if(toOpen.groups.length){for(var i=0;i<toOpen.groups.length;i++){var str='[data-location="'+toOpen.groups[i][0]+'"] ';str+='[data-group="'+toOpen.groups[i][1]+'"]';selector.push(str);}}
panel.find('.cTemplateList_activeBranch').removeClass('cTemplateList_activeBranch').addClass('cTemplateList_inactiveBranch').end().find(selector.join(',')).removeClass('cTemplateList_inactiveBranch').addClass('cTemplateList_activeBranch');if(activeItem){panel.find('[data-key="'+activeItem+'"]').click();}},_getOpenNodes:function(panel){var locations=[];var groups=[];panel.find('.cTemplateList_activeBranch').each(function(i,item){var el=$(item);if(el.attr('data-location')){locations.push(el.attr('data-location'));}
if(el.attr('data-group')){groups.push([el.closest('[data-location]').attr('data-location'),el.attr('data-group')]);}});return{locations:locations,groups:groups};},selectFile:function(e,data){if(data.fileID){this._makeActive(data.fileID);}},openFile:function(e){e.preventDefault();var elem=$(e.currentTarget);var meta={name:elem.attr('data-name'),key:elem.attr('data-key'),type:elem.closest('[data-type]').attr('data-type'),title:elem.text(),group:elem.closest('[data-group]').attr('data-group'),location:elem.closest('[data-location]').attr('data-location'),id:elem.closest('[data-itemID]').attr('data-itemID'),inherited:elem.closest('[data-inherited-value]').attr('data-inherited-value')};Debug.log(meta);this.trigger('openFile.templates',{meta:meta});},toggleBranch:function(e){e.preventDefault();var branchTrigger=$(e.currentTarget);var branchItem=branchTrigger.parent();if(branchItem.hasClass('cTemplateList_inactiveBranch')){ips.utils.anim.go('fadeInDown',branchItem.find(' > ul'));branchItem.removeClass('cTemplateList_inactiveBranch').addClass('cTemplateList_activeBranch');}else{branchItem.find(' > ul').hide();branchItem.removeClass('cTemplateList_activeBranch').addClass('cTemplateList_inactiveBranch');}},updateItemMeta:function(e,data){if(data.oldID!=data.newID){this.scope.find('[data-itemID="'+data.oldID+'"]').attr('data-itemID',data.newID);}
this.scope.find('[data-itemID="'+data.newID+'"]').attr('data-name',data.newTitle).html(data.newTitle);if(data.oldContainer!=data.newContainer)
{data.fileID=data.newID;this.trigger('modifiedFile.templates',data);}},fileChangedStatus:function(e,data){this.scope.find('[data-key="'+data.key+'"]').attr('data-inherited-value',data.status);},_makeActive:function(fileID){var file=this.scope.find('[data-key="'+fileID+'"]');this.scope.find('[data-key]').parent().removeClass('cTemplateList_activeNode');file.parent().addClass('cTemplateList_activeNode');file.parents('li[data-group], li[data-location]').each(function(idx,parent){if($(parent).hasClass('cTemplateList_inactiveBranch')){$(parent).removeClass('cTemplateList_inactiveBranch').addClass('cTemplateList_activeBranch').find('> ul').show();}});},_currentType:function(){if(this._tabBar.find('[data-type="template"]').hasClass('ipsTabs_activeItem')){return'template';}
if(this._tabBar.find('[data-type="js"]').hasClass('ipsTabs_activeItem')){return'js';}
return'css';}});}(jQuery,_));;
;(function($,_,undefined){"use strict";ips.controller.register('cms.admin.templates.main',{initialize:function(){this.on('savingFile.templates',this.showLoading);this.on('saveFileFinished.templates',this.hideLoading);},showLoading:function(e){ips.utils.anim.go('fadeIn',this.scope.find('[data-role="loading"]'));},hideLoading:function(e){ips.utils.anim.go('fadeOut',this.scope.find('[data-role="loading"]'));}});}(jQuery,_));;
;(function($,_,undefined){"use strict";ips.controller.register('cms.admin.templates.variablesDialog',{initialize:function(){this.on('click','input[type="submit"]',this.submitChange);},submitChange:function(e){this.trigger('variablesUpdated.templates',{fileID:this.scope.find('[name="_variables_fileid"]').val(),value:this.scope.find('[data-role="variables"]').val(),title:this.scope.find('[data-role="title"]').val(),description:this.scope.find('[data-role="description"]').val(),container:this.scope.find('[data-role="container"]').val(),group:this.scope.find('[data-role="group"]:not(.ipsHide)').val()});this.trigger('closeDialog');}});}(jQuery,_));;