diff --git a/angular_app/js/controllers.js b/angular_app/js/controllers.js
index b878e75..3963383 100644
--- a/angular_app/js/controllers.js
+++ b/angular_app/js/controllers.js
@@ -58,6 +58,7 @@ eventManControllers.controller('EventDetailsCtrl', ['$scope', 'Event', 'Person',
$scope.personsOrderProp = 'name';
$scope.eventsOrderProp = '-begin-date';
$scope.countAttendees = 0;
+ $scope.message = {};
$scope.customFields = Setting.query({setting: 'person_custom_field',
in_event_details: true});
@@ -118,6 +119,9 @@ eventManControllers.controller('EventDetailsCtrl', ['$scope', 'Event', 'Person',
$scope.allPersons = Person.all();
}
$scope.newPerson = {};
+ // XXX: must be converted in a i18n-able form.
+ var msg = '' + person_data.name + ' ' + person_data.surname + ' successfully added to event ' + $scope.event.title;
+ $scope.showMessage({message: msg});
});
});
$scope.query = '';
@@ -150,6 +154,16 @@ eventManControllers.controller('EventDetailsCtrl', ['$scope', 'Event', 'Person',
if (callback) {
callback(data);
}
+ if (key === 'attended') {
+ var msg = {};
+ if (value) {
+ msg.message = '' + person.name + ' ' + person.surname + ' successfully added to event ' + $scope.event.title;
+ } else {
+ msg.message = '' + person.name + ' ' + person.surname + ' successfully removed from event ' + $scope.event.title;
+ msg.isError = true;
+ }
+ $scope.showMessage(msg);
+ }
});
};
@@ -168,6 +182,10 @@ eventManControllers.controller('EventDetailsCtrl', ['$scope', 'Event', 'Person',
$scope.allPersons = Person.all();
});
};
+
+ $scope.showMessage = function(cfg) {
+ $scope.message.show(cfg);
+ };
}]
);
diff --git a/angular_app/js/directives.js b/angular_app/js/directives.js
index d74d401..a271bef 100644
--- a/angular_app/js/directives.js
+++ b/angular_app/js/directives.js
@@ -39,3 +39,32 @@ eventManApp.directive('resetFocus', function () {
};
});
+
+eventManApp.directive('eventmanMessage', ['$timeout',
+ function($timeout) {
+ function link(scope, element, attrs) {
+ scope.dControl = scope.control || {};
+ scope.dControl.isVisible = false;
+
+ scope.dControl.show = function(cfg) {
+ cfg = cfg || {};
+ scope.dControl.isVisible = true;
+ scope.dControl.message = cfg.message;
+ scope.dControl.isError = cfg.isError;
+ $timeout(function () {
+ scope.dControl.isVisible = false;
+ }, cfg.timeout || 2000);
+ };
+ };
+
+ return {
+ scope: {
+ control: '='
+ },
+ link: link,
+ replace: true,
+ template: '
{{dControl.message}}
'
+ };
+ }]
+);
+
diff --git a/static/css/eventman.css b/static/css/eventman.css
index 16d6541..ae32b09 100644
--- a/static/css/eventman.css
+++ b/static/css/eventman.css
@@ -19,4 +19,14 @@ body { padding-top: 70px; }
float: none;
}
+.eventman-message {
+ position: fixed;
+ top: 2%;
+ width: 40%;
+ left: 30%;
+ text-align: center;
+ display: inline-block;
+ z-index: 10000;
+}
+
/* .row { display: table; } */