diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-09-20 00:09:57 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-19 14:58:24 -0200 |
commit | bdb7bf4b5188ffd68e54cbf671ba9ce1a4ffb1d1 (patch) | |
tree | 3f53930ff56ab0cfeceb0ab3af75fe9b75fefebd /app/controllers/groups | |
parent | bf9d928b45516e716b0f7f099361ca03aa1454f8 (diff) | |
download | gitlab-ce-bdb7bf4b5188ffd68e54cbf671ba9ce1a4ffb1d1.tar.gz |
List group labels on project labels page
Diffstat (limited to 'app/controllers/groups')
-rw-r--r-- | app/controllers/groups/labels_controller.rb | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/app/controllers/groups/labels_controller.rb b/app/controllers/groups/labels_controller.rb index 449298f51a8..0ec2fcda0ef 100644 --- a/app/controllers/groups/labels_controller.rb +++ b/app/controllers/groups/labels_controller.rb @@ -3,6 +3,7 @@ class Groups::LabelsController < Groups::ApplicationController before_action :label, only: [:edit, :update, :destroy, :toggle_subscription] before_action :authorize_admin_labels!, only: [:new, :create, :edit, :update, :destroy] + before_action :save_previous_label_path, only: [:edit] respond_to :html @@ -25,11 +26,12 @@ class Groups::LabelsController < Groups::ApplicationController end def edit + @previous_labels_path = previous_labels_path end def update if @label.update_attributes(label_params) - redirect_to group_labels_path(@group) + redirect_back_or_group_labels_path else render :edit end @@ -64,4 +66,20 @@ class Groups::LabelsController < Groups::ApplicationController def label_params params.require(:label).permit(:title, :description, :color) end + + def redirect_back_or_group_labels_path(options = {}) + redirect_to previous_labels_path, options + end + + def previous_labels_path + session.fetch(:previous_labels_path, fallback_path) + end + + def fallback_path + group_labels_path(@group) + end + + def save_previous_label_path + session[:previous_labels_path] = URI(request.referer || '').path + end end |