notifications fix

This commit is contained in:
Trevor Squillario 2014-12-08 20:48:12 -05:00
parent 08f09f8067
commit f8ef2ba227
7 changed files with 51 additions and 37 deletions

View file

@ -1,6 +1,6 @@
angular.module('JamStash')
.controller('AppCtrl', ['$scope', '$rootScope', '$document', '$window', '$location', '$cookieStore', 'utils', 'globals', 'model', 'notifications', 'player',
function($scope, $rootScope, $document, $window, $location, $cookieStore, utils, globals, model, notifications, player) {
.controller('AppCtrl', ['$scope', '$rootScope', '$document', '$window', '$location', '$cookieStore', '$http', 'utils', 'globals', 'model', 'notifications', 'player',
function($scope, $rootScope, $document, $window, $location, $cookieStore, $http, utils, globals, model, notifications, player) {
'use strict';
$rootScope.settings = globals.settings;
@ -162,7 +162,7 @@
}
}
};
$rootScope.showIndex = false;
$scope.dragStart = function (e, ui) {
ui.item.data('start', ui.item.index());
};
@ -173,6 +173,10 @@
$rootScope.queue.splice(start, 1)[0]);
$scope.$apply();
};
$(document).on( 'click', 'message', function() {
$(this).fadeOut(function () { $(this).remove(); });
return false;
})
$document.keydown(function (e) {
$scope.scrollToIndex(e);
});
@ -328,6 +332,14 @@
});
};
$scope.ping = function () {
return $http({
method: 'GET',
timeout: globals.settings.Timeout,
url: globals.BaseURL() + '/ping.view?' + globals.BaseParams(),
}).error(function (data) {
notifications.updateMessage('Unable to connect to Subsonic server');
});
/*
$.ajax({
url: globals.BaseURL() + '/ping.view?' + globals.BaseParams(),
method: 'GET',
@ -346,6 +358,7 @@
notifications.updateMessage('Unable to connect to Subsonic server');
}
});
*/
};
$scope.queueRemoveSelected = function (data, event) {
angular.forEach($scope.selectedSongs, function (item, key) {

View file

@ -11,17 +11,12 @@ angular.module('jamstash.notifications', [])
var msgIndex = 1;
this.updateMessage = function (msg, autohide) {
if (msg !== '') {
$rootScope.Messages.push(msg);
var id = $rootScope.Messages.push(msg) - 1;
$('#messages').fadeIn();
if (autohide) {
setTimeout(function () {
$(el).fadeOut(function () { $(this).remove(); });
$('#msg_' + id).fadeOut(function () { $(this).remove(); });
}, globals.settings.Timeout);
} else {
$(el).click(function () {
$(el).fadeOut(function () { $(this).remove(); });
return false;
});
}
}
};

View file

@ -62,7 +62,17 @@
notifications.updateMessage('Settings Updated!', true);
$scope.loadSettings();
if (globals.settings.Server !== '' && globals.settings.Username !== '' && globals.settings.Password !== '') {
$scope.ping();
$scope.ping().then(function(data) {
if (data["subsonic-response"].status == 'ok') {
globals.settings.ApiVersion = data["subsonic-response"].version;
$location.path('/library').replace();
$rootScope.showIndex = true;
} else {
if (typeof data["subsonic-response"].error != 'undefined') {
notifications.updateMessage(data["subsonic-response"].error.message);
}
}
});
}
};
json.getChangeLog(function (data) {
@ -92,8 +102,8 @@
globals.settings.Username = Username;
globals.settings.Password = Password;
globals.settings.Server = Server;
//$scope.save();
$location.url('/library');
$location.path('/library').replace();
$rootScope.showIndex = true;
}
};

View file

@ -1,8 +1,4 @@
/*@media only screen and (max-device-width: 680px) {*/
@media only screen and (max-width: 500px) {
}
@media only screen and (max-width: 600px) {
@media only screen and (max-width: 400px) {
.smcolumn {
width: 75%;
background: rgba(255, 255, 255, 0.8);
@ -50,7 +46,7 @@
}
ul.songlist .albumgrid {
padding: 0px 0px 22px 0px;
width: 150px;
width: 162px;
height: 160px;
}
ul.songlist .albumgrid .itemactions {
@ -70,7 +66,7 @@
margin-right: 5px;
}
ul.songlist .albumgrid .albuminfo {
width: 150px;
width: 142px;
}
ul.songlist .album a:hover {
background-position: center center;

View file

@ -238,8 +238,9 @@ span.apiversion
background: #fff;
}
.smcolumn .leftactions {
margin: 5px 5px 0 0;
float: right;
margin: 46px 2px 0 0;
position: fixed;
left: 264px;
}
.lgcolumn
{
@ -1080,14 +1081,14 @@ ul.songlist li:hover
.actions
{
height: 30px;
margin: 6px 5px 0 184px;
margin: 6px 5px 0 185px;
padding: 0 0 0 5px;
}
.subactions
{
height: 29px;
height: 30px;
/* width: 660px; */
margin: 5px 105px 0 0;
margin: 6px 125px 0 5px;
padding: 0 0 0 5px;
float: right;
}
@ -1097,7 +1098,7 @@ ul.songlist li:hover
top: 0px;
right: 65px;
height: 29px;
margin: 5px 0 0 0;
margin: 6px 0 0 0;
}
#search
{
@ -1243,7 +1244,7 @@ ul.songlist li:hover
#player
{
border-top: 1px solid #cbcbcb;
border-bottom: 1px solid #cbcbcb;
border-bottom: none;
margin: 4px 0 0 0;
/*height: 75px;*/
position: absolute;

View file

@ -30,7 +30,6 @@ angular.module('jamstash.subsonic.service', ['jamstash.settings', 'jamstash.util
var genres = [];
var podcasts = [];
var offset = 0;
var showIndex = false;
var showPlaylist = false;
var showPodcast = false;
@ -71,7 +70,7 @@ angular.module('jamstash.subsonic.service', ['jamstash.settings', 'jamstash.util
};
return {
showIndex: showIndex,
showIndex: $rootScope.showIndex,
showPlaylist: showPlaylist,
getSongTemplate: function (callback) {
var id = '16608';

View file

@ -24,17 +24,17 @@ angular.module('jamstash.subsonic.ctrl', ['jamstash.subsonic.service'])
];
$scope.SelectedAlbumSort = globals.settings.DefaultAlbumSort;
$scope.AlbumSort = globals.AlbumSorts;
$scope.showIndex = subsonic.showIndex;
$rootScope.showIndex = subsonic.showIndex;
$scope.$watch("showIndex", function (newValue, oldValue) {
if (newValue !== oldValue) {
subsonic.showIndex = $scope.showIndex;
subsonic.showIndex = $rootScope.showIndex;
}
});
$scope.toggleIndex = function () {
if ($scope.showIndex) {
$scope.showIndex = false;
if ($rootScope.showIndex) {
$rootScope.showIndex = false;
} else {
$scope.showIndex = true;
$rootScope.showIndex = true;
$scope.showPlaylist = false;
$scope.showPodcast = false;
}
@ -51,7 +51,7 @@ angular.module('jamstash.subsonic.ctrl', ['jamstash.subsonic.service'])
$scope.showPlaylist = false;
} else {
$scope.showPlaylist = true;
$scope.showIndex = false;
$rootScope.showIndex = false;
$scope.showPodcast = false;
}
$scope.saveDefaultSection('playlist');
@ -68,7 +68,7 @@ angular.module('jamstash.subsonic.ctrl', ['jamstash.subsonic.service'])
} else {
$scope.showPodcast = true;
$scope.showPlaylist = false;
$scope.showIndex = false;
$rootScope.showIndex = false;
}
$scope.saveDefaultSection('podcast');
};
@ -79,7 +79,7 @@ angular.module('jamstash.subsonic.ctrl', ['jamstash.subsonic.service'])
var section = utils.getValue('DefaultSection');
switch (section) {
case 'index':
$scope.showIndex = true;
$rootScope.showIndex = true;
break;
case 'playlist':
$scope.showPlaylist = true;