4
0
mirror of https://github.com/AzuraCast/AzuraCast.git synced 2024-06-14 21:26:37 +00:00

Media files toolbar updates.

- Vuetify the media files toolbar actions and checkboxes
 - Confirm deletion actions with a modal dialog
 - Add "clear playlists" button back
 - Show visual confirmation of actions
This commit is contained in:
Buster Neece 2019-07-23 14:45:23 -05:00
parent 5a9ec823e4
commit a2ed816d60
No known key found for this signature in database
GPG Key ID: 6D9E12FF03411F4E
3 changed files with 151 additions and 90 deletions

View File

@ -7,8 +7,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2019-07-17T21:29:45+00:00\n"
"PO-Revision-Date: 2019-07-17T21:29:45+00:00\n"
"POT-Creation-Date: 2019-07-23T19:44:58+00:00\n"
"PO-Revision-Date: 2019-07-23T19:44:58+00:00\n"
"Language: \n"
#: /var/azuracast/www/src/Acl.php:183
@ -527,7 +527,7 @@ msgid "This station is out of available storage space."
msgstr ""
#: /var/azuracast/www/src/Controller/Stations/Files/ListController.php:123
#: /var/azuracast/www/templates/stations/files/index.phtml:168
#: /var/azuracast/www/templates/stations/files/index.phtml:179
msgid "Directory"
msgstr ""
@ -557,8 +557,8 @@ msgstr ""
#: /var/azuracast/www/templates/frontend/public/index.phtml:37
#: /var/azuracast/www/templates/stations/playlists/index.phtml:42
#: /var/azuracast/www/templates/stations/playlists/index.phtml:55
#: /var/azuracast/www/templates/stations/profile/panel_nowplaying.phtml:46
#: /var/azuracast/www/templates/stations/profile/panel_nowplaying.phtml:73
#: /var/azuracast/www/templates/stations/profile/panel_nowplaying.phtml:47
#: /var/azuracast/www/templates/stations/profile/panel_nowplaying.phtml:77
msgid "Playlist"
msgstr ""
@ -579,7 +579,7 @@ msgid "Playlist disabled."
msgstr ""
#: /var/azuracast/www/src/Controller/Stations/ProfileController.php:95
#: /var/azuracast/www/src/Controller/Stations/ProfileController.php:113
#: /var/azuracast/www/src/Controller/Stations/ProfileController.php:114
#: /var/azuracast/www/config/forms/media.php:22
#: /var/azuracast/www/config/forms/song.php:37
#: /var/azuracast/www/templates/frontend/public/index.js.phtml:9
@ -590,7 +590,7 @@ msgid "Song Title"
msgstr ""
#: /var/azuracast/www/src/Controller/Stations/ProfileController.php:96
#: /var/azuracast/www/src/Controller/Stations/ProfileController.php:114
#: /var/azuracast/www/src/Controller/Stations/ProfileController.php:115
#: /var/azuracast/www/config/forms/media.php:30
#: /var/azuracast/www/templates/frontend/public/index.js.phtml:10
msgid "Song Artist"
@ -1717,7 +1717,7 @@ msgstr ""
#: /var/azuracast/www/config/forms/station.php:37
#: /var/azuracast/www/config/forms/user.php:10
#: /var/azuracast/www/templates/admin/custom_fields/index.phtml:22
#: /var/azuracast/www/templates/stations/files/index.phtml:102
#: /var/azuracast/www/templates/stations/files/index.phtml:113
#: /var/azuracast/www/templates/stations/webhooks/index.phtml:25
msgid "Name"
msgstr ""
@ -2509,7 +2509,7 @@ msgstr ""
#: /var/azuracast/www/templates/frontend/public/dj.js.phtml:27
#: /var/azuracast/www/templates/frontend/public/embedrequests.phtml:20
#: /var/azuracast/www/templates/frontend/public/index.phtml:75
#: /var/azuracast/www/templates/stations/files/index.phtml:103
#: /var/azuracast/www/templates/stations/files/index.phtml:114
#: /var/azuracast/www/templates/stations/playlists/reorder.phtml:26
#: /var/azuracast/www/templates/stations/reports/performance.phtml:30
msgid "Title"
@ -2732,7 +2732,7 @@ msgid "Music Files"
msgstr ""
#: /var/azuracast/www/config/menus/station.php:53
#: /var/azuracast/www/templates/stations/files/index.phtml:112
#: /var/azuracast/www/templates/stations/files/index.phtml:123
#: /var/azuracast/www/templates/stations/playlists/index.phtml:4
#: /var/azuracast/www/templates/stations/playlists/index.phtml:17
#: /var/azuracast/www/templates/stations/profile/panel_backend.phtml:32
@ -2883,7 +2883,7 @@ msgstr ""
#: /var/azuracast/www/templates/admin/stations/index.phtml:30
#: /var/azuracast/www/templates/admin/users/index.phtml:35
#: /var/azuracast/www/templates/frontend/api_keys/index.phtml:42
#: /var/azuracast/www/templates/stations/files/index.js.phtml:92
#: /var/azuracast/www/templates/stations/files/index.js.phtml:156
#: /var/azuracast/www/templates/stations/mounts/index.phtml:35
#: /var/azuracast/www/templates/stations/playlists/index.phtml:65
#: /var/azuracast/www/templates/stations/remotes/index.phtml:36
@ -2940,8 +2940,8 @@ msgstr ""
#: /var/azuracast/www/templates/admin/users/index.phtml:21
#: /var/azuracast/www/templates/frontend/public/embedrequests.phtml:23
#: /var/azuracast/www/templates/frontend/public/index.phtml:78
#: /var/azuracast/www/templates/stations/files/index.phtml:113
#: /var/azuracast/www/templates/stations/files/index.phtml:169
#: /var/azuracast/www/templates/stations/files/index.phtml:124
#: /var/azuracast/www/templates/stations/files/index.phtml:180
#: /var/azuracast/www/templates/stations/mounts/index.phtml:24
#: /var/azuracast/www/templates/stations/playlists/index.phtml:54
#: /var/azuracast/www/templates/stations/playlists/reorder.phtml:29
@ -2959,7 +2959,7 @@ msgid "Last Modified"
msgstr ""
#: /var/azuracast/www/templates/admin/backups/index.phtml:102
#: /var/azuracast/www/templates/stations/files/index.phtml:110
#: /var/azuracast/www/templates/stations/files/index.phtml:121
msgid "Size"
msgstr ""
@ -2978,7 +2978,8 @@ msgstr ""
#: /var/azuracast/www/templates/admin/stations/index.phtml:32
#: /var/azuracast/www/templates/admin/users/index.phtml:37
#: /var/azuracast/www/templates/admin/users/index.phtml:39
#: /var/azuracast/www/templates/stations/files/index.phtml:91
#: /var/azuracast/www/templates/stations/files/index.js.phtml:27
#: /var/azuracast/www/templates/stations/files/index.phtml:101
#: /var/azuracast/www/templates/stations/mounts/index.phtml:36
#: /var/azuracast/www/templates/stations/playlists/index.phtml:66
#: /var/azuracast/www/templates/stations/queue/index.js.phtml:36
@ -3213,7 +3214,7 @@ msgid "Station Name"
msgstr ""
#: /var/azuracast/www/templates/frontend/index/index.phtml:121
#: /var/azuracast/www/templates/stations/profile/panel_nowplaying.phtml:33
#: /var/azuracast/www/templates/stations/profile/panel_nowplaying.phtml:30
msgid "Now Playing"
msgstr ""
@ -3322,7 +3323,7 @@ msgstr ""
#: /var/azuracast/www/templates/frontend/public/dj.js.phtml:28
#: /var/azuracast/www/templates/frontend/public/embedrequests.phtml:21
#: /var/azuracast/www/templates/frontend/public/index.phtml:76
#: /var/azuracast/www/templates/stations/files/index.phtml:104
#: /var/azuracast/www/templates/stations/files/index.phtml:115
#: /var/azuracast/www/templates/stations/playlists/reorder.phtml:27
#: /var/azuracast/www/templates/stations/reports/performance.phtml:31
msgid "Artist"
@ -3375,7 +3376,7 @@ msgstr ""
#: /var/azuracast/www/templates/frontend/public/embedrequests.phtml:22
#: /var/azuracast/www/templates/frontend/public/index.phtml:77
#: /var/azuracast/www/templates/stations/files/index.phtml:105
#: /var/azuracast/www/templates/stations/files/index.phtml:116
#: /var/azuracast/www/templates/stations/playlists/reorder.phtml:28
msgid "Album"
msgstr ""
@ -3418,6 +3419,8 @@ msgid "Full Volume"
msgstr ""
#: /var/azuracast/www/templates/frontend/public/player_component.js.phtml:14
#: /var/azuracast/www/templates/stations/profile/panel_nowplaying.phtml:34
#: /var/azuracast/www/templates/stations/profile/panel_nowplaying.phtml:63
msgid "Album Art"
msgstr ""
@ -3547,19 +3550,35 @@ msgstr ""
msgid "Configure Automated Assignment"
msgstr ""
#: /var/azuracast/www/templates/stations/files/index.js.phtml:83
#: /var/azuracast/www/templates/stations/files/index.js.phtml:28
msgid "Delete {NUM} media file(s)?"
msgstr ""
#: /var/azuracast/www/templates/stations/files/index.js.phtml:37
msgid "Files removed:"
msgstr ""
#: /var/azuracast/www/templates/stations/files/index.js.phtml:76
msgid "Playlists updated for selected files:"
msgstr ""
#: /var/azuracast/www/templates/stations/files/index.js.phtml:78
msgid "Playlists cleared for selected files:"
msgstr ""
#: /var/azuracast/www/templates/stations/files/index.js.phtml:147
msgid "Album Artwork"
msgstr ""
#: /var/azuracast/www/templates/stations/files/index.js.phtml:95
#: /var/azuracast/www/templates/stations/files/index.js.phtml:159
msgid "Rename"
msgstr ""
#: /var/azuracast/www/templates/stations/files/index.js.phtml:182
#: /var/azuracast/www/templates/stations/files/index.js.phtml:246
msgid "Select"
msgstr ""
#: /var/azuracast/www/templates/stations/files/index.js.phtml:403
#: /var/azuracast/www/templates/stations/files/index.js.phtml:430
msgid "Home"
msgstr ""
@ -3575,53 +3594,57 @@ msgstr ""
msgid "Drag files here to upload to this folder or "
msgstr ""
#: /var/azuracast/www/templates/stations/files/index.phtml:64
#: /var/azuracast/www/templates/stations/files/index.phtml:65
msgid "Set Playlists"
msgstr ""
#: /var/azuracast/www/templates/stations/files/index.phtml:81
#: /var/azuracast/www/templates/stations/files/index.phtml:82
msgid "New Playlist"
msgstr ""
#: /var/azuracast/www/templates/stations/files/index.phtml:86
#: /var/azuracast/www/templates/stations/files/index.phtml:87
msgid "Save"
msgstr ""
#: /var/azuracast/www/templates/stations/files/index.phtml:90
#: /var/azuracast/www/templates/stations/files/index.phtml:93
msgid "Clear Playlists"
msgstr ""
#: /var/azuracast/www/templates/stations/files/index.phtml:97
msgid "Move"
msgstr ""
#: /var/azuracast/www/templates/stations/files/index.phtml:94
#: /var/azuracast/www/templates/stations/files/index.phtml:105
msgid "New Folder"
msgstr ""
#: /var/azuracast/www/templates/stations/files/index.phtml:106
#: /var/azuracast/www/templates/stations/files/index.phtml:117
#: /var/azuracast/www/templates/stations/reports/duplicates.phtml:26
#: /var/azuracast/www/templates/stations/reports/performance.phtml:33
msgid "Length"
msgstr ""
#: /var/azuracast/www/templates/stations/files/index.phtml:111
#: /var/azuracast/www/templates/stations/files/index.phtml:122
msgid "Modified"
msgstr ""
#: /var/azuracast/www/templates/stations/files/index.phtml:128
#: /var/azuracast/www/templates/stations/files/index.phtml:139
msgid "New Directory"
msgstr ""
#: /var/azuracast/www/templates/stations/files/index.phtml:133
#: /var/azuracast/www/templates/stations/files/index.phtml:144
msgid "Directory Name"
msgstr ""
#: /var/azuracast/www/templates/stations/files/index.phtml:139
#: /var/azuracast/www/templates/stations/files/index.phtml:150
msgid "Create Directory"
msgstr ""
#: /var/azuracast/www/templates/stations/files/index.phtml:151
#: /var/azuracast/www/templates/stations/files/index.phtml:162
msgid "Move {{ selected_files }} File(s) to"
msgstr ""
#: /var/azuracast/www/templates/stations/files/index.phtml:157
#: /var/azuracast/www/templates/stations/files/index.phtml:168
msgid "Back"
msgstr ""
@ -3817,19 +3840,19 @@ msgstr ""
msgid "Unique"
msgstr ""
#: /var/azuracast/www/templates/stations/profile/panel_nowplaying.phtml:60
#: /var/azuracast/www/templates/stations/profile/panel_nowplaying.phtml:58
msgid "Playing Next"
msgstr ""
#: /var/azuracast/www/templates/stations/profile/panel_nowplaying.phtml:83
#: /var/azuracast/www/templates/stations/profile/panel_nowplaying.phtml:85
msgid "Now Streaming"
msgstr ""
#: /var/azuracast/www/templates/stations/profile/panel_nowplaying.phtml:97
#: /var/azuracast/www/templates/stations/profile/panel_nowplaying.phtml:99
msgid "Skip Song"
msgstr ""
#: /var/azuracast/www/templates/stations/profile/panel_nowplaying.phtml:101
#: /var/azuracast/www/templates/stations/profile/panel_nowplaying.phtml:103
msgid "Disconnect Streamer"
msgstr ""

