Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/admin/labels_controller.rb')
-rw-r--r--app/controllers/admin/labels_controller.rb18
1 files changed, 12 insertions, 6 deletions
diff --git a/app/controllers/admin/labels_controller.rb b/app/controllers/admin/labels_controller.rb
index 4747f3c5dea..10d060b8161 100644
--- a/app/controllers/admin/labels_controller.rb
+++ b/app/controllers/admin/labels_controller.rb
@@ -41,14 +41,20 @@ class Admin::LabelsController < Admin::ApplicationController
end
def destroy
- @label.destroy
- @labels = Label.templates
-
respond_to do |format|
- format.html do
- redirect_to admin_labels_path, status: :found, notice: _('Label was removed')
+ if @label.destroy
+ format.html do
+ redirect_to admin_labels_path, status: :found,
+ notice: format(_('%{label_name} was removed'), label_name: @label.name)
+ end
+ format.js { head :ok }
+ else
+ format.html do
+ redirect_to admin_labels_path, status: :found,
+ alert: @label.errors.full_messages.to_sentence
+ end
+ format.js { head :unprocessable_entity }
end
- format.js { head :ok }
end
end