From ff872383e09d74ee5dca0bd85d8ecf285a9342e3 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 2 Oct 2014 17:02:22 +0000 Subject: added status info tag for file uploads diff --git a/index.html b/index.html index ab68027..fb9fa02 100644 --- a/index.html +++ b/index.html @@ -21,6 +21,10 @@ .btn i[class*='icon-'] { vertical-align: middle; } + + .progress { + margin-bottom: 0; + } @@ -89,7 +93,7 @@
diff --git a/js/shows.js b/js/shows.js index 5f8eecc..38cf60d 100644 --- a/js/shows.js +++ b/js/shows.js @@ -10,9 +10,33 @@ function shows_deleteCart(cart) { $.post("/rd-bin/rdxport.cgi", data, null, "xml").done(shows_showSelected); } +function shows_importCartCancel(cart) { + var cart_row = $('#show-cart-' + cart) + cart_row.next().remove(); + cart_row.find('.btn').removeAttr('disabled'); + cart_row.after(shows_getDzStat(true)); + + // TODO: cancel upload +} + +function shows_importCartConfirm(cart) { + $('#shows-upload').modal('hide'); + var cart_row = $('#show-cart-' + cart) + cart_row.next().remove(); + cart_row.find('.btn').attr('disabled','disabled'); + var dz_stat = shows_getDzStat(false); + dz_stat.find('button').unbind('click').click(function() { shows_importCartCancel(cart); }); + cart_row.after(dz_stat); + + // TODO: call dropzone.processQueue() +} + function shows_importCart(cart) { $('#shows-upload div.modal-body').text("Cart: " + cart); + $('#shows-upload-confirm').unbind('click').click(function() { shows_importCartConfirm(cart); }); $('#shows-upload').modal({ keyboard: true }); + + // TODO: add dropzone to 'div.modal-body' } // @@ -26,6 +50,25 @@ function shows_importCart(cart) { // // +function shows_getDzStat(empty) +{ + if(empty) { + return $('').append($('').css("border", 0) + .css("height", 0) + .css("margin", 0) + .css("padding", 0)); + } else { + var progress_bar = '
'; + var cancel_button = ''; + + return $('').append($('').text('filename.flac')) + .append($('').text('xx of XX Bytes')) + .append($('').append(progress_bar)) + .append($('').append(cancel_button)); + } +} + function shows_udpateCartListing() { $('#show-carts tbody').find('tr').remove(); shows_log_carts.forEach(function(elem) { @@ -44,14 +87,14 @@ function shows_udpateCartListing() { ' Importieren'; $('#show-carts > tbody:last').append( - $('').append($('').text(elem)) - .append($('').text(cart.title)) - .append($('').text(cart.length)) - .append($('').text(cart.imported)) - .append($('').text(cart.playcnt)) - .append($('').text(cart.lastplayed)) - .append($('').append(buttons)) - ); + $('').append($('').text(elem)) + .append($('').text(cart.title)) + .append($('').text(cart.length)) + .append($('').text(cart.imported)) + .append($('').text(cart.playcnt)) + .append($('').text(cart.lastplayed)) + .append($('').append(buttons)).attr("id", "show-cart-" + elem) + ).append(shows_getDzStat(true)); }); } @@ -155,7 +198,7 @@ function shows_updateList(data, status, req) { shows_showSelected(); } -function draw_current_week() +function shows_drawCurrentWeek() { var weekspan = $('#current-week').removeClass().addClass('label'); switch(get_rd_week()) { @@ -181,7 +224,7 @@ function shows_init() { shows_list = []; data = { LOGIN_NAME: auth_username, PASSWORD: auth_token }; $.post("/rh-bin/listdropboxes.cgi", data, shows_updateList, "xml") - draw_current_week(); + shows_drawCurrentWeek(); } function shows_cleanup() { -- cgit v0.10.2