From f39202da15756b3bfe87692b66e007627329ce24 Mon Sep 17 00:00:00 2001 From: Matthijs Kok Date: Tue, 19 Sep 2017 17:16:10 +0200 Subject: [PATCH] Load Sponsors from API. CSS is WIP --- src/lancie-sponsors/lancie-sponsors.html | 51 +++++++++++++++++++----- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/src/lancie-sponsors/lancie-sponsors.html b/src/lancie-sponsors/lancie-sponsors.html index 3f35cc2a..498f2324 100644 --- a/src/lancie-sponsors/lancie-sponsors.html +++ b/src/lancie-sponsors/lancie-sponsors.html @@ -41,26 +41,34 @@ /*End Safari hack*/ + +

Presented by

- - +

Premium sponsors

- - - +
+

Sponsors

- - - - +
@@ -72,6 +80,31 @@

Sponsors

Polymer({ is: 'lancie-sponsors', + properties: { + sponsors: Array, + presenters: Array, + premiums: Array, + normals: Array + }, + + attached: function () { + this.$.ajaxSponsor.generateRequest(); + }, + + onResponse: function (e, request) { + if (request.succeeded) { + this.sponsors = request.response.object; + this.presenters = this.sponsors.filter(function(sponsor) { + return sponsor.type === "PRESENTER"; + }); + this.premiums = this.sponsors.filter(function(sponsor) { + return sponsor.type === "PREMIUM"; + }); + this.normals = this.sponsors.filter(function(sponsor) { + return sponsor.type === "NORMAL"; + }); + } + } }); })();