From c02db67aac8d89cba149e6f6806d9215e59f832d Mon Sep 17 00:00:00 2001 From: Atle Haugan Date: Wed, 16 Mar 2016 07:11:15 +0100 Subject: [PATCH] Cleanup --- api.js | 10 +--------- client/app.js | 15 ++------------- client/index.html | 4 ++-- 3 files changed, 5 insertions(+), 24 deletions(-) diff --git a/api.js b/api.js index 1a551e6..3d3b104 100644 --- a/api.js +++ b/api.js @@ -40,15 +40,7 @@ app.get('/api/events', function (requestFromClient, responseToClient) { }); responseFromEventServer.on('end', function () { - var eventListing = JSON.parse(body); - var events = eventListing.events.map(function(event){ - return { - name: event.name, - startsAt: event.occurrence.dateFrom, - venue: event.venue.name - }; - }); - responseToClient.send(events); + responseToClient.send(JSON.parse(body)); }); }); requestFromClient.end(); diff --git a/client/app.js b/client/app.js index 49b687b..a194f71 100644 --- a/client/app.js +++ b/client/app.js @@ -1,19 +1,8 @@ var app = angular.module('myApp', []); + app.controller('myCtrl', function($scope, $http) { - $scope.event ='test2'; - $scope.events = [ - {"name": "Trønderkaillan", "startsAt": "2016-03-17T14:00+01:00", "venue": "Levanger bibliotek"}, - {"name": "TSO: Missa Solemnis", "startsAt": "2016-03-17T19:30+01:00", "venue": "Olavshallen"}, - {"name": "Zap Mama", "startsAt": "2016-03-17T20:00+01:00", "venue": "Dokkhuset"}, - {"name": "Vinterfestspill i Bergstaden", "startsAt": "2016-03-17T20:30+01:00", "venue": "Storstuggu"}, - {"name": "Anne Lene Hagglund m band", "startsAt": "2016-03-17T21:00+01:00", "venue": "Moskus"}, - {"name": "Luftforsvarets musikkorps: Påskerebus", "startsAt": "2016-03-18T12:00+01:00", "venue": "Byscenen"}, - {"name": "Stabat Mater av G. Pergolesi", "startsAt": "2016-03-18T18:00+01:00", "venue": "Birgittaklosteret i Trondheim"}, - {"name": "Drivhuset minifestival", "startsAt": "2016-03-18T18:00+01:00", "venue": "BrukBar/Blæst"}, - {"name": "William Hut", "startsAt": "2016-03-18T20:00+01:00", "venue": "Antikvariatet"}, - {"name": "Young Fogertys", "startsAt": "2016-03-18T20:00+01:00", "venue": "Mellomveien Bar"}]; $http.get("/api/events") .then(function(response) { - $scope.serverEvents = response.data; + $scope.events = response.data.events; }); }); diff --git a/client/index.html b/client/index.html index 53636eb..b0202b8 100644 --- a/client/index.html +++ b/client/index.html @@ -17,10 +17,10 @@

Whatsup?

-
+

{{e.name}}

-

{{e.venue}}, {{e.startsAt | date:'EEEE, dd MMMM HH:mm'}}

+

{{e.venue.name}}, {{e.occurrence.dateFrom | date:'EEEE, dd MMMM HH:mm'}}