Merge pull request #195 from jcass77/fix/191_delete_stream_popup

fix:Replace JavaScript prompt with jQuery equivalent.
This commit is contained in:
John Cass 2016-05-07 16:43:14 +02:00
commit 240bac8b43
5 changed files with 46 additions and 15 deletions

View File

@ -129,6 +129,8 @@ v2.3.0 (UNRELEASED)
- Added 'Folder' FontAwesome icon on the Browse pane for browsing the filesystem. - Added 'Folder' FontAwesome icon on the Browse pane for browsing the filesystem.
- New icons for 'PLAY' and 'PLAY_ALL' actions. In general, icons with an empty background will perform an action only - New icons for 'PLAY' and 'PLAY_ALL' actions. In general, icons with an empty background will perform an action only
on the selected track, while icons with a filled background will apply the action to all tracks in the list. on the selected track, while icons with a filled background will apply the action to all tracks in the list.
- Standardize popup dialog layout convention: Sentence fragments have no punctuation, buttons that confirm a
destructive action go on the left.
**Fixes** **Fixes**
@ -141,6 +143,8 @@ v2.3.0 (UNRELEASED)
instead of waiting for the 'Search!' button to be clicked. instead of waiting for the 'Search!' button to be clicked.
- Fixed an issue where the last track in an album was not grouped properly with the rest of the results, and would have - Fixed an issue where the last track in an album was not grouped properly with the rest of the results, and would have
a small divider rendered above it. (Fixes: `#196 <https://github.com/pimusicbox/mopidy-musicbox-webclient/issues/196>`_). a small divider rendered above it. (Fixes: `#196 <https://github.com/pimusicbox/mopidy-musicbox-webclient/issues/196>`_).
- Replaced JavaScript confirmation prompt on 'Streams' pane with jQuery equivalent.
(Fixes: `#191 <https://github.com/pimusicbox/mopidy-musicbox-webclient/issues/191>`_).
v2.2.0 (2016-03-01) v2.2.0 (2016-03-01)
------------------- -------------------

View File

@ -436,6 +436,7 @@
.popupDialog { .popupDialog {
padding: 10px; padding: 10px;
text-align: center;
} }
/*dont hide clear buttons in text input */ /*dont hide clear buttons in text input */

View File

@ -171,16 +171,16 @@
<div data-role="popup" data-theme="b" id="popupSave" class="popupDialog"> <div data-role="popup" data-theme="b" id="popupSave" class="popupDialog">
<form> <form>
<p>Save current queue to a playlist. <p>Save Current Queue to a Playlist
<input id="saveinput" placeholder="Playlist name" class="span2" data-clear-btn="true" <input id="saveinput" placeholder="Playlist name" class="span2" data-clear-btn="true"
onkeypress="return controls.savePressed(event.keyCode);" type="text"/> onkeypress="return controls.savePressed(event.keyCode);" type="text"/>
<div data-role="controlgroup" data-type="horizontal" align="center"> <div data-role="controlgroup" data-type="horizontal" align="center">
<button class="btn" type="button" onclick="return controls.saveQueue();">
Ok
</button>
<button class="btn" type="button" onclick="return $('#popupSave').popup('close');"> <button class="btn" type="button" onclick="return $('#popupSave').popup('close');">
Cancel Cancel
</button> </button>
<button class="btn" type="button" onclick="return controls.saveQueue();">
Save
</button>
</div> </div>
</form> </form>
</div> </div>
@ -188,10 +188,10 @@
<div data-role="popup" data-theme="b" id="popupOverwrite" class="popupDialog"> <div data-role="popup" data-theme="b" id="popupOverwrite" class="popupDialog">
<form> <form>
<p>Overwrite existing playlist with same name? <p>A playlist with the same name already exists. Overwrite?
<div data-role="controlgroup" data-type="horizontal" align="center"> <div data-role="controlgroup" data-type="horizontal" align="center">
<button class="btn" type="button" id="overwriteConfirmBtn"> <button class="btn" type="button" id="overwriteConfirmBtn">
Ok Overwrite
</button> </button>
<button class="btn" type="button" onclick="$('#popupOverwrite').popup('close'); return $('#popupSave').popup('open');"> <button class="btn" type="button" onclick="$('#popupOverwrite').popup('close'); return $('#popupSave').popup('open');">
Cancel Cancel
@ -200,6 +200,20 @@
</form> </form>
</div><!--/overwrite existing playlist--> </div><!--/overwrite existing playlist-->
<div data-role="popup" data-theme="b" id="popupConfirmDelete" class="popupDialog">
<form>
<p>Are you sure you want to remove <span class="popupStreamName"></span>?
<div data-role="controlgroup" data-type="horizontal" align="center">
<button class="btn" type="button" onclick="return controls.deleteFavourite();">
Remove
</button>
<button class="btn" type="button" onclick="$('#popupConfirmDelete').popup('close');">
Cancel
</button>
</div>
</form>
</div><!--/confirm delete stream-->
<div data-role="header" data-tap-toggle="false" id="header" data-position="fixed" class="header-breakpoint headerbtn"> <div data-role="header" data-tap-toggle="false" id="header" data-position="fixed" class="header-breakpoint headerbtn">
<a id="headermenubtn" href="#panel"><i class="fa fa-align-justify"></i></a> <a id="headermenubtn" href="#panel"><i class="fa fa-align-justify"></i></a>
<h1 id="contentHeadline">Musicbox</h1> <h1 id="contentHeadline">Musicbox</h1>

