diff --git a/app/assets/javascripts/controllers/admin/events.coffee b/app/assets/javascripts/controllers/admin/events.coffee
index d501f6a1b..242145c22 100644
--- a/app/assets/javascripts/controllers/admin/events.coffee
+++ b/app/assets/javascripts/controllers/admin/events.coffee
@@ -136,7 +136,8 @@ class EventsController
##
# Controller used in the events listing page (admin view)
##
-Application.Controllers.controller "AdminEventsController", ["$scope", "$state", 'Event', 'eventsPromise', ($scope, $state, Event, eventsPromise) ->
+Application.Controllers.controller "AdminEventsController", ["$scope", "$state", 'Event', 'Category', 'eventsPromise', 'categoriesPromise'
+, ($scope, $state, Event, Category, eventsPromise, categoriesPromise) ->
@@ -151,6 +152,9 @@ Application.Controllers.controller "AdminEventsController", ["$scope", "$state",
## Current virtual page
$scope.page = 2
+ ## List of categories for the events
+ $scope.categories = categoriesPromise
+
##
# Adds a bucket of events to the bottom of the page, grouped by month
##
@@ -161,6 +165,52 @@ Application.Controllers.controller "AdminEventsController", ["$scope", "$state",
$scope.page += 1
+ ##
+ # Saves a new categoty / Update an existing one to the server (form validation callback)
+ # @param data {Object} category name
+ # @param [data] {number} category id, in case of update
+ ##
+ $scope.saveCategory = (data, id) ->
+ if id?
+ Category.update {id: id}, data
+ else
+ Category.save data, (resp)->
+ $scope.categories[$scope.categories.length-1].id = resp.id
+
+
+
+ ##
+ # Deletes the category at the specified index
+ # @param index {number} category index in the $scope.categories array
+ ##
+ $scope.removeCategory = (index) ->
+ Category.delete $scope.categories[index]
+ $scope.categories.splice(index, 1)
+
+
+
+ ##
+ # Creates a new empty entry in the $scope.categories array
+ ##
+ $scope.addCategory = ->
+ $scope.inserted =
+ name: ''
+ $scope.categories.push($scope.inserted)
+
+
+
+ ##
+ # Removes the newly inserted but not saved category / Cancel the current category modification
+ # @param rowform {Object} see http://vitalets.github.io/angular-xeditable/
+ # @param index {number} category index in the $scope.categories array
+ ##
+ $scope.cancelCategory = (rowform, index) ->
+ if $scope.categories[index].id?
+ rowform.$cancel()
+ else
+ $scope.categories.splice(index, 1)
+
+
### PRIVATE SCOPE ###
diff --git a/app/assets/javascripts/controllers/main_nav.coffee.erb b/app/assets/javascripts/controllers/main_nav.coffee.erb
index 5e5827cb8..e473c7ac3 100644
--- a/app/assets/javascripts/controllers/main_nav.coffee.erb
+++ b/app/assets/javascripts/controllers/main_nav.coffee.erb
@@ -73,7 +73,7 @@ Application.Controllers.controller "MainNavController", ["$scope", "$location",
}
{
state: 'app.admin.events'
- linkText: 'events_monitoring'
+ linkText: 'manage_the_events'
linkIcon: 'tags'
}
{
diff --git a/app/assets/javascripts/router.coffee.erb b/app/assets/javascripts/router.coffee.erb
index 978705d54..a293b6985 100644
--- a/app/assets/javascripts/router.coffee.erb
+++ b/app/assets/javascripts/router.coffee.erb
@@ -534,6 +534,9 @@ angular.module('application.router', ['ui.router']).
eventsPromise: ['Event', (Event)->
Event.query(page: 1).$promise
]
+ categoriesPromise: ['Category', (Category) ->
+ Category.query().$promise
+ ]
translations: [ 'Translations', (Translations) ->
Translations.query('app.admin.events').$promise
]
diff --git a/app/assets/templates/admin/events/filters.html.erb b/app/assets/templates/admin/events/filters.html.erb
new file mode 100644
index 000000000..e25108313
--- /dev/null
+++ b/app/assets/templates/admin/events/filters.html.erb
@@ -0,0 +1,41 @@
+
+
{{ 'categories' }}
+
+
+
+
+
{{ 'name' }}
+
+
+
+
+
+
+
+ {{ category.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/assets/templates/admin/events/index.html.erb b/app/assets/templates/admin/events/index.html.erb
index f7aa514d0..3d4ad5b5e 100644
--- a/app/assets/templates/admin/events/index.html.erb
+++ b/app/assets/templates/admin/events/index.html.erb
@@ -21,57 +21,66 @@