forked from johncar/al_ui_template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request johncar#1 from crisefd/money-directive
Money directive
- Loading branch information
Showing
7 changed files
with
113 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: '=' | ||
} | ||
}; | ||
}; | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]> | ||
* | ||
* @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; | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<div class="col-md-6"> | ||
<div class="detail"> | ||
<i class="fa fa-money" style="color: green" ng-repeat="i in range(1, num_icons_budget)"></i></br> | ||
<span>Budget $ {{ budget | number }} USD</span> | ||
</div> | ||
<div class="detail"> | ||
<i class="fa fa-money" style="color: green" ng-repeat="j in range(1, num_icons_revenue)"></i></br> | ||
<span>Revenue $ {{ revenue | number }} USD </span> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters