How to use currentUrl method in wpt

Best JavaScript code snippet using wpt

pages.component.ts

Source:pages.component.ts Github

copy

Full Screen

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 }...

Full Screen

Full Screen

admin.js

Source:admin.js Github

copy

Full Screen

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}...

Full Screen

Full Screen

redirect-to-last-profile-test.js

Source:redirect-to-last-profile-test.js Github

copy

Full Screen

1import { module, test } from "qunit";2import applicationPage from "frontend/tests/pages/application";3import page from "frontend/tests/pages/person-skills";4import skillSearchPage from "frontend/tests/pages/skill-search";5import personPage from "frontend/tests/pages/person-edit";6import setupApplicationTest from "frontend/tests/helpers/setup-application-test";7import { currentURL } from "@ember/test-helpers";8import { selectChoose } from "ember-power-select/test-support";9module("Acceptance | redirect to last profile", function(hooks) {10 setupApplicationTest(hooks);11 test("redirect to last visited cv page", async function(assert) {12 assert.expect(3);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 });...

Full Screen

Full Screen

table-template-utils.ts

Source:table-template-utils.ts Github

copy

Full Screen

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 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org', 'A.12345678901234567890123456789012');3 if (err) return console.error(err);4 console.log('Test status: ' + data.statusText);5 wpt.getTestResults(data.data.testId, function(err, data) {6 if (err) return console.error(err);7 console.log('First View: ' + data.data.average.firstView.loadTime);8 console.log('Repeat View: ' + data.data.average.repeatView.loadTime);9 });10});11var wpt = require('webpagetest');12var wpt = new WebPageTest('www.webpagetest.org', 'A.12345678901234567890123456789012');13 if (err) return console.error(err);14 console.log('Test status: ' + data.statusText);15 wpt.getTestResults(data.data.testId, function(err, data) {16 if (err) return console.error(err);17 console.log('First View: ' + data.data.average.firstView.loadTime);18 console.log('Repeat View: ' + data.data.average.repeatView.loadTime);19 });20});21var wpt = require('webpagetest');22var wpt = new WebPageTest('www.webpagetest.org', 'A.12345678901234567890123456789012');23 if (err) return console.error(err);24 console.log('Test status: ' + data.statusText);25 wpt.getTestResults(data.data.testId, function(err, data) {26 if (err) return console.error(err);27 console.log('First View: ' + data.data.average.firstView.loadTime);28 console.log('Repeat View: ' + data.data.average.repeatView.loadTime);29 });30});31var wpt = require('webpag

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3wpt.runTest(url, function(err, data) {4 if (err) return console.error(err);5 wpt.getTestResults(data.data.testId, function(err, data) {6 if (err) return console.error(err);7 console.log(data.data.runs[1].firstView.currentUrl);8 });9});10var wpt = require('webpagetest');11var wpt = new WebPageTest('www.webpagetest.org');12wpt.runTest(url, function(err, data) {13 if (err) return console.error(err);14 wpt.getTestResults(data.data.testId, function(err, data) {15 if (err) return console.error(err);16 console.log(data.data.runs[1].firstView.currentUrl);17 });18});19var wpt = require('webpagetest');20var wpt = new WebPageTest('www.webpagetest.org');21wpt.runTest(url, function(err, data) {22 if (err) return console.error(err);23 wpt.getTestResults(data.data.testId, function(err, data) {24 if (err) return console.error(err);25 console.log(data.data.runs[1].firstView.currentUrl);26 });27});28var wpt = require('webpagetest');29var wpt = new WebPageTest('www.webpagetest.org');30wpt.runTest(url, function(err, data) {31 if (err) return console.error(err);32 wpt.getTestResults(data.data.testId, function(err, data) {33 if (err) return console.error(err);34 console.log(data.data.runs[1].firstView.currentUrl);35 });36});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3wpt.getTesters(function(err, data) {4 if (err) {5 console.log('Error: ' + err);6 } else {7 console.log('Testers: ' + JSON.stringify(data));8 }9});10var wpt = require('webpagetest');11var wpt = new WebPageTest('www.webpagetest.org');12wpt.getTesters(function(err, data) {13 if (err) {14 console.log('Error: ' + err);15 } else {16 console.log('Testers: ' + JSON.stringify(data));17 }18});19var wpt = require('webpagetest');20var wpt = new WebPageTest('www.webpagetest.org');21wpt.getTesters(function(err, data) {22 if (err) {23 console.log('Error: ' + err);24 } else {25 console.log('Testers: ' + JSON.stringify(data));26 }27});28var wpt = require('webpagetest');29var wpt = new WebPageTest('www.webpagetest.org');30wpt.getTesters(function(err, data) {31 if (err) {32 console.log('Error: ' + err);33 } else {34 console.log('Testers: ' + JSON.stringify(data));35 }36});37var wpt = require('webpagetest');38var wpt = new WebPageTest('www.webpagetest.org');39wpt.getTesters(function(err, data) {40 if (err) {41 console.log('Error: ' + err);42 } else {43 console.log('Testers: ' + JSON.stringify(data));44 }45});46var wpt = require('webpagetest');47var wpt = new WebPageTest('www.webpagetest.org');48wpt.getTesters(function(err, data) {49 if (err) {50 console.log('Error: ' + err);51 } else {52 console.log('Testers: ' + JSON.stringify(data));53 }54});

Full Screen

Using AI Code Generation

copy

Full Screen

1wpt.currentUrl(function(err, data){2if(err){3console.log(err);4}5else{6console.log(data);7}8});9if(err){10console.log(err);11}12else{13console.log(data);14}15});16wpt.getTestResults("140421_3F_5f8c5f5d5b6e3d6d2a8c3b9f3b6a0b1f", function(err, data){17if(err){18console.log(err);19}20else{21console.log(data);22}23});24wpt.getLocations(function(err, data){25if(err){26console.log(err);27}28else{29console.log(data);30}31});32wpt.getTesters(function(err, data){33if(err){34console.log(err);35}36else{37console.log(data);38}39});40wpt.getTesters(function(err, data){41if(err){42console.log(err);43}44else{45console.log(data);46}47});48wpt.getLocations(function(err, data){49if(err){50console.log(err);51}52else{53console.log(data);54}55});56wpt.getTesters(function(err, data){57if(err){58console.log(err);59}60else{61console.log(data);62}63});64wpt.getTesters(function(err, data){65if(err){66console.log(err);67}68else{69console.log(data);70}71});72wpt.getLocations(function(err, data){73if(err){74console.log(err);75}76else{77console.log(data);78}79});80wpt.getTesters(function(err, data){81if(err){82console.log(err);83}84else{85console.log(data);86}87});88wpt.getTesters(function(err, data){89if(err){90console.log(err);91}92else{93console.log(data);94}95});96wpt.getLocations(function

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptDriver = require('wptdriver');2var driver = new wptDriver();3driver.currentUrl(function(url) {4 console.log('Current url is ' + url);5});6Method Description currentUrl(callback) Returns the current url of the page. title(callback) Returns the title of the current page. source(callback) Returns the source of the current page. findElement(locator, callback) Finds the first element on the page that matches the locator. findElements(locator, callback) Finds all elements on the page that match the locator. takeScreenshot(callback) Takes a screenshot of the current page. close() Closes the browser window. quit() Quits the browser. get(url) Navigates to the specified url. refresh() Refreshes the current page. back() Goes back to the previous page. forward() Goes forward to the next page. executeScript(script, callback) Executes the script in the context of the current page. executeAsyncScript(script, callback) Executes the script in the context of the current page. waitForElement(locator, timeout, callback) Wait for an element to be present on the page. waitForElementNotPresent(locator, timeout, callback) Wait for an element to be not present on the page. waitForElementVisible(locator, timeout, callback) Wait for an element to be visible on the page. waitForElementNotVisible(locator, timeout, callback) Wait for an element to be not visible on the page. waitForElementEnabled(locator, timeout, callback) Wait for an element to be enabled on the page. waitForElementNotEnabled(locator, timeout, callback) Wait for an element to be not enabled on the page. waitForElementSelected(locator, timeout, callback) Wait for an element to be selected on the page. waitForElementNotSelected(locator, timeout, callback) Wait for an element to be not selected on the page. waitForText(locator, text, timeout, callback) Wait for text to be present on the page. waitForTextNotPresent(locator, text, timeout, callback) Wait for text to be not present on the page. waitForTitle(title, timeout, callback) Wait for the title to be present on the page. waitForTitleNotPresent(title, timeout, callback) Wait for the title to be not present on the page

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful