mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-17 06:52:27 +01:00
confirmation on event filter deletion
This commit is contained in:
parent
eb7ee6300e
commit
859960ce3e
@ -129,8 +129,8 @@ class EventsController
|
||||
##
|
||||
# Controller used in the events listing page (admin view)
|
||||
##
|
||||
Application.Controllers.controller "AdminEventsController", ["$scope", "$state", 'Event', 'Category', 'EventTheme', 'AgeRange', 'eventsPromise', 'categoriesPromise', 'themesPromise', 'ageRangesPromise'
|
||||
, ($scope, $state, Event, Category, EventTheme, AgeRange, eventsPromise, categoriesPromise, themesPromise, ageRangesPromise) ->
|
||||
Application.Controllers.controller "AdminEventsController", ["$scope", "$state", 'dialogs','Event', 'Category', 'EventTheme', 'AgeRange', 'eventsPromise', 'categoriesPromise', 'themesPromise', 'ageRangesPromise', '_t'
|
||||
, ($scope, $state, dialogs, Event, Category, EventTheme, AgeRange, eventsPromise, categoriesPromise, themesPromise, ageRangesPromise, _t) ->
|
||||
|
||||
|
||||
|
||||
@ -191,8 +191,14 @@ Application.Controllers.controller "AdminEventsController", ["$scope", "$state",
|
||||
# @param index {number} element index in the $scope[model] array
|
||||
##
|
||||
$scope.removeElement = (model, index) ->
|
||||
getModel(model)[0].delete getModel(model)[1][index]
|
||||
getModel(model)[1].splice(index, 1)
|
||||
dialogs.confirm
|
||||
resolve:
|
||||
object: ->
|
||||
title: _t('confirmation_required')
|
||||
msg: _t('do_you_really_want_to_delete_this_ELEMENT_used_NUMBER_times', {ELEMENT:model, NUMBER:getModel(model)[1][index].related_to}, "messageformat")
|
||||
, -> # delete confirmed
|
||||
getModel(model)[0].delete getModel(model)[1][index]
|
||||
getModel(model)[1].splice(index, 1)
|
||||
|
||||
|
||||
|
||||
@ -203,6 +209,7 @@ Application.Controllers.controller "AdminEventsController", ["$scope", "$state",
|
||||
$scope.addElement = (model) ->
|
||||
$scope.inserted[model] =
|
||||
name: ''
|
||||
related_to: 0
|
||||
getModel(model)[1].push($scope.inserted[model])
|
||||
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
user_is_admin = (current_user and current_user.is_admin?)
|
||||
|
||||
json.array!(@age_ranges) do |ar|
|
||||
json.extract! ar, :id, :name
|
||||
json.related_to ar.events.count if user_is_admin
|
||||
end
|
||||
|
@ -1,3 +1,6 @@
|
||||
user_is_admin = (current_user and current_user.is_admin?)
|
||||
|
||||
json.array!(@categories) do |category|
|
||||
json.extract! category, :id, :name
|
||||
json.related_to category.events.count if user_is_admin
|
||||
end
|
||||
|
@ -1,3 +1,6 @@
|
||||
user_is_admin = (current_user and current_user.is_admin?)
|
||||
|
||||
json.array!(@event_themes) do |theme|
|
||||
json.extract! theme, :id, :name
|
||||
json.related_to theme.events.count if user_is_admin
|
||||
end
|
||||
|
@ -84,6 +84,7 @@ en:
|
||||
add_a_theme: "Add a theme"
|
||||
age_ranges: "Age ranges"
|
||||
add_a_range: "Add a range"
|
||||
do_you_really_want_to_delete_this_ELEMENT_used_NUMBER_times: "Do you really want to delete this {ELEMENT, select, category{category} theme{theme} age_range{age range} other{element}}? {NUMBER, plural, =0{It is not currently associated with any events} one{Currently, it is associated with only one event} other{Currently, it is associated with {NUMBER} events}}." # messageFormat interpolation
|
||||
|
||||
events_new:
|
||||
# add a new event
|
||||
|
@ -84,6 +84,7 @@ fr:
|
||||
add_a_theme: "Ajouter une thématique"
|
||||
age_ranges: "Tranches d'âge"
|
||||
add_a_range: "Ajouter une tranche"
|
||||
do_you_really_want_to_delete_this_ELEMENT_used_NUMBER_times: "Voulez-vous vraiment supprimer cette {ELEMENT, select, category{catégorie} theme{thématique} age_range{tranche d'âge} other{élément}} ? {NUMBER, plural, =0{Elle n'est actuellement associée à aucun évènement} one{Elle est actuellement associée à un seul évènement} other{Elle est actuellement associée à {NUMBER} évènements}}." # messageFormat interpolation
|
||||
|
||||
events_new:
|
||||
# ajouter un nouveau atelier/stage
|
||||
|
Loading…
x
Reference in New Issue
Block a user