Reorganizes the entire app to follow Google's best practice recommendations for Angular App Structure.
see: https://docs.google.com/document/d/1XXMvReO8-Awi1EZXAXS4PzDzdNvV6pGcuaF4Q9821Es/pub The files are now grouped by view / component. Tests are located beside tested js files. The Grunt build will be responsible for only distributing actual files without the tests. Each partial is at the same level as the js files related to it. Ideally css files should be at the same level, maybe I'll refactor this later. Moves all non-bower plugins to app/vendor. Moves all images to app/images and styles to app/styles. Merges the test and non-test jshintrc files. Adds all the Jamstash contributors to the package.json file while I was refactoring. Conflicts: app/app.js app/images/vgrabber.gif app/images/vgrabber2-active.gif app/images/vgrabber2-normal.gif app/index.html
This commit is contained in:
parent
b190d2f99f
commit
a1d48bbd30
135 changed files with 78 additions and 103 deletions
52
js/app.js
52
js/app.js
|
@ -1,52 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
/* Declare app level module */
|
||||
var jamstash = angular.module('JamStash', ['ngCookies', 'ngRoute', 'ngSanitize',
|
||||
'jamstash.subsonic.ctrl']);
|
||||
|
||||
jamstash.config(function ($routeProvider) {
|
||||
$routeProvider
|
||||
.when('/index', { redirectTo: '/library' })
|
||||
.when('/settings', { templateUrl: 'js/partials/settings.html', controller: 'SettingsCtrl' })
|
||||
.when('/queue', { templateUrl: 'js/partials/queue.html', controller: 'QueueCtrl' })
|
||||
.when('/library', { templateUrl: 'js/partials/library.html', controller: 'SubsonicCtrl' })
|
||||
.when('/library/:artistId', { templateUrl: 'js/partials/library.html', controller: 'SubsonicCtrl', reloadOnSearch: false })
|
||||
.when('/library/:artistId/:albumId', { templateUrl: 'js/partials/library.html', controller: 'SubsonicCtrl', reloadOnSearch: false })
|
||||
.when('/playlists', { templateUrl: 'js/partials/playlists.html', controller: 'PlaylistCtrl' })
|
||||
.when('/podcasts', { templateUrl: 'js/partials/podcasts.html', controller: 'PodcastCtrl' })
|
||||
.when('/archive', { templateUrl: 'js/partials/archive.html', controller: 'ArchiveCtrl' })
|
||||
.when('/archive/:artist', { templateUrl: 'js/partials/archive.html', controller: 'ArchiveCtrl' })
|
||||
.when('/archive/:artist/:album', { templateUrl: 'js/partials/archive.html', controller: 'ArchiveCtrl' })
|
||||
.otherwise({ redirectTo: '/index' });
|
||||
});
|
||||
|
||||
jamstash.config(function ($httpProvider) {
|
||||
$httpProvider.interceptors.push(function ($rootScope, $location, $q, globals) {
|
||||
return {
|
||||
'request': function (request) {
|
||||
// if we're not logged-in to the AngularJS app, redirect to login page
|
||||
//$rootScope.loggedIn = $rootScope.loggedIn || globals.settings.Username;
|
||||
$rootScope.loggedIn = false;
|
||||
if (globals.settings.Username != "" && globals.settings.Password != "" && globals.settings.Server != "") {
|
||||
$rootScope.loggedIn = true;
|
||||
}
|
||||
var path = '';
|
||||
path = $location.path();
|
||||
if (globals.settings.Debug) { console.log('Logged In: ' + $rootScope.loggedIn); }
|
||||
if (globals.settings.Debug) { console.log('Current Path: ' + path); }
|
||||
if (!$rootScope.loggedIn && path != '/settings' && path.search('archive') < 0) {
|
||||
$location.path('/settings');
|
||||
}
|
||||
return request;
|
||||
},
|
||||
'responseError': function (rejection) {
|
||||
// if we're not logged-in to the web service, redirect to login page
|
||||
if (rejection.status === 401 && $location.path() != '/settings') {
|
||||
$rootScope.loggedIn = false;
|
||||
$location.path('/settings');
|
||||
}
|
||||
return $q.reject(rejection);
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue