From 22da76e9323cd68967fc77c2d46e881ae73ec8c1 Mon Sep 17 00:00:00 2001 From: Davide Alberani Date: Sun, 15 Mar 2015 20:39:55 +0100 Subject: [PATCH 1/5] navigation buttons --- angular_app/index.html | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/angular_app/index.html b/angular_app/index.html index 6c4cff1..ae18a18 100644 --- a/angular_app/index.html +++ b/angular_app/index.html @@ -10,12 +10,32 @@ Event Man(ager) + +
+ + +
+
+ + From 6a50a4d96552241cab6f9641641c0b26ab088fee Mon Sep 17 00:00:00 2001 From: Davide Alberani Date: Sun, 15 Mar 2015 22:13:06 +0100 Subject: [PATCH 2/5] improve view of filters --- angular_app/events-list.html | 9 ++++++--- angular_app/persons-list.html | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/angular_app/events-list.html b/angular_app/events-list.html index 8ef63e4..bf6eb95 100644 --- a/angular_app/events-list.html +++ b/angular_app/events-list.html @@ -1,8 +1,8 @@
-
+
- Search: + Search: Sort by:
+
+ +
    -
  • +
  • {{event.title}}

    {{event['begin-datetime']}}

  • diff --git a/angular_app/persons-list.html b/angular_app/persons-list.html index 725a180..11b4924 100644 --- a/angular_app/persons-list.html +++ b/angular_app/persons-list.html @@ -1,6 +1,6 @@
    -
    +
    Search: Sort by: @@ -10,6 +10,9 @@
    +
    + +
      From efe4e27a783c1a1f22e8bc94ba8ea93f49d41317 Mon Sep 17 00:00:00 2001 From: Davide Alberani Date: Sun, 15 Mar 2015 23:05:59 +0100 Subject: [PATCH 3/5] detail pages --- angular_app/event-detail.html | 11 +++++++++++ angular_app/events-list.html | 2 +- angular_app/js/app.js | 8 ++++---- angular_app/js/controllers.js | 19 +++++++++++++++++++ angular_app/person-detail.html | 11 +++++++++++ angular_app/persons-list.html | 4 ++-- eventman_server.py | 31 +++++++++++++++++++------------ 7 files changed, 67 insertions(+), 19 deletions(-) create mode 100644 angular_app/event-detail.html create mode 100644 angular_app/person-detail.html diff --git a/angular_app/event-detail.html b/angular_app/event-detail.html new file mode 100644 index 0000000..cf4a676 --- /dev/null +++ b/angular_app/event-detail.html @@ -0,0 +1,11 @@ +
      +
      +
      +

      {{event.title}}

      + +

      Date: {{event['begin-datetime']}}

      + +
      +
      +
      + diff --git a/angular_app/events-list.html b/angular_app/events-list.html index bf6eb95..0d56f10 100644 --- a/angular_app/events-list.html +++ b/angular_app/events-list.html @@ -17,7 +17,7 @@ diff --git a/angular_app/js/app.js b/angular_app/js/app.js index 4fba70e..bff8b7b 100644 --- a/angular_app/js/app.js +++ b/angular_app/js/app.js @@ -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' diff --git a/angular_app/js/controllers.js b/angular_app/js/controllers.js index c619677..3698188 100644 --- a/angular_app/js/controllers.js +++ b/angular_app/js/controllers.js @@ -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; + }); + }] +); + diff --git a/angular_app/person-detail.html b/angular_app/person-detail.html new file mode 100644 index 0000000..18703df --- /dev/null +++ b/angular_app/person-detail.html @@ -0,0 +1,11 @@ +
      +
      +
      +

      {{person.name}} {{person.surname}}

      + +

      Email: {{person.email}}

      + +
      +
      +
      + diff --git a/angular_app/persons-list.html b/angular_app/persons-list.html index 11b4924..c4f4e85 100644 --- a/angular_app/persons-list.html +++ b/angular_app/persons-list.html @@ -17,8 +17,8 @@ diff --git a/eventman_server.py b/eventman_server.py index f920adb..0775cfc 100755 --- a/eventman_server.py +++ b/eventman_server.py @@ -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()}) From 08978dcec0a188747df3b2e2fcb2625f84374ebb Mon Sep 17 00:00:00 2001 From: Davide Alberani Date: Sun, 15 Mar 2015 23:08:22 +0100 Subject: [PATCH 4/5] README.txt files --- angular_app/README.txt | 1 + static/README.txt | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 angular_app/README.txt create mode 100644 static/README.txt diff --git a/angular_app/README.txt b/angular_app/README.txt new file mode 100644 index 0000000..f2185a6 --- /dev/null +++ b/angular_app/README.txt @@ -0,0 +1 @@ +This directory contains the AngularJS app that will be executed by the browser. diff --git a/static/README.txt b/static/README.txt new file mode 100644 index 0000000..5070bc2 --- /dev/null +++ b/static/README.txt @@ -0,0 +1,2 @@ +This directory is served under the /static/ path, and should +be used to store images, css and libraries. From 5b664a2f2e384798bd37cc045444086782c3a67d Mon Sep 17 00:00:00 2001 From: Davide Alberani Date: Sun, 15 Mar 2015 23:08:50 +0100 Subject: [PATCH 5/5] stub of backend --- backend.py | 6 ++++++ data/README.txt | 1 + 2 files changed, 7 insertions(+) create mode 100644 backend.py create mode 100644 data/README.txt diff --git a/backend.py b/backend.py new file mode 100644 index 0000000..a59610f --- /dev/null +++ b/backend.py @@ -0,0 +1,6 @@ +"""Event Man(ager) backend + +Classes and functions used to manage events and attendants. +""" + + diff --git a/data/README.txt b/data/README.txt new file mode 100644 index 0000000..82c0a60 --- /dev/null +++ b/data/README.txt @@ -0,0 +1 @@ +Directory used by the backend to store its data. Must be writeable by the server.