diff --git a/app/components/transcript/transcript.js b/app/components/transcript/transcript.js index 89a263d..1e5101b 100644 --- a/app/components/transcript/transcript.js +++ b/app/components/transcript/transcript.js @@ -33,7 +33,7 @@ export default ['$http', 'transcriptService', '$stateParams', function($http, tr scope.domain_logo_secondary = transcript.organization.logo; } - transcriptService.getTranscriptForUser($stateParams.userId) + transcriptService.getTranscriptForUser($stateParams.userId, $stateParams.sample) .then(transcript => { scope.domain_logo_secondary = logo(transcript, transcript.organization.logo); diff --git a/app/components/transcript/transcriptService.js b/app/components/transcript/transcriptService.js index cbbef6c..83355b3 100644 --- a/app/components/transcript/transcriptService.js +++ b/app/components/transcript/transcriptService.js @@ -22,15 +22,8 @@ export default ['$http', '$q', function($http, $q){ return levels; }; - this.getTranscriptUrl = function(user) { - // - // Extract sample query param, and match against whitelist of samples. - // If match, return sample json. - // Else, use transcript api. - // - const matches = window.location.href.match(/sample=([^&]*)/); - const sample = !!matches && matches.length === 2 ? matches[1] : null; - + this.getTranscriptUrl = function(user, sample) { + switch (sample) { case 'atlas': return atlas; case 'capella': return capella; @@ -43,12 +36,10 @@ export default ['$http', '$q', function($http, $q){ `/api/v2/users/${user}/transcript`; }; - this.getTranscriptForUser = function(user){ + this.getTranscriptForUser = function(user, sample){ //todo: pull this out to siome sort of filter - const url = this.getTranscriptUrl(user); - - // DEBUG: + const url = this.getTranscriptUrl(user, sample); console.dir("Fetching: "+url); console.dir(window.location); diff --git a/app/index.js b/app/index.js index fa0b563..9501048 100644 --- a/app/index.js +++ b/app/index.js @@ -35,6 +35,10 @@ app.config(['$stateProvider', '$urlRouterProvider', ($stateProvider, $urlRouterP // // Now set up the states $stateProvider + .state('samples', { + url: "/samples/:sample", + template: '' + }) .state('userTranscript', { url: "/:userId", template: ''