commit
ce1b557517
12 changed files with 107 additions and 23 deletions
1
angular_app/README.txt
Normal file
1
angular_app/README.txt
Normal file
|
@ -0,0 +1 @@
|
|||
This directory contains the AngularJS app that will be executed by the browser.
|
11
angular_app/event-detail.html
Normal file
11
angular_app/event-detail.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<h1><span class="label label-primary">{{event.title}}</span></h1>
|
||||
|
||||
<p>Date: {{event['begin-datetime']}}</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<div class="col-md-10">
|
||||
|
||||
Search: <input ng-model="query2">
|
||||
Search: <input ng-model="query">
|
||||
Sort by:
|
||||
<select ng-model="orderProp">
|
||||
<option value="title">Alphabetical</option>
|
||||
|
@ -10,11 +10,14 @@
|
|||
</select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
|
||||
<ul class="events">
|
||||
<li ng-repeat="event in events | filter:query2 | orderBy:orderProp">
|
||||
<span>{{event.title}}</span>
|
||||
<li ng-repeat="event in events | filter:query | orderBy:orderProp">
|
||||
<span><a href="/#/events/{{event.id}}">{{event.title}}</a></span>
|
||||
<p>{{event['begin-datetime']}}</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -10,12 +10,32 @@
|
|||
<script src="/js/controllers.js"></script>
|
||||
<title>Event Man(ager)</title>
|
||||
<link href="/static/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="/static/css/bootstrap-theme.min.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="main-header">
|
||||
<input type="button" id="events-button" class="btn btn-link" value="Events" />
|
||||
<input type="button" id="persons-button" class="btn btn-link" value="Persons" />
|
||||
</div>
|
||||
|
||||
<div ng-view></div>
|
||||
|
||||
<div class="main-footer">
|
||||
</div>
|
||||
<script src="/static/js/jquery-2.1.3.min.js"></script>
|
||||
<script src="/static/js/bootstrap.min.js"></script>
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#events-button').on('click', function() {
|
||||
window.location = '/#/events';
|
||||
});
|
||||
$('#persons-button').on('click', function() {
|
||||
window.location = '/#/persons';
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
8
angular_app/js/app.js
vendored
8
angular_app/js/app.js
vendored
|
@ -10,17 +10,17 @@ eventManApp.config(['$routeProvider',
|
|||
templateUrl: 'persons-list.html',
|
||||
controller: 'PersonsListCtrl'
|
||||
}).
|
||||
when('/persons/:personId', {
|
||||
when('/persons/:personID', {
|
||||
templateUrl: 'person-detail.html',
|
||||
controller: 'PersonDetailCtrl'
|
||||
controller: 'PersonDetailsCtrl'
|
||||
}).
|
||||
when('/events', {
|
||||
templateUrl: 'events-list.html',
|
||||
controller: 'EventsListCtrl'
|
||||
}).
|
||||
when('/events/:eventId', {
|
||||
when('/events/:eventID', {
|
||||
templateUrl: 'event-detail.html',
|
||||
controller: 'EventDetailCtrl'
|
||||
controller: 'EventDetailsCtrl'
|
||||
}).
|
||||
otherwise({
|
||||
redirectTo: '/events'
|
||||
|
|
19
angular_app/js/controllers.js
vendored
19
angular_app/js/controllers.js
vendored
|
@ -14,6 +14,16 @@ eventManControllers.controller('EventsListCtrl', ['$scope', '$http',
|
|||
);
|
||||
|
||||
|
||||
eventManControllers.controller('EventDetailsCtrl', ['$scope', '$http', '$routeParams',
|
||||
function ($scope, $http, $routeParams) {
|
||||
$http.get("/events/" + $routeParams.eventID).success(function(data) {
|
||||
|
||||
$scope.event = data.event;
|
||||
});
|
||||
}]
|
||||
);
|
||||
|
||||
|
||||
eventManControllers.controller('PersonsListCtrl', ['$scope', '$http',
|
||||
function ($scope, $http) {
|
||||
$http.get('/persons').success(function(data) {
|
||||
|
@ -23,3 +33,12 @@ eventManControllers.controller('PersonsListCtrl', ['$scope', '$http',
|
|||
}]
|
||||
);
|
||||
|
||||
|
||||
eventManControllers.controller('PersonDetailsCtrl', ['$scope', '$http', '$routeParams',
|
||||
function ($scope, $http, $routeParams) {
|
||||
$http.get("/persons/" + $routeParams.personID).success(function(data) {
|
||||
$scope.person = data.person;
|
||||
});
|
||||
}]
|
||||
);
|
||||
|
||||
|
|
11
angular_app/person-detail.html
Normal file
11
angular_app/person-detail.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<h1><span class="label label-primary">{{person.name}} {{person.surname}}</span></h1>
|
||||
|
||||
<p>Email: {{person.email}}</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<div class="col-md-10">
|
||||
|
||||
Search: <input ng-model="query">
|
||||
Sort by:
|
||||
|
@ -10,12 +10,15 @@
|
|||
</select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
|
||||
<ul class="persons">
|
||||
<li ng-repeat="person in persons | filter:query | orderBy:orderProp">
|
||||
<span>{{person.name}}</span> <span>{{person.surname}}</span>
|
||||
<p>{{person.snippet}}</p>
|
||||
<a href="/#/persons/{{person.id}}"><span>{{person.name}}</span> <span>{{person.surname}}</span></a>
|
||||
<p>{{person.email}}</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
|
6
backend.py
Normal file
6
backend.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
"""Event Man(ager) backend
|
||||
|
||||
Classes and functions used to manage events and attendants.
|
||||
"""
|
||||
|
||||
|
1
data/README.txt
Normal file
1
data/README.txt
Normal file
|
@ -0,0 +1 @@
|
|||
Directory used by the backend to store its data. Must be writeable by the server.
|
|
@ -11,7 +11,7 @@ import tornado.ioloop
|
|||
import tornado.options
|
||||
from tornado.options import define, options
|
||||
import tornado.web
|
||||
from tornado import gen, escape
|
||||
from tornado import gen
|
||||
|
||||
class RootHandler(tornado.web.RequestHandler):
|
||||
angular_app_path = os.path.join(os.path.dirname(__file__), "angular_app")
|
||||
|
@ -20,26 +20,27 @@ class RootHandler(tornado.web.RequestHandler):
|
|||
with open(self.angular_app_path + "/index.html", 'r') as fd:
|
||||
self.write(fd.read())
|
||||
|
||||
MOCKUP_PERSONS = [
|
||||
{'name': 'Silvia', 'surname': 'Castellari',
|
||||
MOCKUP_PERSONS = {
|
||||
1: {'name': 'Silvia', 'surname': 'Castellari',
|
||||
'email': 'hackinbo.it@gmail.com',
|
||||
'id': 1},
|
||||
{'name': 'Daniele', 'surname': 'Castellari',
|
||||
2: {'name': 'Daniele', 'surname': 'Castellari',
|
||||
'email': 'hackinbo.it@gmail.com',
|
||||
'id': 2},
|
||||
{'name': 'Mario', 'surname': 'Anglani',
|
||||
3: {'name': 'Mario', 'surname': 'Anglani',
|
||||
'email': 'hackinbo.it@gmail.com',
|
||||
'id': 3}]
|
||||
'id': 3}
|
||||
}
|
||||
|
||||
import datetime
|
||||
MOCKUP_EVENTS = [
|
||||
{'title': 'HackInBo 2015', 'begin-datetime': datetime.datetime(2015, 5, 23, 9, 0),
|
||||
MOCKUP_EVENTS = {
|
||||
1: {'title': 'HackInBo 2015', 'begin-datetime': datetime.datetime(2015, 5, 23, 9, 0),
|
||||
'end-datetime': datetime.datetime(2015, 5, 24, 17, 0),
|
||||
'location': 'Bologna', 'id': 1},
|
||||
{'title': 'La fiera del carciofo', 'begin-datetime': datetime.datetime(2015, 6, 23, 9, 0),
|
||||
2: {'title': 'La fiera del carciofo', 'begin-datetime': datetime.datetime(2015, 6, 23, 9, 0),
|
||||
'end-datetime': datetime.datetime(2015, 6, 24, 17, 0),
|
||||
'location': 'Gatteo a mare', 'id': 2},
|
||||
]
|
||||
}
|
||||
|
||||
import json
|
||||
|
||||
|
@ -55,13 +56,19 @@ json._default_encoder = ImprovedEncoder()
|
|||
class PersonsHandler(tornado.web.RequestHandler):
|
||||
@gen.coroutine
|
||||
def get(self, id_=None):
|
||||
self.write({'persons': MOCKUP_PERSONS})
|
||||
if id_ is not None:
|
||||
self.write({'person': MOCKUP_PERSONS[int(id_)]})
|
||||
return
|
||||
self.write({'persons': MOCKUP_PERSONS.values()})
|
||||
|
||||
|
||||
class EventsHandler(tornado.web.RequestHandler):
|
||||
@gen.coroutine
|
||||
def get(self, id_=None):
|
||||
self.write({'events': MOCKUP_EVENTS})
|
||||
if id_ is not None:
|
||||
self.write({'event': MOCKUP_EVENTS[int(id_)]})
|
||||
return
|
||||
self.write({'events': MOCKUP_EVENTS.values()})
|
||||
|
||||
|
||||
|
||||
|
|
2
static/README.txt
Normal file
2
static/README.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
This directory is served under the /static/ path, and should
|
||||
be used to store images, css and libraries.
|
Loading…
Reference in a new issue