summaryrefslogtreecommitdiff
path: root/static/scripts/app/controllers.js
diff options
context:
space:
mode:
authorMichaël Ball <michael.ball@gmail.com>2014-12-28 12:24:22 +0000
committerMichaël Ball <michael.ball@gmail.com>2015-11-27 20:02:04 +0000
commit75beec91a8526fbbc0a90134140b9dff6af15c0c (patch)
tree02414e46da3e08000384c40c27b7aab9748de0fe /static/scripts/app/controllers.js
parenta2964845e3c03b9cf5f01583f53f7553c7d67caf (diff)
Initial frontend work
Diffstat (limited to 'static/scripts/app/controllers.js')
-rw-r--r--static/scripts/app/controllers.js148
1 files changed, 148 insertions, 0 deletions
diff --git a/static/scripts/app/controllers.js b/static/scripts/app/controllers.js
new file mode 100644
index 0000000..35340e6
--- /dev/null
+++ b/static/scripts/app/controllers.js
@@ -0,0 +1,148 @@
+var mach2Controllers = angular.module(
+ 'mach2Controllers',
+ [
+ 'ui.bootstrap',
+ 'angularMoment'
+ ]
+);
+
+mach2Controllers.controller('NavCtrl', ['$scope', function($scope) {
+}]);
+
+mach2Controllers.controller(
+ 'ArtistCtrl',
+ [
+ '$scope',
+ 'ArtistSearch',
+ function($scope, ArtistSearch) {
+ $scope.totalArtists = ArtistSearch.query();
+ $scope.indices = [
+ 'A',
+ 'B',
+ 'C',
+ 'D',
+ 'E',
+ 'F',
+ 'G',
+ 'H',
+ 'I',
+ 'J',
+ 'K',
+ 'L',
+ 'M',
+ 'N',
+ 'O',
+ 'P',
+ 'Q',
+ 'R',
+ 'S',
+ 'T',
+ 'U',
+ 'V',
+ 'W',
+ 'X',
+ 'Y',
+ 'Z',
+ '0-9',
+ 'Other'
+ ];
+ $scope.selectedIndex = $scope.indices[0];
+ }
+ ]
+);
+
+mach2Controllers.controller(
+ 'ArtistDetailCtrl',
+ [
+ '$scope',
+ '$stateParams',
+ 'Artist',
+ 'ArtistAlbums',
+ 'ArtistTracks',
+ function(
+ $scope,
+ $stateParams,
+ Artist,
+ ArtistAlbums,
+ ArtistTracks
+ ) {
+ console.log('Am I here?');
+ $scope.artist = Artist.query({
+ artistId: $stateParams.artistId
+ });
+
+ $scope.albums = ArtistAlbums.query({
+ artistId: $stateParams.artistId
+ });
+
+ $scope.tracks = ArtistTracks.query({
+ artistId: $stateParams.artistId
+ });
+ }
+ ]
+);
+
+mach2Controllers.controller(
+ 'ArtistTracksCtrl',
+ [
+ '$scope',
+ '$stateParams',
+ 'Artist',
+ 'ArtistTracks',
+ function($scope, $stateParams, Artist, ArtistTracks) {
+ $scope.artist = Artist.query({
+ artistId: $stateParams.artistId
+ });
+
+ $scope.tracks = ArtistTracks.query({
+ artistId: $stateParams.artistId
+ });
+ }
+ ]
+);
+
+mach2Controllers.controller(
+ 'AlbumCtrl',
+ [
+ '$scope',
+ 'AlbumArtists',
+ 'AlbumSearch',
+ function($scope, AlbumArtists, AlbumSearch) {
+ // horrible way of calculating decades
+ var currentYear = moment().format('YYYY');
+ var startDecade = 1940;
+
+ var decades = [];
+
+ for (i = (startDecade/10); i <= (currentYear/10); i++) {
+ decades.push(i * 10);
+ }
+
+ $scope.albums = AlbumSearch.query();
+ $scope.indices = decades;
+ $scope.selectedIndex = $scope.indices[0];
+ $scope.albumArtists = AlbumArtists;
+ }
+ ]
+);
+
+mach2Controllers.controller(
+ 'AlbumDetailCtrl',
+ [
+ '$scope',
+ '$stateParams',
+ 'Album',
+ 'AlbumTracks',
+ function(
+ $scope,
+ $stateParams,
+ Album,
+ AlbumTracks
+ ) {
+
+ }
+ ]
+);
+
+mach2Controllers.controller('TrackCtrl', ['$scope', function($scope) {
+}]);