diff options
author | Tim Zallmann <tzallmann@gitlab.com> | 2018-06-07 13:53:24 +0300 |
---|---|---|
committer | Tim Zallmann <tzallmann@gitlab.com> | 2018-06-07 13:53:24 +0300 |
commit | be928829cfddf22c9608e02aa6ca2c03cf0a30b4 (patch) | |
tree | 6c4216b6216c605518743dd7a82b0837379d2c7c /app/controllers | |
parent | 7c179bf39ec3d0f8e22ad71608546273bb0760db (diff) | |
parent | a97f4ec3615595694b11676484e9ac1ba5524a9e (diff) |
Merge branch '39549-label-list-page-redesign-with-draggable-labels' into 'master'
Resolve "Label list page redesign with draggable labels"
Closes #39549
See merge request gitlab-org/gitlab-ce!18466
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/groups/labels_controller.rb | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/app/controllers/groups/labels_controller.rb b/app/controllers/groups/labels_controller.rb index 58be330f466..863f50e8e66 100644 --- a/app/controllers/groups/labels_controller.rb +++ b/app/controllers/groups/labels_controller.rb @@ -2,6 +2,7 @@ class Groups::LabelsController < Groups::ApplicationController include ToggleSubscriptionAction before_action :label, only: [:edit, :update, :destroy] + before_action :available_labels, only: [:index] before_action :authorize_admin_labels!, only: [:new, :create, :edit, :update, :destroy] before_action :save_previous_label_path, only: [:edit] @@ -12,17 +13,8 @@ class Groups::LabelsController < Groups::ApplicationController format.html do @labels = @group.labels.page(params[:page]) end - format.json do - available_labels = LabelsFinder.new( - current_user, - group_id: @group.id, - only_group_labels: params[:only_group_labels], - include_ancestor_groups: params[:include_ancestor_groups], - include_descendant_groups: params[:include_descendant_groups] - ).execute - - render json: LabelSerializer.new.represent_appearance(available_labels) + render json: LabelSerializer.new.represent_appearance(@available_labels) end end end @@ -113,4 +105,15 @@ class Groups::LabelsController < Groups::ApplicationController def save_previous_label_path session[:previous_labels_path] = URI(request.referer || '').path end + + def available_labels + @available_labels ||= + LabelsFinder.new( + current_user, + group_id: @group.id, + only_group_labels: params[:only_group_labels], + include_ancestor_groups: params[:include_ancestor_groups], + include_descendant_groups: params[:include_descendant_groups] + ).execute + end end |