Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Queue Entire Lists #208

Open
wants to merge 1 commit into
base: patches
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions public/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -1124,10 +1124,27 @@ $(window).load(function() {

return false;
}, 200, true);

var queueList = function(e) {
e.preventDefault();
var $self = $(this);
var target = $self.data('target');

$( target + ' tr').each(function(el) {
var id = $(this).data('track-id');
$.post('/playlist', {
source: 'soundtrack',
id: id
}, function(response) {
if (soundtrack.debug) console.log(response);
});
});
};

$(document).on('click', '*[data-action=queue-track]', selectTrack);

$(document).on('click', '*[data-action=queue-set]', selectSet );
$(document).on('click', '*[data-action=queue-list]', queueList );

$(document).on('click', '*[data-action=launch-playlist-editor]', function(e) {
e.preventDefault();
Expand Down
5 changes: 3 additions & 2 deletions soundtrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -823,11 +823,12 @@ app.post('/playlist', requireLogin , function(req, res) {
if (!app.rooms[ req.room ]) return res.send({ status: 'error', message: 'No room to queue to.' });

soundtrack.trackFromSource( req.param('source') , req.param('id') , req.body, function(err, track) {
console.log('trackFromSource() callback executing...', err || track._id );
if (err || !track) {
console.log(err);
console.error(err);
return res.send({ status: 'error', message: 'Could not add that track.' });
}

console.log('trackFromSource() callback executing...', err || track._id );

var queueWasEmpty = false;
if (!app.rooms[ req.room ].playlist.length) {
Expand Down
2 changes: 1 addition & 1 deletion views/partials/play-row.jade
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if (typeof(play._track._artist) != 'undefined' && play._track._artist)
tr
tr(data-track-id="#{play._track._id}")
td
if (play._curator)
a(href="#{play._curator.slug}") #{play._curator.username}
Expand Down
5 changes: 4 additions & 1 deletion views/person-plays.jade
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
extends layout

block content
.btn-group.pull-right
a.btn.btn-mini(href="#", data-action="queue-list", data-target="#play-list") ♫ queue »

h1 #{count} Plays By <a href="/#{person.slug}">#{person.username}</a>
if (room)
| in <a href="#{room.index}">#{room.name}</a>
Expand All @@ -9,7 +12,7 @@ block content
h2 Showing #{ plays.length } most recent
p add <code>?limit=n</code> parameter to list more.

table.table.tablesorter
table.table.tablesorter#play-list
thead
tr
th Who
Expand Down