From 484a543b4cf5eb18ce4dd32866415f4ee3af940d Mon Sep 17 00:00:00 2001 From: Davide Alberani Date: Tue, 7 Apr 2015 22:43:54 +0200 Subject: [PATCH 1/4] fast add of a person in the event info page --- angular_app/event-info.html | 134 +++++++++++++++++++++++++--------- angular_app/js/controllers.js | 22 +++++- 2 files changed, 118 insertions(+), 38 deletions(-) diff --git a/angular_app/event-info.html b/angular_app/event-info.html index 9f3e661..6536566 100644 --- a/angular_app/event-info.html +++ b/angular_app/event-info.html @@ -6,44 +6,106 @@ {{'Edit' | translate}} -
-
{{'Persons' | translate}}
-
-
-
- - + +
+
+
+
+
{{'Persons' | translate}}
+
+ +
+ + +
+
+ + +
+ + + + + + + + + + + + + + + + + + +
{{'Person' | translate}}{{'Email' | translate}}{{'Attended' | translate}}{{'Actions' | translate}}
{{person.name}} {{person.surname}}{{person.email}} + + + +
+
-
- - +
+ +
+ +
+
{{'Fast add' | translate}}
+
+
+
+ {{'Name' | translate}} + +
+
+ {{'Surname' | translate}} + +
+
+ {{'Email' | translate}} + +
+ +
+
- - - - - - - - - - - - - - - - -
{{'Person' | translate}}{{'Attended' | translate}}{{'Actions' | translate}}
{{person.name}} {{person.surname}} - - - -
+ +
+
{{'Unregistered persons' | translate}}
+
+ + + + + + + + + + + + + +
{{'Person' | translate}}{{'Add' | translate}}
+ {{person.name}} {{person.surname}} +
+ {{person.email}} +
+ +
+
+
+
diff --git a/angular_app/js/controllers.js b/angular_app/js/controllers.js index 7250a88..6593b2a 100644 --- a/angular_app/js/controllers.js +++ b/angular_app/js/controllers.js @@ -53,12 +53,13 @@ eventManControllers.controller('EventsListCtrl', ['$scope', 'Event', ); -eventManControllers.controller('EventDetailsCtrl', ['$scope', 'Event', '$stateParams', '$log', - function ($scope, Event, $stateParams, $log) { +eventManControllers.controller('EventDetailsCtrl', ['$scope', 'Event', 'Person', '$stateParams', '$log', + function ($scope, Event, Person, $stateParams, $log) { $scope.personsOrderProp = 'name'; $scope.eventsOrderProp = '-begin-date'; if ($stateParams.id) { $scope.event = Event.get($stateParams); + $scope.allPersons = Person.all(); } // store a new Event or update an existing one $scope.save = function() { @@ -75,6 +76,23 @@ eventManControllers.controller('EventDetailsCtrl', ['$scope', 'Event', '$statePa $scope.eventForm.$dirty = false; }; + $scope.fastAddPerson = function(newPerson) { + $log.debug('EventDetailsCtrl.fastAddPerson.newPerson:'); + $log.debug(newPerson); + var person = new Person(newPerson); + person.$save(function(p) { + var data = angular.copy(p); + data.person_id = data._id; + data._id = $stateParams.id; + data.attended = true; + Event.addAttendee(data, function() { + $scope.event = Event.get($stateParams); + $scope.allPersons = Person.all(); + $scope.newPerson = {}; + }); + }); + }; + $scope.updateAttendee = function(person, attended) { $log.debug('EventDetailsCtrl.event_id: ' + $stateParams.id); $log.debug('EventDetailsCtrl.person_id: ' + person.person_id); From ce1f4b6103c90ef5fbc01188f63e947dff743bd9 Mon Sep 17 00:00:00 2001 From: Davide Alberani Date: Tue, 7 Apr 2015 23:20:42 +0200 Subject: [PATCH 2/4] add registered person from event details --- angular_app/event-info.html | 6 +++--- angular_app/js/controllers.js | 36 +++++++++++++++++++++-------------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/angular_app/event-info.html b/angular_app/event-info.html index 6536566..76b165f 100644 --- a/angular_app/event-info.html +++ b/angular_app/event-info.html @@ -72,7 +72,7 @@ {{'Email' | translate}}
- @@ -91,14 +91,14 @@ - + {{person.name}} {{person.surname}}
{{person.email}} - + diff --git a/angular_app/js/controllers.js b/angular_app/js/controllers.js index 6593b2a..ede4b99 100644 --- a/angular_app/js/controllers.js +++ b/angular_app/js/controllers.js @@ -76,23 +76,30 @@ eventManControllers.controller('EventDetailsCtrl', ['$scope', 'Event', 'Person', $scope.eventForm.$dirty = false; }; - $scope.fastAddPerson = function(newPerson) { - $log.debug('EventDetailsCtrl.fastAddPerson.newPerson:'); - $log.debug(newPerson); - var person = new Person(newPerson); - person.$save(function(p) { - var data = angular.copy(p); - data.person_id = data._id; - data._id = $stateParams.id; - data.attended = true; - Event.addAttendee(data, function() { - $scope.event = Event.get($stateParams); - $scope.allPersons = Person.all(); - $scope.newPerson = {}; - }); + $scope._addAttendee = function(person_data) { + person_data.person_id = person_data._id; + person_data._id = $stateParams.id; + person_data.attended = true; + Event.addAttendee(person_data, function() { + $scope.event = Event.get($stateParams); + $scope.allPersons = Person.all(); + $scope.newPerson = {}; }); }; + $scope.fastAddPerson = function(person, isNew) { + $log.debug('EventDetailsCtrl.fastAddPerson.person:'); + $log.debug(person); + if (isNew) { + var personObj = new Person(person); + personObj.$save(function(p) { + $scope._addAttendee(angular.copy(p)); + }); + } else { + $scope._addAttendee(person); + } + }; + $scope.updateAttendee = function(person, attended) { $log.debug('EventDetailsCtrl.event_id: ' + $stateParams.id); $log.debug('EventDetailsCtrl.person_id: ' + person.person_id); @@ -116,6 +123,7 @@ eventManControllers.controller('EventDetailsCtrl', ['$scope', 'Event', 'Person', }, function(data) { $scope.event.persons = data; + $scope.allPersons = Person.all(); }); }; }] From 1dd7c7ddc3d3619f1c6c20dd5b80715d25ea147a Mon Sep 17 00:00:00 2001 From: Davide Alberani Date: Tue, 7 Apr 2015 23:56:23 +0200 Subject: [PATCH 3/4] filter for (un)registered persons at an event --- angular_app/event-info.html | 4 ++-- angular_app/js/app.js | 25 +++++++++++++++++++++++++ angular_app/js/controllers.js | 2 +- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/angular_app/event-info.html b/angular_app/event-info.html index 76b165f..3fab01a 100644 --- a/angular_app/event-info.html +++ b/angular_app/event-info.html @@ -91,9 +91,9 @@ - + - {{person.name}} {{person.surname}} + {{person.name}} {{person.surname}}
{{person.email}} diff --git a/angular_app/js/app.js b/angular_app/js/app.js index bc50801..f306a10 100644 --- a/angular_app/js/app.js +++ b/angular_app/js/app.js @@ -69,6 +69,31 @@ eventManApp.filter('eventWithPersonData', ['$filter', }] ); +eventManApp.filter('personRegistered', ['$filter', + function($filter) { + return function(inputArray, data) { + if (data.present === undefined) { + data.present = true; + } + inputArray = inputArray || []; + var returnArray = []; + var registeredIDs = []; + if (!(data.event && data.event.persons && data.event.persons.length)) { + return inputArray; + } + for (var x=0; x < data.event.persons.length; x++) { + registeredIDs.push(data.event.persons[x].person_id); + } + for (var x=0; x < inputArray.length; x++) { + var found = registeredIDs.indexOf(inputArray[x]._id) != -1; + if ((found && data.present) || (!found && !data.present)) { + returnArray.push(inputArray[x]); + } + } + return returnArray; + } + }] +); /* Directive that can be used to make an input field react to the press of Enter. */ eventManApp.directive('ngEnter', function () { diff --git a/angular_app/js/controllers.js b/angular_app/js/controllers.js index ede4b99..7f15e00 100644 --- a/angular_app/js/controllers.js +++ b/angular_app/js/controllers.js @@ -96,7 +96,7 @@ eventManControllers.controller('EventDetailsCtrl', ['$scope', 'Event', 'Person', $scope._addAttendee(angular.copy(p)); }); } else { - $scope._addAttendee(person); + $scope._addAttendee(angular.copy(person)); } }; From 8dda84f47923b9fd173a8f0410f54ee6288788cd Mon Sep 17 00:00:00 2001 From: Davide Alberani Date: Tue, 7 Apr 2015 23:59:35 +0200 Subject: [PATCH 4/4] documentation --- DEVELOPMENT.md | 3 +-- README.md | 10 ++++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 9e7da15..b2dead7 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -10,7 +10,7 @@ Definitions: Requirements: - create a new event (**DONE**) - create a new registered person manually (**DONE**) -- associate to an event a list of registered persons, creating them if needed (manually and importing from external sources) +- associate to an event a list of registered persons, creating them if needed (manually and importing from external sources) (**DONE**) - mark registered persons as present (including them in the list of attendees) (**DONE**) - mark when an attendee enters/leaves the event - execute actions when an attendee shows up or enters/leaves the event @@ -99,7 +99,6 @@ TODO Next to be done --------------- -- easy way to add a new person to an event - add the minimum required fields to lists and detailed pages for persons and events - handle datetimes (on GUI with a calendar and on the backend deserializing ISO 8601 strings) - modal on event/person removal diff --git a/README.md b/README.md index e870e7e..753a41c 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,8 @@ Event Man(ager) Your friendly manager of attendees at an event. -Notice -====== - -No, this project is not ready, yet. - -I'll let you know when I'm finished experimenting with it and you can contribute. +Development +=========== See the DEVELOPMENT.md file for more information about how to contribute. @@ -38,6 +34,8 @@ Python code documented following the [Sphinx](http://sphinx-doc.org/) syntax. Install and run =============== +Be sure to have a running MongoDB server, locally. + wget https://bootstrap.pypa.io/get-pip.py sudo python get-pip.py sudo pip install tornado