From 48d492a8d89f80b2e1e394019527495eb3619cae Mon Sep 17 00:00:00 2001 From: Peter Grassberger Date: Sun, 9 Aug 2015 19:31:51 +0200 Subject: jingles: list some cuts diff --git a/www/index.html b/www/index.html index 344c48e..2d4b2c8 100644 --- a/www/index.html +++ b/www/index.html @@ -149,15 +149,13 @@
-
-

-
-
- +
+

+
- + @@ -173,13 +171,13 @@
-

-
-
Cart #Cut # Titel Länge importiert
+
+

+
- + diff --git a/www/js/jingles.js b/www/js/jingles.js index 5037382..9284fd6 100644 --- a/www/js/jingles.js +++ b/www/js/jingles.js @@ -22,10 +22,10 @@ var jingles_group_list = []; var jingles_group_carts = {}; -function jingles_newCartEntry(cart) { +function jingles_newCartEntry(cut) { - return $('').append($('').append($('
Cart #Cut # Titel Länge importiert
').text(cart.number)) - .append($('').text(cart.title)) + return $('
').text(cut.name)) + .append($('').text(cut.title)) .append($(''))//.text(msToTimeString(cart.length))) .append($(''))//.text(cart.imported)) .append($(''))//.text(cart.playcnt)) @@ -35,9 +35,19 @@ function jingles_newCartEntry(cart) { } function jingles_updateCartListing() { - $('#jingle-carts-left tbody').find('tr').remove(); - $.each(jingles_group_carts, function(cart) { - $('#jingle-carts-left > tbody:last').append(jingles_newCartEntry(cart)); + $('#jingles-jingAllgem table tbody').find('tr').remove(); + $('#jingles-jingAnlass table tbody').find('tr').remove(); + $.each(jingles_group_carts, function(key, cart) { + console.log(cart); + if (cart.group.name === 'jingAllgem') { + $.each(cart.cutList, function(key, cut) { + $('#jingles-jingAllgem table > tbody:last').append(jingles_newCartEntry(cut)); + }); + } else if (cart.group.name === 'jingAnlass') { + $.each(cart.cutList, function(key, cut) { + $('#jingles-jingAnlass table > tbody:last').append(jingles_newCartEntry(cut)); + }); + } }); } @@ -45,20 +55,32 @@ function jingles_updateGroupCartList(data, status, req) { var cartlist = $(data).find("cartList"); var carts = cartlist.children(); carts.each(function() { - var cut = $(this).find("cutList").get(0); var number = $(this).find('number').text(); var cart = { title: $(this).find('title').text(), + group: { + name: $(this).find('groupName').text(), + }, + cutList: [], //length: Number($(cut).find('length').text()), //imported: new Date($(cut).find('originDatetime').text()), //playcnt: $(cut).find('playCounter').text(), //lastplayed: new Date($(cut).find('lastPlayDatetime').text()), }; + var cutList = $(this).find("cutList"); + cutList.each(function() { + cart.cutList.push({ + name: $(this).find('cutName').text(), + title: $(this).find('description').text(), + }); + }); + //cart.imported = isNaN(cart.imported) ? '-' : cart.imported; //cart.lastplayed = isNaN(cart.lastplayed) ? '-' : cart.lastplayed; jingles_group_carts[number] = cart; } ); + console.log(jingles_group_carts); jingles_updateCartListing(); } @@ -71,7 +93,7 @@ function jingles_show() { })[0]; if(jingAllgem) { - $('#jingle-title-left').text(jingAllgem.title); + $('#jingles-jingAllgem h2').text(jingAllgem.title); jingles_group_carts = {}; data = { COMMAND: 7, LOGIN_NAME: auth_username, PASSWORD: auth_token, CART_NUMBER: jingAllgem.group.lowcart, INCLUDE_CUTS: 1 }; @@ -79,7 +101,7 @@ function jingles_show() { } if(jingAnlass) { - $('#jingle-title-right').text(jingAnlass.title); + $('#jingles-jingAnlass h2').text(jingAnlass.title); jingles_group_carts = {}; data = { COMMAND: 7, LOGIN_NAME: auth_username, PASSWORD: auth_token, CART_NUMBER: jingAnlass.group.lowcart, INCLUDE_CUTS: 1 }; -- cgit v0.10.2