notifications fix
This commit is contained in:
parent
08f09f8067
commit
f8ef2ba227
7 changed files with 51 additions and 37 deletions
|
@ -1,6 +1,6 @@
|
||||||
angular.module('JamStash')
|
angular.module('JamStash')
|
||||||
.controller('AppCtrl', ['$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, utils, globals, model, notifications, player) {
|
function($scope, $rootScope, $document, $window, $location, $cookieStore, $http, utils, globals, model, notifications, player) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
$rootScope.settings = globals.settings;
|
$rootScope.settings = globals.settings;
|
||||||
|
@ -162,7 +162,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
$rootScope.showIndex = false;
|
||||||
$scope.dragStart = function (e, ui) {
|
$scope.dragStart = function (e, ui) {
|
||||||
ui.item.data('start', ui.item.index());
|
ui.item.data('start', ui.item.index());
|
||||||
};
|
};
|
||||||
|
@ -173,6 +173,10 @@
|
||||||
$rootScope.queue.splice(start, 1)[0]);
|
$rootScope.queue.splice(start, 1)[0]);
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
};
|
};
|
||||||
|
$(document).on( 'click', 'message', function() {
|
||||||
|
$(this).fadeOut(function () { $(this).remove(); });
|
||||||
|
return false;
|
||||||
|
})
|
||||||
$document.keydown(function (e) {
|
$document.keydown(function (e) {
|
||||||
$scope.scrollToIndex(e);
|
$scope.scrollToIndex(e);
|
||||||
});
|
});
|
||||||
|
@ -328,6 +332,14 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
$scope.ping = function () {
|
$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({
|
$.ajax({
|
||||||
url: globals.BaseURL() + '/ping.view?' + globals.BaseParams(),
|
url: globals.BaseURL() + '/ping.view?' + globals.BaseParams(),
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
@ -346,6 +358,7 @@
|
||||||
notifications.updateMessage('Unable to connect to Subsonic server');
|
notifications.updateMessage('Unable to connect to Subsonic server');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
$scope.queueRemoveSelected = function (data, event) {
|
$scope.queueRemoveSelected = function (data, event) {
|
||||||
angular.forEach($scope.selectedSongs, function (item, key) {
|
angular.forEach($scope.selectedSongs, function (item, key) {
|
||||||
|
|
|
@ -11,17 +11,12 @@ angular.module('jamstash.notifications', [])
|
||||||
var msgIndex = 1;
|
var msgIndex = 1;
|
||||||
this.updateMessage = function (msg, autohide) {
|
this.updateMessage = function (msg, autohide) {
|
||||||
if (msg !== '') {
|
if (msg !== '') {
|
||||||
$rootScope.Messages.push(msg);
|
var id = $rootScope.Messages.push(msg) - 1;
|
||||||
$('#messages').fadeIn();
|
$('#messages').fadeIn();
|
||||||
if (autohide) {
|
if (autohide) {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
$(el).fadeOut(function () { $(this).remove(); });
|
$('#msg_' + id).fadeOut(function () { $(this).remove(); });
|
||||||
}, globals.settings.Timeout);
|
}, globals.settings.Timeout);
|
||||||
} else {
|
|
||||||
$(el).click(function () {
|
|
||||||
$(el).fadeOut(function () { $(this).remove(); });
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -62,7 +62,17 @@
|
||||||
notifications.updateMessage('Settings Updated!', true);
|
notifications.updateMessage('Settings Updated!', true);
|
||||||
$scope.loadSettings();
|
$scope.loadSettings();
|
||||||
if (globals.settings.Server !== '' && globals.settings.Username !== '' && globals.settings.Password !== '') {
|
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) {
|
json.getChangeLog(function (data) {
|
||||||
|
@ -92,8 +102,8 @@
|
||||||
globals.settings.Username = Username;
|
globals.settings.Username = Username;
|
||||||
globals.settings.Password = Password;
|
globals.settings.Password = Password;
|
||||||
globals.settings.Server = Server;
|
globals.settings.Server = Server;
|
||||||
//$scope.save();
|
$location.path('/library').replace();
|
||||||
$location.url('/library');
|
$rootScope.showIndex = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
/*@media only screen and (max-device-width: 680px) {*/
|
@media only screen and (max-width: 400px) {
|
||||||
@media only screen and (max-width: 500px) {
|
|
||||||
|
|
||||||
}
|
|
||||||
@media only screen and (max-width: 600px) {
|
|
||||||
.smcolumn {
|
.smcolumn {
|
||||||
width: 75%;
|
width: 75%;
|
||||||
background: rgba(255, 255, 255, 0.8);
|
background: rgba(255, 255, 255, 0.8);
|
||||||
|
@ -50,7 +46,7 @@
|
||||||
}
|
}
|
||||||
ul.songlist .albumgrid {
|
ul.songlist .albumgrid {
|
||||||
padding: 0px 0px 22px 0px;
|
padding: 0px 0px 22px 0px;
|
||||||
width: 150px;
|
width: 162px;
|
||||||
height: 160px;
|
height: 160px;
|
||||||
}
|
}
|
||||||
ul.songlist .albumgrid .itemactions {
|
ul.songlist .albumgrid .itemactions {
|
||||||
|
@ -70,7 +66,7 @@
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
ul.songlist .albumgrid .albuminfo {
|
ul.songlist .albumgrid .albuminfo {
|
||||||
width: 150px;
|
width: 142px;
|
||||||
}
|
}
|
||||||
ul.songlist .album a:hover {
|
ul.songlist .album a:hover {
|
||||||
background-position: center center;
|
background-position: center center;
|
||||||
|
|
|
@ -238,8 +238,9 @@ span.apiversion
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
.smcolumn .leftactions {
|
.smcolumn .leftactions {
|
||||||
margin: 5px 5px 0 0;
|
margin: 46px 2px 0 0;
|
||||||
float: right;
|
position: fixed;
|
||||||
|
left: 264px;
|
||||||
}
|
}
|
||||||
.lgcolumn
|
.lgcolumn
|
||||||
{
|
{
|
||||||
|
@ -1080,14 +1081,14 @@ ul.songlist li:hover
|
||||||
.actions
|
.actions
|
||||||
{
|
{
|
||||||
height: 30px;
|
height: 30px;
|
||||||
margin: 6px 5px 0 184px;
|
margin: 6px 5px 0 185px;
|
||||||
padding: 0 0 0 5px;
|
padding: 0 0 0 5px;
|
||||||
}
|
}
|
||||||
.subactions
|
.subactions
|
||||||
{
|
{
|
||||||
height: 29px;
|
height: 30px;
|
||||||
/* width: 660px; */
|
/* width: 660px; */
|
||||||
margin: 5px 105px 0 0;
|
margin: 6px 125px 0 5px;
|
||||||
padding: 0 0 0 5px;
|
padding: 0 0 0 5px;
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
@ -1097,7 +1098,7 @@ ul.songlist li:hover
|
||||||
top: 0px;
|
top: 0px;
|
||||||
right: 65px;
|
right: 65px;
|
||||||
height: 29px;
|
height: 29px;
|
||||||
margin: 5px 0 0 0;
|
margin: 6px 0 0 0;
|
||||||
}
|
}
|
||||||
#search
|
#search
|
||||||
{
|
{
|
||||||
|
@ -1243,7 +1244,7 @@ ul.songlist li:hover
|
||||||
#player
|
#player
|
||||||
{
|
{
|
||||||
border-top: 1px solid #cbcbcb;
|
border-top: 1px solid #cbcbcb;
|
||||||
border-bottom: 1px solid #cbcbcb;
|
border-bottom: none;
|
||||||
margin: 4px 0 0 0;
|
margin: 4px 0 0 0;
|
||||||
/*height: 75px;*/
|
/*height: 75px;*/
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
@ -30,7 +30,6 @@ angular.module('jamstash.subsonic.service', ['jamstash.settings', 'jamstash.util
|
||||||
var genres = [];
|
var genres = [];
|
||||||
var podcasts = [];
|
var podcasts = [];
|
||||||
var offset = 0;
|
var offset = 0;
|
||||||
var showIndex = false;
|
|
||||||
var showPlaylist = false;
|
var showPlaylist = false;
|
||||||
var showPodcast = false;
|
var showPodcast = false;
|
||||||
|
|
||||||
|
@ -71,7 +70,7 @@ angular.module('jamstash.subsonic.service', ['jamstash.settings', 'jamstash.util
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
showIndex: showIndex,
|
showIndex: $rootScope.showIndex,
|
||||||
showPlaylist: showPlaylist,
|
showPlaylist: showPlaylist,
|
||||||
getSongTemplate: function (callback) {
|
getSongTemplate: function (callback) {
|
||||||
var id = '16608';
|
var id = '16608';
|
||||||
|
|
|
@ -24,17 +24,17 @@ angular.module('jamstash.subsonic.ctrl', ['jamstash.subsonic.service'])
|
||||||
];
|
];
|
||||||
$scope.SelectedAlbumSort = globals.settings.DefaultAlbumSort;
|
$scope.SelectedAlbumSort = globals.settings.DefaultAlbumSort;
|
||||||
$scope.AlbumSort = globals.AlbumSorts;
|
$scope.AlbumSort = globals.AlbumSorts;
|
||||||
$scope.showIndex = subsonic.showIndex;
|
$rootScope.showIndex = subsonic.showIndex;
|
||||||
$scope.$watch("showIndex", function (newValue, oldValue) {
|
$scope.$watch("showIndex", function (newValue, oldValue) {
|
||||||
if (newValue !== oldValue) {
|
if (newValue !== oldValue) {
|
||||||
subsonic.showIndex = $scope.showIndex;
|
subsonic.showIndex = $rootScope.showIndex;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$scope.toggleIndex = function () {
|
$scope.toggleIndex = function () {
|
||||||
if ($scope.showIndex) {
|
if ($rootScope.showIndex) {
|
||||||
$scope.showIndex = false;
|
$rootScope.showIndex = false;
|
||||||
} else {
|
} else {
|
||||||
$scope.showIndex = true;
|
$rootScope.showIndex = true;
|
||||||
$scope.showPlaylist = false;
|
$scope.showPlaylist = false;
|
||||||
$scope.showPodcast = false;
|
$scope.showPodcast = false;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ angular.module('jamstash.subsonic.ctrl', ['jamstash.subsonic.service'])
|
||||||
$scope.showPlaylist = false;
|
$scope.showPlaylist = false;
|
||||||
} else {
|
} else {
|
||||||
$scope.showPlaylist = true;
|
$scope.showPlaylist = true;
|
||||||
$scope.showIndex = false;
|
$rootScope.showIndex = false;
|
||||||
$scope.showPodcast = false;
|
$scope.showPodcast = false;
|
||||||
}
|
}
|
||||||
$scope.saveDefaultSection('playlist');
|
$scope.saveDefaultSection('playlist');
|
||||||
|
@ -68,7 +68,7 @@ angular.module('jamstash.subsonic.ctrl', ['jamstash.subsonic.service'])
|
||||||
} else {
|
} else {
|
||||||
$scope.showPodcast = true;
|
$scope.showPodcast = true;
|
||||||
$scope.showPlaylist = false;
|
$scope.showPlaylist = false;
|
||||||
$scope.showIndex = false;
|
$rootScope.showIndex = false;
|
||||||
}
|
}
|
||||||
$scope.saveDefaultSection('podcast');
|
$scope.saveDefaultSection('podcast');
|
||||||
};
|
};
|
||||||
|
@ -79,7 +79,7 @@ angular.module('jamstash.subsonic.ctrl', ['jamstash.subsonic.service'])
|
||||||
var section = utils.getValue('DefaultSection');
|
var section = utils.getValue('DefaultSection');
|
||||||
switch (section) {
|
switch (section) {
|
||||||
case 'index':
|
case 'index':
|
||||||
$scope.showIndex = true;
|
$rootScope.showIndex = true;
|
||||||
break;
|
break;
|
||||||
case 'playlist':
|
case 'playlist':
|
||||||
$scope.showPlaylist = true;
|
$scope.showPlaylist = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue