diff --git a/src/main/app.js b/src/main/app.js index 28b264f..4d76481 100644 --- a/src/main/app.js +++ b/src/main/app.js @@ -25,6 +25,7 @@ define([ 'angular', 'tmdb/partials/search/SearchController', 'tmdb/partials/home/HomeController', 'tmdb/partials/movie/MovieController', + 'tmdb/partials/money/MoneyController', 'tmdb/partials/person/PersonController', 'tmdb/partials/awesomeSearch/AwesomeSearchController', 'tmdb/partials/awesomeSearch/AwesomeSearchResultsController', @@ -38,15 +39,17 @@ define([ 'angular', 'tmdb/directives/similarMovies', 'tmdb/directives/movieCast', 'tmdb/directives/movieCrew', + 'tmdb/directives/money', 'tmdb/directives/awesomeSearch', 'tmdb/directives/awesomeSearchResults'], function( angular, config, $resource, $location, LocalStorageModule, - TMDBAPIService, SearchController, HomeController, MovieController, - PersonController, AwesomeSearchController, AwesomeSearchResultsController, - RemoteImageLoader, searchDirective, popularMoviesDirective, - personDetailDirective, personCrewDirective, personCastDirective, - movieDetailDirective, similarMoviesDirective, movieCastDirective, - movieCrewDirective, awesomeSearchDirective, awesomeSearchResultsDirective ) { + TMDBAPIService, SearchController, HomeController, MovieController, + MoneyController, PersonController, AwesomeSearchController, + AwesomeSearchResultsController, RemoteImageLoader, searchDirective, + popularMoviesDirective, personDetailDirective, personCrewDirective, + personCastDirective, movieDetailDirective, similarMoviesDirective, + movieCastDirective, movieCrewDirective, moneyDirective, awesomeSearchDirective, + awesomeSearchResultsDirective ) { "use strict"; /** @constructs app */ @@ -65,19 +68,17 @@ define([ 'angular', app.service( "TMDBAPIService", TMDBAPIService); + + + app.controller( "AwesomeSearchResultsController", AwesomeSearchResultsController ); - app.directive( "awesomeSearchResults", awesomeSearchResultsDirective ); - app.controller( "AwesomeSearchController", AwesomeSearchController ); - app.directive( "awesomeSearch", awesomeSearchDirective ); - app.controller( "SearchController", SearchController); - app.directive( "search", searchDirective ); - app.controller( "HomeController", HomeController ); app.controller( "MovieController", MovieController ); app.controller( "PersonController", PersonController); app.controller( "RemoteImageLoader", RemoteImageLoader ); + app.controller( "MoneyController", MoneyController ); app.directive( "popularMovies", popularMoviesDirective ); app.directive( "personDetail", personDetailDirective ); @@ -87,6 +88,12 @@ define([ 'angular', app.directive( "similarMovies", similarMoviesDirective ); app.directive( "movieCast", movieCastDirective ); app.directive( "movieCrew", movieCrewDirective ); + app.directive("money", moneyDirective); + app.directive( "awesomeSearchResults", awesomeSearchResultsDirective ); + app.directive( "awesomeSearch", awesomeSearchDirective ); + app.directive( "search", searchDirective ); + + app.config(['$routeProvider', function($routeProvider) { $routeProvider.when( '/', { templateUrl: '/tmdb/partials/home/home.html', controller: 'HomeController' } ); diff --git a/src/main/index.html b/src/main/index.html index 103addc..bb2c992 100644 --- a/src/main/index.html +++ b/src/main/index.html @@ -2,17 +2,20 @@ -TMDB API Programming Test +Awesome TMDB App + diff --git a/src/main/tmdb/directives/money.js b/src/main/tmdb/directives/money.js new file mode 100644 index 0000000..0ae89b3 --- /dev/null +++ b/src/main/tmdb/directives/money.js @@ -0,0 +1,23 @@ +/** + * + */ + +define( [ 'angular', 'tmdb/partials/money/MoneyController'], + function(angular, MoneyController) { + "use strict"; + + return function() { + return { + transclude: true, + replace: true, + controller: MoneyController, + templateUrl: '/tmdb/partials/money/money.html', + restrict: 'E', + scope: { + budget: '=', + revenue: '=' + } + }; + }; + } +); \ No newline at end of file diff --git a/src/main/tmdb/partials/awesomeSearch/AwesomeSearchController.js b/src/main/tmdb/partials/awesomeSearch/AwesomeSearchController.js index efe475e..3bf91c1 100644 --- a/src/main/tmdb/partials/awesomeSearch/AwesomeSearchController.js +++ b/src/main/tmdb/partials/awesomeSearch/AwesomeSearchController.js @@ -31,7 +31,7 @@ define( [ 'angular', var limitName = 24; var config = angular.module("config"); - var defaultImage = "http://simpleicon.com/wp-content/uploads/movie-1.png"; + var defaultImage = "https://simpleicon.com/wp-content/uploads/movie-1.png"; $scope.searchPhrase = ""; diff --git a/src/main/tmdb/partials/money/MoneyController.js b/src/main/tmdb/partials/money/MoneyController.js new file mode 100644 index 0000000..7236509 --- /dev/null +++ b/src/main/tmdb/partials/money/MoneyController.js @@ -0,0 +1,50 @@ +/** + * MovieController provides controller support for fetching movies from tmdb + * + * @module tmdb.partials.movie.MovieController + * + * @requires angular + * @requires ngRoute + * @requires config + * @requires TMDBAPIService + * + * @author Barry Skidmore + * + * @returns instance of the MovieController + * + * @copyright Alert Logic, Inc 2014 + * + */ + +define(['angular', + 'ngRoute', + 'config/config', + 'tmdb/services/TMDBAPIService' + ], + function(angular, $routeParams, config, TMDBAPIService) { + "use strict"; + + var MoneyController = function($scope, TMDBAPIService, $routeParams) { + + $scope.num_icons_budget = Math.floor($scope.budget / 100000000); + $scope.num_icons_revenue = Math.floor($scope.revenue / 100000000); + if ($scope.num_icons_budget === 0) { + $scope.num_icons_budget = 1; + } + if ($scope.num_icons_revenue === 0) { + $scope.num_icons_revenue = 1; + } + + $scope.range = function(min, max, step) { + step = step || 1; + var input = []; + for (var i = min; i <= max; i += step){ input.push(i);} + return input; + }; + + }; + + MoneyController.$inject = ['$scope', 'TMDBAPIService', '$routeParams']; + return MoneyController; + } +); \ No newline at end of file diff --git a/src/main/tmdb/partials/money/money.html b/src/main/tmdb/partials/money/money.html new file mode 100644 index 0000000..b559504 --- /dev/null +++ b/src/main/tmdb/partials/money/money.html @@ -0,0 +1,10 @@ +
+
+
+ Budget $ {{ budget | number }} USD +
+
+
+ Revenue $ {{ revenue | number }} USD +
+
\ No newline at end of file diff --git a/src/main/tmdb/partials/movie/detail.html b/src/main/tmdb/partials/movie/detail.html index e159a00..7626346 100644 --- a/src/main/tmdb/partials/movie/detail.html +++ b/src/main/tmdb/partials/movie/detail.html @@ -19,14 +19,11 @@

{{ detail.details.tagline }}

Running Time {{ detail.details.runtime }} minutes -
-
- Budget ${{ detail.details.budget | number }} USD -
-
- Revenue ${{ detail.details.revenue | number }} USD -
-
+ + + + +