diff --git a/angular_app/event-detail.html b/angular_app/event-edit.html similarity index 51% rename from angular_app/event-detail.html rename to angular_app/event-edit.html index 751c983..26b711f 100644 --- a/angular_app/event-detail.html +++ b/angular_app/event-edit.html @@ -1,19 +1,24 @@
+

{{event.title}}  + +

- {{event.title}} - +
- Title + {{'Title' | translate}}
- +
@@ -22,14 +27,14 @@
- +
- +
@@ -38,50 +43,11 @@
- +
- -
-
Persons
-
-
-
- - -
-
- - -
-
- - - - - - - - - - - - - - - -
{{'Person' | translate}}{{'Attended' | translate}}{{'Actions' | translate}}
{{person.name}} {{person.surname}} - - - -
-
-
diff --git a/angular_app/event-info.html b/angular_app/event-info.html new file mode 100644 index 0000000..14a6b2b --- /dev/null +++ b/angular_app/event-info.html @@ -0,0 +1,46 @@ +
+

{{event.title}} + +

+
+
{{'Persons' | translate}}
+
+
+
+ + +
+
+ + +
+
+ + + + + + + + + + + + + + + +
{{'Person' | translate}}{{'Attended' | translate}}{{'Actions' | translate}}
{{person.name}} {{person.surname}} + + + +
+
+
+
diff --git a/angular_app/event-main.html b/angular_app/event-main.html new file mode 100644 index 0000000..31800c0 --- /dev/null +++ b/angular_app/event-main.html @@ -0,0 +1 @@ +
diff --git a/angular_app/events-list.html b/angular_app/events-list.html index 0897044..9e120bb 100644 --- a/angular_app/events-list.html +++ b/angular_app/events-list.html @@ -1,25 +1,25 @@
-
-
-
-
- - -
-
- - -
-
+
+
+ +
-
-
+
+ + +
+
+ +
+ -
@@ -30,7 +30,7 @@ diff --git a/angular_app/index.html b/angular_app/index.html index 1aee94c..7a16202 100644 --- a/angular_app/index.html +++ b/angular_app/index.html @@ -10,6 +10,7 @@ + @@ -42,11 +43,10 @@ @@ -57,7 +57,7 @@ -
+
diff --git a/angular_app/js/app.js b/angular_app/js/app.js index b206403..a9795a5 100644 --- a/angular_app/js/app.js +++ b/angular_app/js/app.js @@ -20,11 +20,19 @@ var eventManApp = angular.module('eventManApp', [ 'eventManServices', 'eventManControllers', 'ui.bootstrap', + 'ui.router', 'pascalprecht.translate', 'angularFileUpload' ]); +/* Add some utilities to the global scope. */ +eventManApp.run(function($rootScope, $state, $stateParams) { + $rootScope.$state = $state; + $rootScope.$stateParams = $stateParams; +}); + + /* Directive that can be used to make an input field react to the press of Enter. */ eventManApp.directive('ngEnter', function () { return function (scope, element, attrs) { @@ -40,41 +48,56 @@ eventManApp.directive('ngEnter', function () { }); -/* Configure the routes. */ -eventManApp.config(['$routeProvider', - function($routeProvider) { - $routeProvider. - when('/persons', { - templateUrl: 'persons-list.html', - controller: 'PersonsListCtrl' - }). - when('/persons/:id', { - templateUrl: 'person-detail.html', - controller: 'PersonDetailsCtrl' - }). - when('/events', { +/* Configure the states. */ +eventManApp.config(['$stateProvider', '$urlRouterProvider', + function($stateProvider, $urlRouterProvider) { + $urlRouterProvider.otherwise("/events"); + $stateProvider + .state('events', { + url: '/events', templateUrl: 'events-list.html', controller: 'EventsListCtrl' - }). - when('/events/:id', { - templateUrl: 'event-detail.html', + }) + .state('event', { + url: '/event', + templateUrl: 'event-main.html', + }) + .state('event.new', { + url: '/new', + templateUrl: 'event-edit.html', controller: 'EventDetailsCtrl' - }). - when('/new-event', { - templateUrl: 'event-detail.html', + }) + .state('event.edit', { + url: '/:id/edit', + templateUrl: 'event-edit.html', controller: 'EventDetailsCtrl' - }). - when('/new-person', { + }) + .state('event.info', { + url: '/:id', + templateUrl: 'event-info.html', + controller: 'EventDetailsCtrl' + }) + .state('persons.list', { + url: '/persons', + templateUrl: 'persons-list.html', + controller: 'PersonsListCtrl' + }) + .state('persons.info', { + url: '/persons/:id', + templateUrl: 'persons-detail.html', + controller: 'PersonDetailsCtrl' + }) + .state('persons.new', { + url: '/new-person', templateUrl: 'person-detail.html', controller: 'PersonDetailsCtrl' - }). - when('/import-persons', { + }) + .state('persons.import', { + url: '/personsaaa', templateUrl: 'import-persons.html', controller: 'ImportPersonsCtrl' - }). - otherwise({ - redirectTo: '/events' - }); + } + ); } ]); diff --git a/angular_app/js/controllers.js b/angular_app/js/controllers.js index 3380840..3d40a36 100644 --- a/angular_app/js/controllers.js +++ b/angular_app/js/controllers.js @@ -52,10 +52,10 @@ eventManControllers.controller('EventsListCtrl', ['$scope', 'Event', ); -eventManControllers.controller('EventDetailsCtrl', ['$scope', 'Event', '$routeParams', '$log', - function ($scope, Event, $routeParams, $log) { - if ($routeParams.id) { - $scope.event = Event.get($routeParams); +eventManControllers.controller('EventDetailsCtrl', ['$scope', 'Event', '$stateParams', '$log', + function ($scope, Event, $stateParams, $log) { + if ($stateParams.id) { + $scope.event = Event.get($stateParams); } // store a new Event or update an existing one $scope.save = function() { @@ -73,11 +73,11 @@ eventManControllers.controller('EventDetailsCtrl', ['$scope', 'Event', '$routePa }; $scope.updateAttendee = function(person, attended) { - $log.debug('EventDetailsCtrl.event_id: ' + $routeParams.id); + $log.debug('EventDetailsCtrl.event_id: ' + $stateParams.id); $log.debug('EventDetailsCtrl.person_id: ' + person.person_id); $log.debug('EventDetailsCtrl.attended: ' + attended); Event.personAttended({ - _id: $routeParams.id, + _id: $stateParams.id, person_id: person.person_id, 'persons.$.attended': attended }, @@ -90,7 +90,7 @@ eventManControllers.controller('EventDetailsCtrl', ['$scope', 'Event', '$routePa $scope.removeAttendee = function(person) { Event.deleteAttendee({ - _id: $routeParams.id, + _id: $stateParams.id, person_id: person.person_id }, function(data) { @@ -115,11 +115,11 @@ eventManControllers.controller('PersonsListCtrl', ['$scope', 'Person', ); -eventManControllers.controller('PersonDetailsCtrl', ['$scope', '$routeParams', 'Person', 'Event', '$log', - function ($scope, $routeParams, Person, Event, $log) { - if ($routeParams.id) { - $scope.person = Person.get($routeParams); - Person.getEvents($routeParams, function(data) { +eventManControllers.controller('PersonDetailsCtrl', ['$scope', '$stateParams', 'Person', 'Event', '$log', + function ($scope, $stateParams, Person, Event, $log) { + if ($stateParams.id) { + $scope.person = Person.get($stateParams); + Person.getEvents($stateParams, function(data) { $scope.events = data; }); } @@ -132,16 +132,16 @@ eventManControllers.controller('PersonDetailsCtrl', ['$scope', '$routeParams', ' } }; $scope.updateAttendee = function(event, attended) { - $log.debug('PersonDetailsCtrl.event_id: ' + $routeParams.id); + $log.debug('PersonDetailsCtrl.event_id: ' + $stateParams.id); $log.debug('PersonDetailsCtrl.event_id: ' + event.event_id); $log.debug('PersonDetailsCtrl.attended: ' + attended); Event.personAttended({ _id: event._id, - person_id: $routeParams.id, + person_id: $stateParams.id, 'persons.$.attended': attended }, function(data) { - Person.getEvents($routeParams, function(data) { + Person.getEvents($stateParams, function(data) { $log.debug('PersonDetailsCtrl.personAttended.data'); $log.debug(data); $scope.events = data; diff --git a/angular_app/person-detail.html b/angular_app/person-edit.html similarity index 100% rename from angular_app/person-detail.html rename to angular_app/person-edit.html diff --git a/angular_app/person-info.html b/angular_app/person-info.html new file mode 100644 index 0000000..b66bd77 --- /dev/null +++ b/angular_app/person-info.html @@ -0,0 +1,57 @@ + +
+
+
+ Name + +
+ +
+ Surname + +
+ +
+ Email + +
+ + + + +
+
Events
+
+
+
+ + +
+
+ + +
+ +
- {{event.title}} + {{event.title}}

Begins: {{event['begin-datetime']}}
Ends: {{event['end-datetime']}}

+ + + + + + + + + + + + +
EventAttended
{{event.title}} + +
+
+
+ + diff --git a/backend.py b/backend.py index 7f143bf..57d6e91 100644 --- a/backend.py +++ b/backend.py @@ -223,5 +223,6 @@ class EventManDB(object): db = self.connect() if not isinstance(_id_or_query, dict): _id_or_query = {'_id': _id_or_query} + _id_or_query = self.convert(_id_or_query) db[collection].remove(_id_or_query) diff --git a/static/css/eventman.css b/static/css/eventman.css index bb48dbd..f61268f 100644 --- a/static/css/eventman.css +++ b/static/css/eventman.css @@ -1,6 +1,6 @@ /* nav-bar padding */ -body { padding-top: 65px; } +body { padding-top: 70px; } /* fix styling for empty href */ .nav, .pagination, .carousel, .panel-title a { cursor: pointer; }