...
Code Block | ||
---|---|---|
| ||
canvas.ns('canvas.applnlayout.utkarsh.menumaster'); canvas.applnlayout.utkarsh.menumaster = Class(canvas.core.Component, { constructor: function(config) { var that = this; this.parentElem = config.parentElem; this.appContainerEle = config.elem; this.appContainer = config.appContainer; this.uData = config.uData; this.itemList = wsArr = canvas.workspace.metadata.getWorkspaces(); /** *Thisloopistosupportmultilingual.ItgetsthevalueoftheString *correspondingtothevalueofWORKSPACE_DISPLAY_NMinthepropertyfile *givenintheBUNDLEThis loop is to support multilingual. It gets the value of the String *corresponding to the value of WORKSPACE_DISPLAY_NM in the property file *given in the BUNDLE_KEY. */ for (var index = 0; index <this.itemList.length; index++) { this.itemList[index].ITEM_LABEL = !canvas.isEmpty(CRB.getBundleValue(this.itemList[index].BUNDLE_KEY, this.itemList[index].WORKSPACE_DISPLAY_NM)) ? CRB.getBundleValue(this.itemList[index].BUNDLE_KEY, this.itemList[index].WORKSPACE_DISPLAY_NM) : this.itemList[index].WORKSPACE_DISPLAY_NM; } }, /** *@methodgetHeaderDOM@method getHeaderDOM *@memberof "canvas.applnlayout.landingpage" *@descriptionThismethodisresponsibleforloadingtheuserpicture,@description This method is responsible for loading the user picture, user *info,lastlogintimewiththetemplate last login time with the template(cardheader.cttpl). */ getLandingDOM: function() { /** *ThelistofworkspacesispassedtothetemplatefileThe list of workspaces is passed to the template file(cardmaster.cttpl) *andmakesacallbacktoapplyTemplateand makes a call back to applyTemplate. */ var tmpLayer = canvas.templateManager.createTemplate('menumaster.cttpl', this.itemList,canvas.util.getTemplatePath()); tmpLayer.getTemplate(this.applyTemplate, this); }, /** *@methodapplyTemplate@method applyTemplate *@paramtemplate@param template *@paramtmpClass@param tmpClass *@descriptionThismethodgetsthetemplate,appendsittotheparent *elementandaddsclicklistenertoswitchworkspaces@description This method gets the template, appends it to the parent *element and adds click listener to switch workspaces. */ applyTemplate: function(template, tmpClass) { if (!canvas.core.isEmpty(this.parentElem)) { $(this.parentElem).append(template); } //Menu Click $(this.parentElem).find("[data-itemtype='workspaceid']").on('vclick', function(e) { var workspaceID = $(this).attr('data-itemid'); //canvas.workspace.metadata.getWorkspaceManager().getContainer().switchWorkspace(workspaceID,null, true); canvas.HashManager.setHash({ 'WORKSPACE_ID': workspaceID }); canvas.lib.utility.closeHeaderPopup(); }); } }); CLCR.registerCmp({ "COMPONENT": "utkarsh-MENUMASTER", "APPLICATION_FW": "JQM" }, canvas.applnlayout.utkarsh.menumaster); |
...