View File

@ -4,24 +4,88 @@ $(function() {
var appToolbar = new Vue({
el: '#app-toolbar',
data: {
playlists: <?=json_encode($playlists) ?>
playlists: <?=json_encode($playlists) ?>,
checkedPlaylists: [],
newPlaylist: ''
},
watch: {
newPlaylist: function (text) {
if (text !== '') {
if (!this.checkedPlaylists.includes('new')) {
this.checkedPlaylists.push('new');
}
}
}
},
computed: {
newPlaylistIsChecked: function() {
return this.newPlaylist !== '';
}
},
methods: {
doBatch: function (e) {
e.preventDefault();
doDelete: function (e) {
var buttonText = <?=$this->escapeJs(__('Delete')) ?>;
var buttonConfirm = <?=$this->escapeJs(__('Delete {NUM} media file(s)?')) ?>;
var $files = getSelectedFiles();
swal({
title: buttonConfirm.replace('{NUM}', $files.length),
buttons: [true, buttonText],
dangerMode: true
}).then(function(value) {
if (value) {
var notifyMessage = <?=$this->escapeJs(__('Files removed:')) ?>;
appToolbar.doBatch('delete', notifyMessage);
}
});
},
doBatch: function (action, notifyMessage) {
var $files = getSelectedFiles();
$files.length && $.post('<?=$router->fromHere('stations:files:batch') ?>',{
'do': $(e.target).data('action'),
'do': action,
'files': $files.join('|'),
'csrf': CSRF,
'file': getUrlHash()
},function(data){
}, function() {
notify('<b>'+notifyMessage+'</b><br>'+$files.join('<br>'), 'success', false);
list();
},'json');
},
clearPlaylists: function(e) {
this.checkedPlaylists = [];
this.newPlaylist = '';
$(this).closest('.btn-group').removeClass('open');
return false;
this.setPlaylists(e);
},
setPlaylists: function(e) {
var $files = getSelectedFiles();
$files.length && $.post('<?=$router->fromHere('stations:files:batch') ?>',{
'do': 'playlist',
'playlists': this.checkedPlaylists,
'new_playlist_name': this.newPlaylist,
'files': $files.join('|'),
'csrf': CSRF,
'file': getUrlHash()
}, function(data) {
if (data.success && data.record) {
appToolbar.playlists.push(data.record);
}
if (appToolbar.checkedPlaylists.length > 0) {
var notifyMessage = <?=$this->escapeJs(__('Playlists updated for selected files:')) ?>;
} else {
var notifyMessage = <?=$this->escapeJs(__('Playlists cleared for selected files:')) ?>;
}
notify('<b>'+notifyMessage+'</b><br>'+$files.join('<br>'), 'success', false);
appToolbar.checkedPlaylists = [];
appToolbar.newPlaylist = '';
$(e.target).closest('.dropdown').find('[data-toggle=dropdown]').dropdown('toggle');
list();
},'json');
}
}
});
@ -243,43 +307,6 @@ $(function() {
});
// Allow playlist dropdown to stay open.
$(document).on('click', '.allow-focus .dropdown-menu', function (e) {
e.stopPropagation();
});
$('input#new_playlist_name').on('change', function(e) {
$(this).closest('div').find('input[type=checkbox]').attr('checked', $(this).val() != '');
});
$('form#frm_set_playlists').on('submit', function(e) {
e.preventDefault();
var new_playlist_field = $(this).find('input#new_playlist_name');
var playlist_checkboxes = $(this).find("input[name='playlists[]']");
var playlists = playlist_checkboxes.filter(':checked').map(function(){return $(this).val();}).get();
var files = getSelectedFiles();
files.length && $.post('<?=$router->fromHere('stations:files:batch') ?>',{
'do': 'playlist',
'playlists': playlists,
'new_playlist_name': new_playlist_field.val(),
'files': files.join('|'),
'csrf': CSRF,
'file': getUrlHash()
},function(data){
if (data.success && data.record) {
appToolbar.playlists.push(data.record);
}
list();
},'json');
playlist_checkboxes.prop('checked', false);
new_playlist_field.val('');
$(this).closest('.dropdown').find('[data-toggle=dropdown]').dropdown('toggle');
});
$('#frm-create-directory').submit(function(e) {
e.preventDefault();

View File

@ -61,14 +61,15 @@ $assets
<div class="col-md-8">
<div class="btn-group dropdown allow-focus">
<button type="button" class="btn btn-sm btn-primary dropdown-toggle mb-1" data-toggle="dropdown" aria-expanded="false">
<i class="material-icons" aria-hidden="true">clear_all</i> <?=__('Set Playlists') ?>
<i class="material-icons" aria-hidden="true">clear_all</i>
<?=__('Set Playlists') ?>
<span class="caret"></span>
</button>
<div class="dropdown-menu" role="menu" style="line-height: inherit">
<form id="frm_set_playlists" class="px-3 py-3">
<div class="dropdown-menu" role="menu" v-on:click.stop="" style="line-height: inherit">
<form id="frm_set_playlists" v-on:submit.stop.prevent="setPlaylists" class="px-3 py-3">
<div v-for="playlist in playlists" class="form-group">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" v-bind:id="'chk_playlist_' + playlist.id" name="playlists[]" v-bind:value="playlist.id">
<input type="checkbox" class="custom-control-input" v-bind:id="'chk_playlist_' + playlist.id" name="playlists[]" v-model="checkedPlaylists" v-bind:value="playlist.id">
<label class="custom-control-label" v-bind:for="'chk_playlist_'+playlist.id">
{{ playlist.name }}
</label>
@ -76,9 +77,9 @@ $assets
</div>
<div class="form-group">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="chk_playlist_new" name="playlists[]" value="new">
<input type="checkbox" class="custom-control-input" id="chk_playlist_new" v-model="checkedPlaylists" value="new">
<label class="custom-control-label" for="chk_playlist_new">
<input type="text" class="form-control" id="new_playlist_name" name="new_playlist_name" placeholder="<?=__('New Playlist') ?>">
<input type="text" class="form-control p-2" id="new_playlist_name" name="new_playlist_name" v-model="newPlaylist" placeholder="<?=__('New Playlist') ?>">
</label>
</div>
</div>
@ -87,8 +88,18 @@ $assets
</form>
</div>
</div>
<a href="#" class="btn btn-sm btn-primary mb-1" data-toggle="modal" data-target="#mdl-move-file"><i class="material-icons" aria-hidden="true">open_with</i> <?=__('Move') ?></a>
<button type="button" class="btn btn-sm btn-danger mb-1" v-on:click="doBatch" data-action="delete"><i class="material-icons" aria-hidden="true">delete</i> <?=__('Delete') ?></button>
<button type="button" class="btn btn-sm btn-warning mb-1" v-on:click.stop.prevent="clearPlaylists">
<i class="material-icons" aria-hidden="true">clear_all</i>
<?=__('Clear Playlists') ?>
</button>
<a href="#" class="btn btn-sm btn-primary mb-1" data-toggle="modal" data-target="#mdl-move-file">
<i class="material-icons" aria-hidden="true">open_with</i>
<?=__('Move') ?>
</a>
<button type="button" class="btn btn-sm btn-danger mb-1" v-on:click.stop.prevent="doDelete">
<i class="material-icons" aria-hidden="true">delete</i>
<?=__('Delete') ?>
</button>
</div>
<div class="col-md-4 text-right">
<a class="btn btn-sm btn-primary" href="#" data-toggle="modal" data-target="#mdl-create-directory"><i class="material-icons" aria-hidden="true">folder</i> <?=__('New Folder') ?></a>