Skip to content

Commit

Permalink
Fixed the API call; added better routing from search results
Browse files Browse the repository at this point in the history
  • Loading branch information
mcnielsen committed May 6, 2016
1 parent c31486f commit d81bf8c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/main/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ define([ 'angular',
$routeProvider.when( '/movie/:id', { templateUrl: '/tmdb/partials/movie/movie.html', controller: 'MovieController' } );

$routeProvider.when( '/television/:tvshow_id', { templateUrl: '/tmdb/partials/television/television.html', controller: 'TelevisionController' } );
$routeProvider.when( '/television/:tvshow_id/season/:season_id', { templateUrl: '/tmdb/partials/television/television.html', controller: 'TelevisionSeasonController' } );
$routeProvider.when( '/television/:tvshow_id/season/:season_number', { templateUrl: '/tmdb/partials/television/television.html', controller: 'TelevisionSeasonController' } );
$routeProvider.when( '/television/:tvshow_id/season/:season_id/episode/:episode_id', { templateUrl: '/tmdb/partials/television/television.html', controller: 'TelevisionEpisodeController' } );

//$routeProvider.when( '/movie/:name/:id', { templateUrl: '/tmdb/partials/simpleMovie/simpleMovie.html', controller: 'SimpleMovieController' } );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
</a>
<span class="badge">{{result.media_type}}</span>
<span>
<a href="/#/movie/{{result.id}}" style="font-size:8pt">{{result.formatName}}</a>
<span ng-if="result.media_type =='tv'">
<a href="/#/television/{{result.id}}" style="font-size:8pt">{{result.formatName}}</a>
</span>
<span ng-if="result.media_type =='movie'">
<a href="/#/movie/{{result.id}}" style="font-size:8pt">{{result.formatName}}</a>
</span>

</div>
Expand All @@ -17,4 +21,4 @@
<movie-trailer ng-model="currentMovie"> </movie-trailer>

</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ define( [ 'angular',


console.log("Route params: ", $routeParams );
/* ROUTE definition: '/television/:tvshow_id/season/:season_id' */
TMDBAPIService.getTVShowSeason( $routeParams.tvshow_id, $routeParams.season_id ).then( function( season ) {
/* ROUTE definition: '/television/:tvshow_id/season/:season_number' */
TMDBAPIService.getTVShowSeason( $routeParams.tvshow_id, $routeParams.season_number ).then( function( season ) {
console.log("Season information: ", season );
} );

Expand Down
4 changes: 2 additions & 2 deletions src/main/tmdb/services/TMDBAPIService.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ define( [ 'angular',
} );
};

this.getTVShowSeason = function( tvShowID, tvSeasonID ) {
this.getTVShowSeason = function( tvShowID, seasonIndex ) {
var req = {
method: 'GET',
url: apiBaseUrl + "/tv/" + tvShowID + "/season/" + tvSeasonID,
url: apiBaseUrl + "/tv/" + tvShowID + "/season/" + seasonIndex,
params: {
api_key: apiKey
}
Expand Down

0 comments on commit d81bf8c

Please sign in to comment.