Skip to content

Commit

Permalink
Added client
Browse files Browse the repository at this point in the history
  • Loading branch information
Atle Haugan committed Mar 15, 2016
1 parent 6bb3063 commit 9e7fd2f
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 29 deletions.
5 changes: 4 additions & 1 deletion client.js → api.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ function getListEventsPath() {
fiveDaysAhead.setDate(fiveDaysAhead.getDate() + 5);
var path = '/adressa/search/?dateFrom=' + moment(today).format(dateFormat) +
'&dateTo=' + moment(fiveDaysAhead).format(dateFormat) + '&categories=8&page=1';
console.log(path);
return getRequestOptionsForPath(path);
}

app.get('/events', function (requestFromClient, responseToClient) {
app.use(express.static('client'));

app.get('/api/events', function (requestFromClient, responseToClient) {
requestFromClient = http.request(getListEventsPath(), function (responseFromEventServer) {
// Continuously update stream with data
var body = '';
Expand Down
28 changes: 0 additions & 28 deletions app.js

This file was deleted.

19 changes: 19 additions & 0 deletions client/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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;
});
});
13 changes: 13 additions & 0 deletions client/events.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"records":[
{"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"}]
}
28 changes: 28 additions & 0 deletions client/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Whatsup?</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="http://www.w3schools.com/appml/2.0.3/appml.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src="app.js"></script>
</head>
<body>
<div ng-app="myApp" ng-controller="myCtrl" class="container-fluid">
<div class="jumbotron">
<h1>Whatsup?</h1>
</div>
<div class="row" ng-repeat="e in serverEvents">
<div class="col-*-*">
<h3>{{e.name}}</h3>
<p>{{e.venue}}, {{e.startsAt | date:'EEEE, dd MMMM HH:mm'}}</p>
</div>
</div>
</div>
</body>
</html>

0 comments on commit 9e7fd2f

Please sign in to comment.