diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2017-01-24 17:32:34 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2017-02-07 15:37:36 +0200 |
commit | f39dbf3d3d4d5c99910043e8793a96246f0039fe (patch) | |
tree | 3c57925c524cb0a21ee189e352e8b46e356229bc /app/controllers/groups_controller.rb | |
parent | da359c46b598ba44cff1829ab4abe49c4c225ae2 (diff) | |
download | gitlab-ce-f39dbf3d3d4d5c99910043e8793a96246f0039fe.tar.gz |
Allow creating nested group via UIdz-create-nested-groups-via-ui
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/controllers/groups_controller.rb')
-rw-r--r-- | app/controllers/groups_controller.rb | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 264b14713fb..20e1c79fe6b 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -13,9 +13,11 @@ class GroupsController < Groups::ApplicationController before_action :authorize_create_group!, only: [:new, :create] # Load group projects - before_action :group_projects, only: [:show, :projects, :activity, :issues, :merge_requests] + before_action :group_projects, only: [:projects, :activity, :issues, :merge_requests] before_action :event_filter, only: [:activity] + before_action :user_actions, only: [:show, :subgroups] + layout :determine_layout def index @@ -37,13 +39,6 @@ class GroupsController < Groups::ApplicationController end def show - if current_user - @last_push = current_user.recent_push - @notification_setting = current_user.notification_settings_for(group) - end - - @nested_groups = group.children - setup_projects respond_to do |format| @@ -62,6 +57,11 @@ class GroupsController < Groups::ApplicationController end end + def subgroups + @nested_groups = group.children + @nested_groups = @nested_groups.search(params[:filter_groups]) if params[:filter_groups].present? + end + def activity respond_to do |format| format.html @@ -99,13 +99,16 @@ class GroupsController < Groups::ApplicationController protected def setup_projects + options = {} + options[:only_owned] = true if params[:shared] == '0' + options[:only_shared] = true if params[:shared] == '1' + + @projects = GroupProjectsFinder.new(group, options).execute(current_user) @projects = @projects.includes(:namespace) @projects = @projects.sorted_by_activity @projects = filter_projects(@projects) @projects = @projects.sort(@sort = params[:sort]) @projects = @projects.page(params[:page]) if params[:filter_projects].blank? - - @shared_projects = GroupProjectsFinder.new(group, only_shared: true).execute(current_user) end def authorize_create_group! @@ -138,7 +141,8 @@ class GroupsController < Groups::ApplicationController :public, :request_access_enabled, :share_with_group_lock, - :visibility_level + :visibility_level, + :parent_id ] end @@ -147,4 +151,11 @@ class GroupsController < Groups::ApplicationController @events = event_filter.apply_filter(@events).with_associations @events = @events.limit(20).offset(params[:offset] || 0) end + + def user_actions + if current_user + @last_push = current_user.recent_push + @notification_setting = current_user.notification_settings_for(group) + end + end end |