summaryrefslogtreecommitdiff
path: root/www/js/jingles.js
diff options
context:
space:
mode:
authorPeter Grassberger <petertheone@gmail.com>2015-09-23 14:38:34 (GMT)
committerPeter Grassberger <petertheone@gmail.com>2015-09-23 14:38:34 (GMT)
commit69636e8eed5da4393d6c4445835bd811faa246aa (patch)
treec235427355b3ec296775cf60de8349076fca62c2 /www/js/jingles.js
parentd1b79c223f072a3d620b66fe76fa28f8f05b805d (diff)
rivendell.js functions: add remove copy move cut, copy audio
jingle toggleActive and add .aac to acceptedFiles.
Diffstat (limited to 'www/js/jingles.js')
-rw-r--r--www/js/jingles.js44
1 files changed, 17 insertions, 27 deletions
diff --git a/www/js/jingles.js b/www/js/jingles.js
index 599870d..b95eeb1 100644
--- a/www/js/jingles.js
+++ b/www/js/jingles.js
@@ -22,10 +22,12 @@
"use strict";
+var rivendell = null;
var jinglesGroupList = null;
var importer = null;
function jingles_init() {
+ rivendell = new Rivendell.Rivendell(auth_username, auth_token);
importer = new Importer();
jinglesGroupList = new JingleGroupList();
jinglesGroupList.fetch();
@@ -191,27 +193,6 @@ JingleGroup.prototype.render = function() {
importer.showUploadModal(self.mainCart);
});
- // todo: fix
- /*var cuts = [];
- if (this.mainCart && this.deactivateCart) {
- cuts = $.merge(this.mainCart.cuts, this.deactivateCart.cuts);
- } else if (this.mainCart) {
- cuts = this.mainCart.cuts;
- } else if (this.deactivateCart) {
- cuts = this.deactivateCart.cuts;
- }
- console.log(cuts);
- cuts = cuts.sort(function(a, b) {
- if (a.title && b.title) {
- return a.title.toLowerCase() < b.title.toLowerCase();
- }
- return a.title < b.title;
- });
-
- var self = this;
- $.each(cuts, function(index, cut) {
- $('table > tbody', self.$el).append(cut.render());
- });*/
if (this.mainCart) {
$.each(this.mainCart.cuts, function(index, cut) {
$('table > tbody', self.$el).append(cut.render());
@@ -248,7 +229,7 @@ var JingleCut = function(cart, cartNumber, name, description, active) {
JingleCut.prototype.move = function() {
console.log('JingleCut.prototype.move');
- // move to other group, if active stay in mainCart, if deactivated stay in deactiveCart
+ // move to other group, if active stay in mainCart, if deactivated stay in deactivateCart
// todo: remove hardcoded cartNumbers
var destinationCart = ((parseInt(this.cartNumber) - 2000 + 2) % 4) + 2000;
@@ -290,11 +271,20 @@ JingleCut.prototype.move = function() {
};
-JingleCut.prototype.toggleActivate = function() {
- console.log('JingleCut.prototype.toggleActivate');
+JingleCut.prototype.toggleActive = function() {
+ console.log('JingleCut.prototype.toggleActive');
// move to other cart, from mainCart to deactiveCart or the other way around
-
+ var destinationCart = this.cartNumber;
+ if (this.active) {
+ destinationCart++;
+ } else {
+ destinationCart--;
+ }
+ var self = this;
+ rivendell.moveCut(this.cartNumber, this.number, destinationCart, function() {
+ $(self).trigger('add');
+ });
};
JingleCut.prototype.delete = function() {
@@ -325,7 +315,7 @@ JingleCut.prototype.render = function() {
self.move();
});
activateButton.on('click', function() {
- self.toggleActivate();
+ self.toggleActive();
});
deleteButton.on('click', function() {
self.delete();
@@ -491,7 +481,7 @@ Importer.prototype.showUploadModal = function(cart) {
uploadMultiple: false, // todo: maybe enable this?
clickable: true,
createImageThumbnails: false,
- acceptedFiles: '.flac,.wav,.ogg,.mp3,.m4a',
+ acceptedFiles: '.flac,.wav,.ogg,.mp3,.m4a,.aac',
autoProcessQueue: false,
init: function() {
this.on("addedfile", function(file) {