Best JavaScript code snippet using taiko
pages.component.ts
Source:pages.component.ts
1import { Component, OnInit } from "@angular/core";2import { ActivatedRoute, Router } from "@angular/router";3import { DomSanitizer } from "@angular/platform-browser";4import { WPAPIService } from "../../../services/wpapi.service";5import { Observable } from "rxjs";6@Component({7 selector: "app-pages",8 templateUrl: "./pages.component.html",9 styleUrls: ["./pages.component.css"]10})11export class PagesComponent implements OnInit {12 page = null;13 contactUs = false;14 faq;15 annualReportUrl;16 selectedYear;17 balaceFundStatus;18 fundRangeTestStatus;19 getHowToInvestSlider;20 getHomeSlider;21 activeClickedTab;22 getCurrentTab;23 //textFreeInvesting = false;24 taxFreeInvestment;25 constructor(26 private wpservice: WPAPIService,27 private route: ActivatedRoute,28 private router: Router,29 private santiser: DomSanitizer30 ) {31 route.params.subscribe(val => {32 // console.log(val);33 //console.log(this.router.url);34 var urlArr = this.router.url.split("/");35 // console.log(urlArr);36 var currentUrl = {37 parent: urlArr.length > 2 ? urlArr[1] : "",38 child: urlArr.length > 2 ? urlArr[2] : urlArr[1],39 schild: urlArr.length > 3 ? urlArr[3] : ""40 };41 // console.log(currentUrl);42 if (val.ID || currentUrl.child) {43 var slug = val.ID44 ? val.ID45 : currentUrl.schild != ""46 ? currentUrl.schild47 : currentUrl.child;48 // console.log(slug);49 this.wpservice.pages(`?slug=${slug}`).subscribe(page => {50 this.page = page[0];51 // if (slug == "meet-our-leaders") {52 // this.page.ourteamStatus = true;53 // this.page.acf.meet_our_leaders.forEach(leader => {54 // leader.video_url = this.santiser.bypassSecurityTrustHtml(55 // leader.video_url56 // );57 // });58 // }59 if (slug == "faq") {60 this.page.faqStatus = true;61 }62 if (slug == "insights") {63 this.page.insightStatus = true;64 }65 if (slug == "unit-trusts-annual-report") {66 this.page.annualReport = true;67 this.annualReportUrl = this.page.acf.annual_report[0].report_url;68 }69 if (slug == "april-2018-quarterly") {70 this.page.quaterlyStatus = true;71 }72 if (slug == "our-sharia-board") {73 this.page.shariaBoardStatus = true;74 }75 if (slug == "up-quarterly-library") {76 this.page.quaterlyLibraryStatus = true;77 }78 if (slug == "podcast-archive") {79 this.page.podcastArchiveStatus = true;80 }81 if (slug == "glossary") {82 this.page.glossaryStatus = true;83 }84 if (slug == "fund-range-test") {85 this.fundRangeTestStatus = true;86 }87 if (slug == "meet-the-fund-manager") {88 this.page.meetFundManager = true;89 // this.wpservice.getPost("11267").subscribe(silder => {90 // this.getHomeSlider = silder;91 // });92 }93 if (slug == "tax-free-investing") {94 this.page.textFreeInvesting = true;95 // this.wpservice.getPost("11272").subscribe(taxFrees => {96 // this.taxFreeInvestment = taxFrees;97 // console.log(this.taxFreeInvestment);98 // });99 }100 if (currentUrl.parent == "article") {101 // this.page.articleStatus = true;102 // console.log(this.page);103 this.wpservice.getPostBySlug(slug).subscribe(post => {104 this.page = post;105 this.page.articleStatus = true;106 // console.log(this.page);107 });108 }109 if (slug == "new-to-investing") {110 this.page.newToInvestingStatus = true;111 this.activeClickedTab = "unitTrust";112 this.getHowToInvestSlider = this.page.acf.what_is_a_unit_trust;113 }114 if (slug == "how-to-invest") {115 this.page.howToInvestStatus = true;116 this.activeClickedTab = "doInvest";117 this.getHowToInvestSlider = this.page.acf.how_do_i_invest;118 }119 if (slug == "forms-documents") {120 this.page.formDocumentStatus = true;121 }122 // if (slug == "balanced-fund") {123 // this.page.balaceFundStatus = true;124 // }125 if (slug == "fact-sheets-archive") {126 this.page.factsheetStatus = true;127 }128 // if (slug == "equity-alpha-fund") {129 // this.page.equityAlphaStatus = true;130 // }131 if (132 slug == "complete-fund-range" &&133 currentUrl.parent != "institutional-investor"134 ) {135 // this.page.id = 11828;136 this.page.completeFundRangeStatus = true;137 // this.wpservice.pages(`${this.page.id}`).subscribe(page => {138 // this.page = page;139 // this.page.completeFundRangeStatus = true;140 // this.page.getParent = "individual-investor";141 // console.log(this.page);142 // });143 //console.log(this.page);144 }145 console.log(currentUrl);146 this.getCurrentTab = currentUrl;147 if (this.page) {148 /*** Old About us page */149 // if (this.page.id == 10) {150 // this.wpservice.getPages(`${this.page.id}`).subscribe(page => {151 // this.page = page;152 // this.page.aboutStatus = true;153 // console.log(this.page);154 // });155 // }156 /** finish old about up page */157 if (this.page.id == 10) {158 this.page.id = 12927;159 this.wpservice.getPages(`${this.page.id}`).subscribe(page => {160 this.page = page;161 this.page.aboutStatus = true;162 this.contactUs = true;163 console.log(this.page);164 });165 } else if (166 currentUrl.parent == "about-us" &&167 currentUrl.child == "meet-our-leaders"168 ) {169 this.page.id = 12961;170 this.wpservice.pages(`${this.page.id}`).subscribe(page => {171 this.page = page;172 this.page.isAboutUsMeetLeaders = true;173 // this.page.getParent = "institutional-investor";174 console.log(this.page);175 });176 } else if (177 currentUrl.parent == "about-us" &&178 currentUrl.child == "corporate-social-investment"179 ) {180 this.page.id = 12952;181 this.wpservice.pages(`${this.page.id}`).subscribe(page => {182 this.page = page;183 this.page.isAboutUsSocialInvestment = true;184 // this.page.getParent = "institutional-investor";185 console.log(this.page);186 });187 } else if (188 currentUrl.parent == "about-us" &&189 currentUrl.child == "investment-approach"190 ) {191 this.page.id = 12958;192 this.wpservice.pages(`${this.page.id}`).subscribe(page => {193 this.page = page;194 this.page.isAboutUsInvestmentApproach = true;195 // this.page.getParent = "institutional-investor";196 console.log(this.page);197 });198 } else if (199 currentUrl.parent == "about-us" &&200 currentUrl.child == "committed-to-transformation"201 ) {202 this.page.id = 12955;203 this.wpservice.pages(`${this.page.id}`).subscribe(page => {204 this.page = page;205 this.page.isAboutUsTransform = true;206 // this.page.getParent = "institutional-investor";207 console.log(this.page);208 });209 } else if (210 currentUrl.parent == "about-us" &&211 currentUrl.child == "responsible-investing"212 ) {213 this.page.id = 12935;214 this.wpservice.pages(`${this.page.id}`).subscribe(page => {215 this.page = page;216 this.page.isAboutUsResponsibleInvesting = true;217 // this.page.getParent = "institutional-investor";218 console.log(this.page);219 });220 } else if (221 currentUrl.parent == "about-us" &&222 currentUrl.child == "our-history"223 ) {224 this.page.id = 12943;225 this.wpservice.pages(`${this.page.id}`).subscribe(page => {226 this.page = page;227 this.page.isAboutUsOurHistroy = true;228 // this.page.getParent = "institutional-investor";229 console.log(this.page);230 });231 } else if (232 currentUrl.parent == "about-us" &&233 currentUrl.child == "our-culture"234 ) {235 this.page.id = 12939;236 this.wpservice.pages(`${this.page.id}`).subscribe(page => {237 this.page = page;238 this.page.isAboutUsOurCulture = true;239 // this.page.getParent = "institutional-investor";240 console.log(this.page);241 });242 } else if (243 currentUrl.parent == "about-us" &&244 currentUrl.child == "ownership-structure"245 ) {246 this.page.id = 12946;247 this.wpservice.pages(`${this.page.id}`).subscribe(page => {248 this.page = page;249 this.page.isAboutUsOwnership = true;250 // this.page.getParent = "institutional-investor";251 console.log(this.page);252 });253 } else if (254 currentUrl.parent == "sharia-investor" &&255 this.page.slug == "our-funds"256 ) {257 this.page.id = 8;258 this.wpservice.getPages(`${this.page.id}`).subscribe(page => {259 this.page = page;260 this.page.ourfunds = true;261 this.page.isInstitutionFundRange = false;262 this.faq = this.page.acf["qa-ans"];263 // console.log(this.page);264 // console.log(this.faq);265 });266 } else if (267 currentUrl.parent == "sharia-investor" &&268 currentUrl.child == "our-funds" &&269 currentUrl.schild == "islamic-equity-fund"270 ) {271 this.page.id = 11786;272 this.wpservice.pages(`${this.page.id}`).subscribe(page => {273 this.page = page;274 this.page.islamicEquityStatus = true;275 this.page.getParent = "sharia-investor";276 console.log(this.page);277 });278 } else if (279 currentUrl.parent == "sharia-investor" &&280 currentUrl.child == "our-funds" &&281 currentUrl.schild == "islamic-balanced-fund"282 ) {283 this.page.id = 11788;284 this.wpservice.pages(`${this.page.id}`).subscribe(page => {285 this.page = page;286 this.page.islamicbalancedStatus = true;287 this.page.getParent = "sharia-investor";288 console.log(this.page);289 });290 } else if (291 currentUrl.parent == "sharia-investor" &&292 currentUrl.child == "our-funds" &&293 currentUrl.schild == "islamic-high-yield-fund"294 ) {295 this.page.id = 11790;296 this.wpservice.pages(`${this.page.id}`).subscribe(page => {297 this.page = page;298 this.page.islamicHighYieldStatus = true;299 this.page.getParent = "sharia-investor";300 console.log(this.page);301 });302 } else if (303 currentUrl.parent == "sharia-investor" &&304 currentUrl.child == "our-funds" &&305 currentUrl.schild == "islamic-global-equity-fund"306 ) {307 this.page.id = 11794;308 this.wpservice.pages(`${this.page.id}`).subscribe(page => {309 this.page = page;310 this.page.islamicGlobalEquityStatus = true;311 this.page.getParent = "sharia-investor";312 console.log(this.page);313 });314 } else if (315 currentUrl.parent == "sharia-investor" &&316 currentUrl.child == "our-funds" &&317 currentUrl.schild == "islamic-global-equity-feeder-fund"318 ) {319 this.page.id = 11792;320 this.wpservice.pages(`${this.page.id}`).subscribe(page => {321 this.page = page;322 this.page.islamicGlobalEquityFeederStatus = true;323 this.page.getParent = "sharia-investor";324 this.page.isInstitutionFundRange = false;325 console.log(this.page);326 });327 } else if (328 currentUrl.parent == "individual-investor" &&329 this.page.slug == "our-funds"330 ) {331 this.page.id = 355;332 this.wpservice.getPages(`${this.page.id}`).subscribe(page => {333 this.page = page;334 this.page.ourfunds = true;335 this.page.isInstitutionFundRange = false;336 this.faq = this.page.acf["qa-ans"];337 });338 } else if (339 currentUrl.parent == "individual-investor" &&340 currentUrl.child == "our-funds" &&341 currentUrl.schild == "equity-alpha-fund"342 ) {343 this.page.id = 11777;344 this.wpservice.pages(`${this.page.id}`).subscribe(page => {345 this.page = page;346 this.page.equityAlphaStatus = true;347 this.page.getParent = "individual-investor";348 console.log(this.page);349 });350 } else if (351 currentUrl.parent == "individual-investor" &&352 currentUrl.child == "our-funds" &&353 currentUrl.schild == "balanced-fund"354 ) {355 this.page.id = 544;356 this.wpservice.pages(`${this.page.id}`).subscribe(page => {357 this.page = page;358 this.page.balaceFundStatus = true;359 this.page.getParent = "individual-investor";360 console.log(this.page);361 });362 } else if (363 currentUrl.parent == "individual-investor" &&364 currentUrl.child == "our-funds" &&365 currentUrl.schild == "protector-fund"366 ) {367 this.page.id = 11779;368 this.wpservice.pages(`${this.page.id}`).subscribe(page => {369 this.page = page;370 this.page.protectorStatus = true;371 this.page.getParent = "individual-investor";372 console.log(this.page);373 });374 } else if (375 currentUrl.parent == "individual-investor" &&376 currentUrl.child == "our-funds" &&377 currentUrl.schild == "global-equity-fund"378 ) {379 this.page.id = 11781;380 this.wpservice.pages(`${this.page.id}`).subscribe(page => {381 this.page = page;382 this.page.globalEquityStatus = true;383 this.page.getParent = "individual-investor";384 console.log(this.page);385 });386 } else if (387 currentUrl.parent == "individual-investor" &&388 currentUrl.child == "our-funds" &&389 currentUrl.schild == "top-40-tracker-fund"390 ) {391 this.page.id = 12127;392 this.wpservice.pages(`${this.page.id}`).subscribe(page => {393 this.page = page;394 this.page.topFortyTrackerStatus = true;395 this.page.getParent = "individual-investor";396 console.log(this.page);397 });398 } else if (399 currentUrl.parent == "individual-investor" &&400 currentUrl.child == "our-funds" &&401 currentUrl.schild == "stable-fund"402 ) {403 this.page.id = 11796;404 this.wpservice.pages(`${this.page.id}`).subscribe(page => {405 this.page = page;406 this.page.individualStableFundStatus = true;407 this.page.getParent = "individual-investor";408 console.log(this.page);409 });410 } else if (411 currentUrl.parent == "institutional-investor" &&412 this.page.slug == "investment-approach"413 ) {414 this.page.id = 12678;415 console.log("this institutional home page");416 this.wpservice.getPages(`${this.page.id}`).subscribe(page => {417 this.page = page;418 this.page.investWithUs = true;419 this.faq = this.page.acf["qa-ans"];420 console.log(this.page);421 });422 } else if (423 currentUrl.parent == "institutional-investor" &&424 currentUrl.child == "our-funds" &&425 currentUrl.schild === "managed-equity-fund"426 ) {427 this.page.id = 12734;428 this.wpservice.pages(`${this.page.id}`).subscribe(page => {429 this.page = page;430 this.page.isManagedEquityFund = true;431 this.page.getParent = "institutional-investor";432 console.log(this.page);433 });434 } else if (435 currentUrl.parent == "institutional-investor" &&436 currentUrl.child == "our-funds" &&437 currentUrl.schild === "core-equity-fund"438 ) {439 this.page.id = 12736;440 this.wpservice.pages(`${this.page.id}`).subscribe(page => {441 this.page = page;442 this.page.iscoredEquityFund = true;443 this.page.getParent = "institutional-investor";444 console.log(this.page);445 });446 } else if (447 currentUrl.parent == "institutional-investor" &&448 currentUrl.child == "our-funds" &&449 currentUrl.schild === "managed-equity-fund-capped-swix"450 ) {451 this.page.id = 12728;452 this.wpservice.pages(`${this.page.id}`).subscribe(page => {453 this.page = page;454 this.page.isManagedEquityCappedFund = true;455 this.page.getParent = "institutional-investor";456 console.log(this.page);457 });458 } else if (459 currentUrl.parent == "institutional-investor" &&460 currentUrl.child == "our-funds" &&461 currentUrl.schild === "managed-equity-fund-swix-index"462 ) {463 this.page.id = 12725;464 this.wpservice.pages(`${this.page.id}`).subscribe(page => {465 this.page = page;466 this.page.isManagedEquitySwixFund = true;467 this.page.getParent = "institutional-investor";468 console.log(this.page);469 });470 } else if (471 currentUrl.parent == "institutional-investor" &&472 this.page.slug == "our-funds"473 ) {474 this.page.id = 351;475 this.wpservice.getPages(`${this.page.id}`).subscribe(page => {476 this.page = page;477 this.page.ourfunds = true;478 this.page.isInstitutionFundRange = true;479 this.faq = this.page.acf["qa-ans"];480 });481 } else if (482 currentUrl.parent == "institutional-investor" &&483 currentUrl.child == "our-funds" &&484 currentUrl.schild == "complete-fund-range"485 ) {486 this.page.id = 12738;487 this.wpservice.pages(`${this.page.id}`).subscribe(page => {488 this.page = page;489 this.page.isInstitutionalCompleteFundRange = true;490 // this.page.getParent = "institutional-investor";491 console.log(this.page);492 });493 } else if (494 currentUrl.parent == "institutional-investor" &&495 currentUrl.child == "our-funds" &&496 currentUrl.schild == "equity-alpha-fund"497 ) {498 this.page.id = 11800;499 this.wpservice.pages(`${this.page.id}`).subscribe(page => {500 this.page = page;501 this.page.isInstitutionalEquityStatus = true;502 this.page.getParent = "institutional-investor";503 console.log(this.page);504 });505 } else if (506 currentUrl.parent == "institutional-investor" &&507 currentUrl.child == "our-funds" &&508 currentUrl.schild == "bond-fund"509 ) {510 this.page.id = 12769;511 this.wpservice.pages(`${this.page.id}`).subscribe(page => {512 this.page = page;513 this.page.isInstitutionalBondStatus = true;514 this.page.getParent = "institutional-investor";515 console.log(this.page);516 });517 } else if (518 currentUrl.parent == "institutional-investor" &&519 currentUrl.child == "our-funds" &&520 currentUrl.schild == "money-market-fund"521 ) {522 this.page.id = 12764;523 this.wpservice.pages(`${this.page.id}`).subscribe(page => {524 this.page = page;525 this.page.isInstitutionalMoneyStatus = true;526 this.page.getParent = "institutional-investor";527 console.log(this.page);528 });529 } else if (530 currentUrl.parent == "institutional-investor" &&531 currentUrl.child == "our-funds" &&532 currentUrl.schild == "protector-fund"533 ) {534 this.page.id = 11798;535 this.wpservice.pages(`${this.page.id}`).subscribe(page => {536 this.page = page;537 this.page.isInstitutionalProtectorStatus = true;538 this.page.getParent = "institutional-investor";539 console.log(this.page);540 });541 } else if (542 currentUrl.parent == "institutional-investor" &&543 currentUrl.child == "our-funds" &&544 currentUrl.schild == "stable-fund"545 ) {546 this.page.id = 11796;547 this.wpservice.pages(`${this.page.id}`).subscribe(page => {548 this.page = page;549 this.page.isInstitutionalStableStatus = true;550 this.page.getParent = "institutional-investor";551 console.log(this.page);552 });553 } else if (554 currentUrl.parent == "institutional-investor" &&555 currentUrl.child == "our-funds" &&556 currentUrl.schild == "domestic-balanced-fund"557 ) {558 this.page.id = 12730; // 12134;559 this.wpservice.pages(`${this.page.id}`).subscribe(page => {560 this.page = page;561 this.page.isdomesticFundStatus = true;562 this.page.getParent = "institutional-investor";563 console.log(this.page);564 });565 } else if (566 currentUrl.parent == "institutional-investor" &&567 currentUrl.child == "our-funds" &&568 currentUrl.schild == "global-balanced-fund"569 ) {570 this.page.id = 12732; //12136;571 this.wpservice.pages(`${this.page.id}`).subscribe(page => {572 this.page = page;573 this.page.isGlobalFundInstitutionalStatus = true;574 this.page.getParent = "institutional-investor";575 console.log(this.page);576 });577 } else if (578 currentUrl.parent == "sharia-investor" &&579 slug == "invest-with-us"580 ) {581 this.wpservice.getPages("89").subscribe(page => {582 this.page = page;583 this.page.saria = true;584 console.log(this.page);585 });586 }587 }588 // } else if (this.page.slug == "our-funds") {589 // this.wpservice.getPages(`${this.page.id}`).subscribe(page => {590 // this.page = page;591 // this.page.ourfunds = true;592 // console.log(this.page);593 // });594 // }595 // console.log(typeof this.page.formStatus);596 });597 }598 });599 }600 getAnnualReport(event, year) {601 this.annualReportUrl = year.report_url;602 this.selectedYear = year;603 }604 ngOnInit() {}605 changeSliderData(data, clickedTab) {606 this.getHowToInvestSlider = data;607 this.activeClickedTab = clickedTab;608 console.log(this.getHowToInvestSlider);609 }...
admin.js
Source:admin.js
1import { FlowRouter } from 'meteor/ostrio:flow-router-extra';2import './adminDashboard.html';3import './commonAdmin/commonAdmin.js';4import './adminStatistics/adminStatistics.html';5import '../companysettings/companySettings.js';6import './adminStatistics/adminStatistics.html';7import './adminStatistics/adminStatistics.js';8import './catgManagement/catgManagement.html';9import './catgManagement/catgBulkUpload.html';10import './catgManagement/catgBulkUpload.js';11import './careerJoinUsForm/careerJoinUsForm.html';12import './userManagement/listofUser.html';13import './userManagement/adminAddRolesList.html';14import './userManagement/createUser.html';15import './userManagement/editMyProfileAdmin.html';16import './userManagement/UMlistOfUsers.js';17import './userManagement/UMeditMyProfile.js';18import './masterData/businessBlkup.html';19import './masterData/businessBlkup.js';20import './masterData/masterData.js';21import './myBusiness/myBusinessAdmin.js';22import './myBusiness/editBusinessAdmin.html';23import '/imports/vendor/mybusiness/AboutBusiness/AboutBusiness.js';24import './businessBanner/businessBanner.html';25import './businessBanner/businessBanner.js';26import './businessAds/businessAds.js';27import './homePageBanner/homePageBanner.js';28import './editUser/editMyProfiles.html';29import './editUser/editMyProfiles.js';30import './editUser/createUsers.html';31import './editUser/createUsers.js';32import './editUser/configSettings.js';33import './discountManagement/discountManagement.js';34import '/imports/notifications/createEmailTemplate.html';35import '/imports/notifications/viewTemplate.html';36import '/imports/general/FAQ/FaqForm.html';37import '/imports/general/EditPages/editPages.html';38import '/imports/general/careers/AddNewJobForm.html';39import '/imports/general/careers/jobList.html';40import '/imports/admin/contactUsList/contactUsList.js';41import '/imports/admin/salesReport/salesReport.js';42import '/imports/admin/salesReportBanner/salesReportBanner.js';43Template.manageLocations.onRendered(()=>{44 var currentURL = FlowRouter.current().path;45 var actualURL = currentURL.substring(1);46 $('.sidebarlink').removeClass('active');47 $('.'+actualURL).addClass('active');48});49Template.manageCategoriesList.onRendered(()=>{50 var currentURL = FlowRouter.current().path;51 var actualURL = currentURL.substring(1);52 $('.sidebarlink').removeClass('active');53 $('.'+actualURL).addClass('active');54});55Template.myBusinessAdmin.onRendered(()=>{56 var currentURL = FlowRouter.current().path;57 var actualURL = currentURL.substring(1);58 $('.sidebarlink').removeClass('active');59 $('.'+actualURL).addClass('active');60});61Template.listOfBusiness.onRendered(()=>{62 var currentURL = FlowRouter.current().path;63 var actualURL = currentURL.substring(1);64 $('.sidebarlink').removeClass('active');65 $('.'+actualURL).addClass('active');66});67Template.businessBlkup.onRendered(()=>{68 var currentURL = FlowRouter.current().path;69 var actualURL = currentURL.substring(1);70 $('.sidebarlink').removeClass('active');71 $('.'+actualURL).addClass('active');72 // console.log('currentURL: ',currentURL,' | actualURL: ',actualURL);73});74Template.faqForm.onRendered(()=>{75 var currentURL = FlowRouter.current().path;76 var actualURL = currentURL.substring(1);77 $('.sidebarlink').removeClass('active');78 $('.'+actualURL).addClass('active');79 // console.log('currentURL: ',currentURL,' | actualURL: ',actualURL);80});81Template.editPages.onRendered(()=>{82 var currentURL = FlowRouter.current().path;83 var actualURL = currentURL.substring(1);84 $('.sidebarlink').removeClass('active');85 $('.'+actualURL).addClass('active');86 // console.log('currentURL: ',currentURL,' | actualURL: ',actualURL);87});88Template.createEmailTemplate.onRendered(()=>{89 var currentURL = FlowRouter.current().path;90 var actualURL = currentURL.substring(1);91 $('.sidebarlink').removeClass('active');92 $('.'+actualURL).addClass('active');93 // console.log('currentURL: ',currentURL,' | actualURL: ',actualURL);94});95Template.viewTemplate.onRendered(()=>{96 var currentURL = FlowRouter.current().path;97 var actualURL = currentURL.substring(1);98 $('.sidebarlink').removeClass('active');99 $('.'+actualURL).addClass('active');100 // console.log('currentURL: ',currentURL,' | actualURL: ',actualURL);101});102Template.careerJoinUsForm.onRendered(()=>{103 var currentURL = FlowRouter.current().path;104 var actualURL = currentURL.substring(1);105 $('.sidebarlink').removeClass('active');106 $('.'+actualURL).addClass('active');107 // console.log('currentURL: ',currentURL,' | actualURL: ',actualURL);108});109Template.jobList.onRendered(()=>{110 var currentURL = FlowRouter.current().path;111 var actualURL = currentURL.substring(1);112 $('.sidebarlink').removeClass('active');113 $('.'+actualURL).addClass('active');114 // console.log('currentURL: ',currentURL,' | actualURL: ',actualURL);115});116Template.listofUser.onRendered(()=>{117 var currentURL = FlowRouter.current().path;118 var actualURL = currentURL.substring(1);119 $('.sidebarlink').removeClass('active');120 $('.'+actualURL).addClass('active');121 // console.log('currentURL: ',currentURL,' | actualURL: ',actualURL);122});123Template.adminAddRolesList.onRendered(()=>{124 var currentURL = FlowRouter.current().path;125 var actualURL = currentURL.substring(1);126 $('.sidebarlink').removeClass('active');127 $('.'+actualURL).addClass('active');128 // console.log('currentURL: ',currentURL,' | actualURL: ',actualURL);129});130Template.createUsers.onRendered(()=>{131 var currentURL = FlowRouter.current().path;132 var actualURL = currentURL.substring(1);133 $('.sidebarlink').removeClass('active');134 $('.'+actualURL).addClass('active');135 // console.log('currentURL: ',currentURL,' | actualURL: ',actualURL);136});137adminDashboard = function () { 138 BlazeLayout.render("adminLayout",{main: 'adminDashboard'});139}140export { adminDashboard };141careerJoinUsForm = function () { 142 BlazeLayout.render("adminLayout",{main: 'careerJoinUsForm'});143}...
redirect-to-last-profile-test.js
Source:redirect-to-last-profile-test.js
...13 // Go to the start page and select a user from the dropdown14 await applicationPage.visitHome("/");15 /* eslint "no-undef": "off" */16 await selectChoose("#people-search", ".ember-power-select-option", 0);17 const person_id = /\d+$/.exec(currentURL());18 assert.equal(currentURL(), "/people/" + person_id);19 await skillSearchPage.indexPage.visit();20 assert.equal(currentURL(), "/skill_search");21 await applicationPage.profileMenuItem();22 assert.equal(currentURL(), "/people/" + person_id);23 });24 test("redirect to last skill page", async function(assert) {25 assert.expect(3);26 // Go to the start page and select a user from the dropdown27 await applicationPage.visitHome("/");28 await selectChoose("#people-search", ".ember-power-select-option", 0);29 const person_id = /\d+$/.exec(currentURL());30 await page.visit({ person_id: /\d+$/.exec(currentURL()) });31 assert.equal(currentURL(), "/people/" + person_id + "/skills");32 await skillSearchPage.indexPage.visit();33 assert.equal(currentURL(), "/skill_search");34 await applicationPage.profileMenuItem();35 assert.equal(currentURL(), "/people/" + person_id + "/skills");36 });37 test("redirect to last skill page using same rated filter", async function(assert) {38 assert.expect(3);39 // Go to the start page and select a user from the dropdown40 await applicationPage.visitHome("/");41 await selectChoose("#people-search", ".ember-power-select-option", 0);42 const person_id = /\d+$/.exec(currentURL());43 await page.visit({ person_id: /\d+$/.exec(currentURL()) });44 await page.filterButtons.rated();45 assert.equal(46 currentURL(),47 "/people/" + person_id + "/skills?personId=" + person_id + "&rated=true"48 );49 await skillSearchPage.indexPage.visit();50 assert.equal(currentURL(), "/skill_search");51 await applicationPage.profileMenuItem();52 assert.equal(53 currentURL(),54 "/people/" + person_id + "/skills?personId=" + person_id + "&rated=true"55 );56 });57 test("do not redirect after visiting only people page", async function(assert) {58 assert.expect(4);59 // Go to the start page and select a user from the dropdown60 await applicationPage.visitHome("/");61 /* eslint "no-undef": "off" */62 await selectChoose("#people-search", ".ember-power-select-option", 0);63 const person_id = /\d+$/.exec(currentURL());64 assert.equal(currentURL(), "/people/" + person_id);65 await applicationPage.profileMenuItem();66 assert.equal(currentURL(), "/people");67 await skillSearchPage.indexPage.visit();68 assert.equal(currentURL(), "/skill_search");69 await applicationPage.profileMenuItem();70 assert.equal(currentURL(), "/people");71 });72 test("redirects correctly after switching between subroutes", async function(assert) {73 assert.expect(5);74 // Go to the start page and select a user from the dropdown75 await applicationPage.visitHome("/");76 /* eslint "no-undef": "off" */77 await selectChoose("#people-search", ".ember-power-select-option", 0);78 const person_id = /\d+$/.exec(currentURL());79 assert.equal(currentURL(), "/people/" + person_id);80 await page.visit({ person_id: /\d+$/.exec(currentURL()) });81 assert.equal(currentURL(), "/people/" + person_id + "/skills");82 await personPage.visit({ person_id });83 assert.equal(currentURL(), "/people/" + person_id);84 await skillSearchPage.indexPage.visit();85 assert.equal(currentURL(), "/skill_search");86 await applicationPage.profileMenuItem();87 assert.equal(currentURL(), "/people/" + person_id);88 });...
table-template-utils.ts
Source:table-template-utils.ts
1import { Injectable } from '@angular/core';2import { Router } from '@angular/router';3import { PlatformLocation } from '@angular/common';4import { TableParamsObject } from '../components/table-template/table-params-object';5import { Constants } from 'app/shared/utils/constants';6@Injectable()7export class TableTemplateUtils {8 constructor(9 private platformLocation: PlatformLocation,10 private router: Router11 ) { }12 public updateUrl(sortString, currentPage, pageSize, filter = null, keywords = '') {13 let currentUrl = this.router.url;14 currentUrl = (this.platformLocation as any).getBaseHrefFromDOM() + currentUrl.slice(1);15 currentUrl = currentUrl.split(';')[0];16 currentUrl += `;currentPage=${currentPage};pageSize=${pageSize}`;17 if (keywords !== '') { currentUrl += `;keywords=${keywords}`; }18 if (sortString !== '' && sortString !== null) { currentUrl += `;sortBy=${sortString}`; }19 if (filter !== null && filter !== {}) {20 Object.keys(filter).forEach(key => {21 if (filter[key] === true || filter[key] === false) {22 currentUrl += `;${key}=${filter[key]}`;23 } else {24 currentUrl += `;${key}=`;25 filter[key].split(',').forEach(item => {26 currentUrl += `${item},`;27 });28 currentUrl = currentUrl.slice(0, -1);29 }30 });31 }32 currentUrl += ';ms=' + new Date().getTime();33 window.history.replaceState({}, '', currentUrl);34 }35 public getParamsFromUrl(params, filter = null, defaultPageSize = null, filterFieldList = []) {36 let pageSize = +Constants.tableDefaults.DEFAULT_PAGE_SIZE;37 if (defaultPageSize !== null) {38 pageSize = +defaultPageSize;39 } else if (params.pageSize) {40 pageSize = +params.pageSize;41 }42 let currentPage = params.currentPage ? +params.currentPage : +Constants.tableDefaults.DEFAULT_CURRENT_PAGE;43 let sortBy = params.sortBy ? params.sortBy : Constants.tableDefaults.DEFAULT_SORT_BY;44 let keywords = params.keywords ? params.keywords : Constants.tableDefaults.DEFAULT_KEYWORDS;45 if (filter == null) {46 filter = {};47 }48 filterFieldList.map(field => {49 if (params[field]) {50 filter[field] = params[field];51 }52 });53 this.updateUrl(sortBy, currentPage, pageSize, filter, keywords);54 return new TableParamsObject(55 pageSize,56 currentPage,57 0,58 sortBy,59 keywords,60 filter61 );62 }63 public updateTableParams(tableParams: TableParamsObject, pageNumber: number, sortBy: string) {64 tableParams.sortBy = sortBy;65 tableParams.currentPage = pageNumber;66 return tableParams;67 }...
Using AI Code Generation
1const { openBrowser, goto, currentURL, closeBrowser } = require('taiko');2(async () => {3 try {4 await openBrowser();5 await goto("google.com");6 console.log(await currentURL());7 await closeBrowser();8 } catch (e) {9 console.error(e);10 } finally {11 }12})();13const { openBrowser, goto, currentURL, closeBrowser } = require('taiko');14(async () => {15 try {16 await openBrowser();17 await goto("google.com");18 console.log(await currentURL());19 await closeBrowser();20 } catch (e) {21 console.error(e);22 } finally {23 }24})();25const { openBrowser, goto, currentURL, closeBrowser } = require('taiko');26(async () => {27 try {28 await openBrowser();29 await goto("google.com");30 console.log(await currentURL());31 await closeBrowser();32 } catch (e) {33 console.error(e);34 } finally {35 }36})();37const { openBrowser, goto, currentURL, closeBrowser } = require('taiko');38(async () => {39 try {40 await openBrowser();41 await goto("google.com");42 console.log(await currentURL());43 await closeBrowser();44 } catch (e) {45 console.error(e);46 } finally {47 }48})();49const { openBrowser, goto, currentURL, closeBrowser } = require('taiko');50(async () => {51 try {52 await openBrowser();53 await goto("google.com");54 console.log(await currentURL());55 await closeBrowser();56 } catch (e) {57 console.error(e);58 } finally {59 }60})();61const { openBrowser, goto, currentURL, closeBrowser } = require('taiko');62(async () => {63 try {64 await openBrowser();65 await goto("google.com");66 console.log(await currentURL());67 await closeBrowser();68 } catch (e) {69 console.error(e);70 } finally {71 }72})();
Using AI Code Generation
1const { openBrowser, goto, currentURL, closeBrowser } = require('taiko');2(async () => {3 try {4 await openBrowser();5 await goto("google.com");6 console.log(await currentURL());7 await closeBrowser();8 } catch (e) {9 console.error(e);10 } finally {11 }12})();
Using AI Code Generation
1const { openBrowser, goto, currentURL, closeBrowser } = require('taiko');2(async () => {3 try {4 await openBrowser();5 await goto("google.com");6 console.log(await currentURL());7 } catch (e) {8 console.error(e);9 } finally {10 await closeBrowser();11 }12})();
Using AI Code Generation
1const { openBrowser, goto, currentURL, closeBrowser } = require('taiko');2(async () => {3 try {4 await openBrowser();5 console.log(await currentURL());6 } catch (e) {7 console.error(e);8 } finally {9 await closeBrowser();10 }11})();12const { openBrowser, goto, currentURL, closeBrowser } = require('taiko');13(async () => {14 try {15 await openBrowser();16 console.log(await currentURL());17 } catch (e) {18 console.error(e);19 } finally {20 await closeBrowser();21 }22})();23const { openBrowser, goto, currentURL, closeBrowser } = require('taiko');24(async () => {25 try {
Using AI Code Generation
1const { openBrowser, goto, currentURL, closeBrowser } = require('taiko');2(async () => {3 try {4 await openBrowser({ headless: false });5 console.log(await currentURL());6 } catch (e) {7 console.error(e);8 } finally {9 await closeBrowser();10 }11})();
Using AI Code Generation
1const { openBrowser, goto, closeBrowser, currentURL } = require('taiko');2(async () => {3 try {4 await openBrowser();5 console.log(await currentURL());6 } catch (e) {7 console.error(e);8 } finally {9 await closeBrowser();10 }11})();12Note: currentURL() method is available only in
Using AI Code Generation
1const taiko = require('taiko');2const assert = require('assert');3(async () => {4 try {5 await taiko.openBrowser();6 await taiko.closeBrowser();7 } catch (error) {8 console.error(error);9 }10})();11✓ (1.6s)121 passed (1.6s)
Using AI Code Generation
1(async () => {2 try {3 await openBrowser();4 await click("Gmail");5 console.log(await currentURL());6 await closeBrowser();7 } catch (e) {8 console.error(e);9 } finally {10 }11})();12(async () => {13 try {14 await openBrowser();15 await click("Gmail");16 console.log(await currentURL());17 await closeBrowser();18 } catch (e) {19 console.error(e);20 } finally {21 }22})();23(async () => {24 try {25 await openBrowser();26 await click("Gmail");27 console.log(await currentURL());28 await closeBrowser();29 } catch (e) {30 console.error(e);31 } finally {32 }33})();34(async () => {35 try {36 await openBrowser();37 await click("Gmail");38 console.log(await currentURL());39 await closeBrowser();40 } catch (e) {41 console.error(e);42 } finally {43 }44})();45(async () => {46 try {47 await openBrowser();48 await click("Gmail");49 console.log(await currentURL());50 await closeBrowser();51 } catch (e) {52 console.error(e);53 } finally {54 }55})();56(async () => {57 try {58 await openBrowser();59 await click("Gmail");60 console.log(await currentURL());61 await closeBrowser();62 } catch
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!