Skip to content
This repository was archived by the owner on Sep 23, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/components/transcript/transcript.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
17 changes: 4 additions & 13 deletions app/components/transcript/transcriptService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ app.config(['$stateProvider', '$urlRouterProvider', ($stateProvider, $urlRouterP
//
// Now set up the states
$stateProvider
.state('samples', {
url: "/samples/:sample",
template: '<transcript></transcript>'
})
.state('userTranscript', {
url: "/:userId",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to switch to users/self and users/:userId for future extensibility

template: '<transcript></transcript>'
Expand Down