3.4.2 Archive tab updates

This commit is contained in:
Trevor Squillario 2014-05-05 18:50:17 -04:00
parent 1f8c286a13
commit e5318f395b
8 changed files with 183 additions and 112 deletions

View file

@ -1,5 +1,5 @@
JamStash.controller('ArchiveCtrl', JamStash.controller('ArchiveCtrl',
function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils, globals, model, notifications, player, archive, json) { function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, $timeout, utils, globals, model, notifications, player, archive, json) {
$scope.settings = globals.settings; $scope.settings = globals.settings;
$scope.itemType = 'archive'; $scope.itemType = 'archive';
$rootScope.song = []; $rootScope.song = [];
@ -35,6 +35,8 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
if ($scope.SavedCollections.indexOf(newValue) == -1) { if ($scope.SavedCollections.indexOf(newValue) == -1) {
$scope.SavedCollections.push(newValue); $scope.SavedCollections.push(newValue);
$scope.writeSavedCollection(); $scope.writeSavedCollection();
var index = $scope.AllArtists.indexOf(newValue);
$scope.AllArtists.splice(index, 1);
} }
}; };
$scope.deleteSavedCollection = function (index) { $scope.deleteSavedCollection = function (index) {
@ -79,7 +81,7 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
} else { } else {
utils.setValue('AlbumSort', null, true); utils.setValue('AlbumSort', null, true);
} }
$scope.getAlbums(''); $scope.getAlbums($scope.selectedArtist);
} }
}); });
$scope.getYears = function (startYear) { $scope.getYears = function (startYear) {
@ -98,7 +100,7 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
}; };
$scope.filterSave = function () { $scope.filterSave = function () {
if ($scope.selectedArtist) { if ($scope.selectedArtist) {
$scope.getAlbums('', ''); $scope.getAlbums($scope.selectedArtist, $scope.filter);
} }
}; };
/* End Filter */ /* End Filter */
@ -118,14 +120,23 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
$scope.song = data.song; $scope.song = data.song;
$scope.album = data.album; $scope.album = data.album;
$scope.selectedArtist = data.selectedArtist; $scope.selectedArtist = data.selectedArtist;
$scope.BreadCrumbs = data.breadcrumb;
}); });
}; };
$scope.getSongs = function (id, action) { $scope.getSongs = function (id, action) {
archive.getSongs(id, action).then(function (data) { archive.getSongs(id, action).then(function (data) {
$scope.song = data.song;
$scope.album = data.album; $scope.album = data.album;
$scope.song = data.song;
$scope.selectedAlbum = data.selectedAlbum; $scope.selectedAlbum = data.selectedAlbum;
$scope.BreadCrumbs = data.breadcrumb;
//$rootScope.showSongs();
//alert($("#songs").html())
//utils.safeApply();
$timeout(
function () {
$.fancybox.update();
}
);
}); });
}; };
$scope.scrollToTop = function () { $scope.scrollToTop = function () {
@ -149,13 +160,13 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
/* Launch on Startup */ /* Launch on Startup */
//$scope.getArtists(); //$scope.getArtists();
//$scope.getCollections(); $scope.getAlbums();
if ($routeParams.artist) { if ($routeParams.artist) {
if ($routeParams.album) { if ($routeParams.album) {
//collection:(GreenskyBluegrass) AND format:(MP3) AND identifier:(gsbg2013-09-20.flac16) //collection:(GreenskyBluegrass) AND format:(MP3) AND identifier:(gsbg2013-09-20.flac16)
$scope.getAlbums('', $routeParams.album); $scope.getSongs($routeParams.album);
} else { } else {
$scope.getAlbums($routeParams.artist, ''); $scope.getAlbums($routeParams.artist);
} }
$scope.addSavedCollection($routeParams.artist); $scope.addSavedCollection($routeParams.artist);
} }

View file

@ -391,6 +391,7 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, $htt
$scope.getGenres(); $scope.getGenres();
$scope.getPodcasts(); $scope.getPodcasts();
$scope.openDefaultSection(); $scope.openDefaultSection();
$scope.getMusicFolders();
if ($routeParams.artistId && $routeParams.albumId) { if ($routeParams.artistId && $routeParams.albumId) {
$scope.getAlbumByTag($routeParams.albumId); $scope.getAlbumByTag($routeParams.albumId);
} else if ($routeParams.artistId) { } else if ($routeParams.artistId) {

View file

@ -160,6 +160,38 @@ function AppCtrl($scope, $rootScope, $document, $window, $location, $cookieStore
title: null title: null
} }
}); });
/*
$('.showSongs').fancybox({
href: '#songs',
autoWidth: false,
width: '100%',
//margin: [50, 10, 50, 10], // top, right, bottom, left
openEffect: 'none',
closeEffect: 'none',
beforeLoad: function () {
if ($rootScope.queue == 0) {
//this.close();
}
},
helpers: {
title: null
}
});
$rootScope.showSongs = function () {
alert($("#songs").html())
$.fancybox({
type: 'inline',
content: $("#songs").html(),
autoWidth: false,
width: '100%',
transitionIn: 'elastic',
transitionOut: 'elastic',
helpers: {
title: null
}
});
}
*/
$('#audiocontainer .scrubber').mouseover(function (e) { $('#audiocontainer .scrubber').mouseover(function (e) {
$('.audiojs .scrubber').stop().animate({ height: '8px' }); $('.audiojs .scrubber').stop().animate({ height: '8px' });
@ -507,8 +539,7 @@ function AppCtrl($scope, $rootScope, $document, $window, $location, $cookieStore
$scope.loadSettings(); $scope.loadSettings();
utils.switchTheme(globals.settings.Theme); utils.switchTheme(globals.settings.Theme);
if ($scope.loggedIn()) { if ($scope.loggedIn()) {
$scope.ping(); //$scope.ping();
$scope.getMusicFolders();
if (globals.settings.SaveTrackPosition) { if (globals.settings.SaveTrackPosition) {
player.loadTrackPosition(); player.loadTrackPosition();
player.startSaveTrackPosition(); player.startSaveTrackPosition();

View file

@ -3,7 +3,7 @@
"date": "5/4/2014", "version": "3.4.1", "date": "5/4/2014", "version": "3.4.1",
"changes": [ "changes": [
{ "text": "- Tab state saved, consolidated Subsonic artists, playlist and podcasts" }, { "text": "- Tab state saved, consolidated Subsonic artists, playlist and podcasts" },
{ "text": "- Archive.org tab, expanded Collection search" } { "text": "- Archive.org tab, Collection search, added breadcrumb" }
] ]
}, },
{ {

View file

@ -28,7 +28,7 @@
</li> </li>
</ul> </ul>
<ul class="simplelist mainlist noselect"> <ul class="simplelist mainlist noselect">
<li class="item" ng-repeat="o in AllArtists" ng-click="getAlbums(o)" ng-class="{ 'selected': selectedArtist == o }"> <li class="item" ng-repeat="o in AllArtists" ng-click="getAlbums(o)">
<div class="infolink"> <div class="infolink">
<a href="" class="hover" title="Save Collection" ng-click="addSavedCollection(o)" stop-event="click"> <img src="images/pin_gl_12x12.png" /> </a> <a href="" class="hover" title="Save Collection" ng-click="addSavedCollection(o)" stop-event="click"> <img src="images/pin_gl_12x12.png" /> </a>
</div> </div>
@ -50,11 +50,17 @@
<input type="text" id="Description" name="Description" class="m" ng-model="filter.Description" placeholder="Description" title="Description" /> <input type="text" id="Description" name="Description" class="m" ng-model="filter.Description" placeholder="Description" title="Description" />
<a href="" class="button" ng-click="filterSave()"><img class="pad" src="images/magnifying_glass_alt_12x12.png" /></a>&nbsp; <a href="" class="button" ng-click="filterSave()"><img class="pad" src="images/magnifying_glass_alt_12x12.png" /></a>&nbsp;
</form> </form>
<div id="BreadCrumb">
<div id="BreadCrumbs" class="floatleft">
<div class="crumb" ng-repeat="o in BreadCrumbs | filter:{type:'artist'}"><a ng-click="getAlbums(o.name, filter)">{{o.name}}</a> &gt;</div>
<div class="crumb" ng-repeat="o in BreadCrumbs | filter:{type:'album'}"><a ng-click="getSongs(o.id, '')">{{o.name}}</a> &gt;</div>
</div>
</div>
</li> </li>
</ul> </ul>
<div class="clear"></div> <div class="clear"></div>
<ul class="simplelist songlist noselect"> <ul class="simplelist songlist noselect">
<li class="album" ng-repeat="o in album" ng-switch on="o.type" ng-class="{'selected': selectedAlbum == o.id}" ng-click="getSongs(o.id, '')"> <li class="album showSongs" ng-repeat="o in album" ng-switch on="o.type" ng-class="{'selected': selectedAlbum == o.id}" ng-click="getSongs(o.id, '')">
<div id="{{'AlbumInfo' + $index}}" class="infolink"> <div id="{{'AlbumInfo' + $index}}" class="infolink">
<a href="" class="hover" title="More Info..." ng-click="toggleSubmenu('#submenu_AlbumInfo' + $index, '#AlbumInfo' + $index, 'right', 10)" stop-event="click"><img src="images/info_gl_6x12.png" /></a> <a href="" class="hover" title="More Info..." ng-click="toggleSubmenu('#submenu_AlbumInfo' + $index, '#AlbumInfo' + $index, 'right', 10)" stop-event="click"><img src="images/info_gl_6x12.png" /></a>
</div> </div>
@ -75,7 +81,9 @@
<div class="description shadow" ng-bind-html="o.description"></div> <div class="description shadow" ng-bind-html="o.description"></div>
<div class="clear"></div> <div class="clear"></div>
</li> </li>
<div ng-if="song.length > 0" ng-include src="'js/partials/songs.html'"></div> <ul class="simplelist songlist noselect" ng-if="song.length > 0">
<div class="songs" ng-include src="'js/partials/songs.html'"></div>
</ul>
</ul> </ul>
</div> </div>
</div> </div>

View file

@ -1341,6 +1341,7 @@ JamStash.factory('archive', function ($rootScope, $http, $q, $sce, globals, mode
}, },
getAlbums: function (name, filter) { getAlbums: function (name, filter) {
var deferred = $q.defer(); var deferred = $q.defer();
if (name) {
var url = globals.archiveUrl + 'advancedsearch.php?q='; var url = globals.archiveUrl + 'advancedsearch.php?q=';
if (name !== '') { if (name !== '') {
content.selectedArtist = name; content.selectedArtist = name;
@ -1351,6 +1352,8 @@ JamStash.factory('archive', function ($rootScope, $http, $q, $sce, globals, mode
} else { } else {
url += 'collection:(' + name + ')'; url += 'collection:(' + name + ')';
} }
content.breadcrumb = [];
content.breadcrumb.push({ 'type': 'artist', 'id': name, 'name': name });
if (filter.Source) { if (filter.Source) {
url += ' AND source:(' + filter.Source + ')'; url += ' AND source:(' + filter.Source + ')';
@ -1393,11 +1396,17 @@ JamStash.factory('archive', function ($rootScope, $http, $q, $sce, globals, mode
notifications.updateMessage('Archive.org service down :('); notifications.updateMessage('Archive.org service down :(');
} }
}); });
} else {
deferred.resolve(content);
}
return deferred.promise; return deferred.promise;
}, },
getSongs: function (id, action) { getSongs: function (id, action) {
var deferred = $q.defer(); var deferred = $q.defer();
if (id) {
content.selectedAlbum = id; content.selectedAlbum = id;
if (content.breadcrumb.length > 0) { content.breadcrumb.splice(1, (content.breadcrumb.length - 1)); }
content.breadcrumb.push({ 'type': 'album', 'id': id, 'name': id });
var url = globals.archiveUrl + 'details/' + id + '?output=json'; var url = globals.archiveUrl + 'details/' + id + '?output=json';
$.ajax({ $.ajax({
url: url, url: url,
@ -1445,6 +1454,9 @@ JamStash.factory('archive', function ($rootScope, $http, $q, $sce, globals, mode
deferred.resolve(content); deferred.resolve(content);
} }
}); });
} else {
deferred.resolve(content);
}
return deferred.promise; return deferred.promise;
} }
}; };

View file

@ -1,6 +1,6 @@
JamStash.service('utils', function ($cookieStore, globals, model) { JamStash.service('utils', function ($rootScope, $cookieStore, globals, model) {
this.safeApply = function (fn) { this.safeApply = function (fn) {
var phase = this.$root.$$phase; var phase = $rootScope.$root.$$phase;
if (phase == '$apply' || phase == '$digest') { if (phase == '$apply' || phase == '$digest') {
if (fn && (typeof (fn) === 'function')) { if (fn && (typeof (fn) === 'function')) {
fn(); fn();

View file

@ -1175,6 +1175,14 @@ ul.songlist li:hover
position: fixed; position: fixed;
} }
#songs {
width: 1200px;
display: none;
}
#songs .songlist {
padding: 35px 0 0 0;
}
/* Player Style */ /* Player Style */
#player #player
{ {