View File

@ -547,16 +547,26 @@
}) })
}, },
deleteFavourite: function (index) { showDeleteStreamPopup: function (index) {
controls.getFavourites().then(function (favourites) { controls.getFavourites().then(function (favourites) {
if (favourites && favourites.tracks && index < favourites.tracks.length) { if (favourites && favourites.tracks && index < favourites.tracks.length) {
var name = favourites.tracks[index].name var name = favourites.tracks[index].name
if (confirm("Are you sure you want to remove '" + name + "'?")) { $('.popupStreamName').html(favourites.tracks[index].name)
favourites.tracks.splice(index, 1) $('#popupConfirmDelete').data('index', index)
mopidy.playlists.save({'playlist': favourites}).then(function (s) { $('#popupConfirmDelete').popup('open')
controls.showFavourites() }
}) })
} },
deleteFavourite: function (index) {
index = index || $('#popupConfirmDelete').data('index')
controls.getFavourites().then(function (favourites) {
if (favourites && favourites.tracks && index < favourites.tracks.length) {
favourites.tracks.splice(index, 1)
mopidy.playlists.save({'playlist': favourites}).then(function (s) {
controls.showFavourites()
})
$('#popupConfirmDelete').popup('close')
} }
}) })
}, },
@ -576,7 +586,9 @@
if (favourites.tracks) { if (favourites.tracks) {
var child = '' var child = ''
for (var i = 0; i < favourites.tracks.length; i++) { for (var i = 0; i < favourites.tracks.length; i++) {
child = '<li><span class="ui-icon ui-icon-delete ui-icon-shadow" style="float:right; margin: .5em; margin-top: .8em;"><a href="#" onclick="return controls.deleteFavourite(\'' + i + '\');">&nbsp;</a></span>' + child =
'<li><span class="ui-icon ui-icon-delete ui-icon-shadow" style="float:right; margin: .5em; margin-top: .8em;">' +
'<a href="#" onclick="return controls.showDeleteStreamPopup(' + i + ');">&nbsp;</a></span>' +
'<i class="fa fa-rss" style="float: left; padding: .5em; padding-top: 1em;"></i>' + '<i class="fa fa-rss" style="float: left; padding: .5em; padding-top: 1em;"></i>' +
' <a style="margin-left: 20px" href="#" onclick="return controls.playStreamUri(\'' + favourites.tracks[i].uri + '\');">' ' <a style="margin-left: 20px" href="#" onclick="return controls.playStreamUri(\'' + favourites.tracks[i].uri + '\');">'
child += '<h1>' + favourites.tracks[i].name + '</h1></a></li>' child += '<h1>' + favourites.tracks[i].name + '</h1></a></li>'

View File

@ -1,6 +1,6 @@
CACHE MANIFEST CACHE MANIFEST
# 2016-05-05:v1 # 2016-05-07:v1
NETWORK: NETWORK:
* *