diff options
author | Martin Wortschack <mwortschack@gitlab.com> | 2019-06-05 03:10:24 +0300 |
---|---|---|
committer | Mayra Cabrera <mcabrera@gitlab.com> | 2019-06-05 03:10:24 +0300 |
commit | dab00e6929412b7371a246ad37f858611b7f2757 (patch) | |
tree | e096293d5b5a1f0a332b4b7697e896e1041d3483 | |
parent | 54cc3b64929dfe2eea562089b5fd6656a50ed2ae (diff) |
Add render_projects method to controller
- Render EE specific partial if exists
-rw-r--r-- | app/controllers/dashboard/projects_controller.rb | 19 | ||||
-rw-r--r-- | app/helpers/projects_helper.rb | 1 | ||||
-rw-r--r-- | app/views/layouts/application.html.haml | 2 |
3 files changed, 16 insertions, 6 deletions
diff --git a/app/controllers/dashboard/projects_controller.rb b/app/controllers/dashboard/projects_controller.rb index 70811f5ea59..65d14781d92 100644 --- a/app/controllers/dashboard/projects_controller.rb +++ b/app/controllers/dashboard/projects_controller.rb @@ -6,18 +6,14 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController prepend_before_action(only: [:index]) { authenticate_sessionless_user!(:rss) } before_action :set_non_archived_param + before_action :projects, only: [:index] before_action :default_sorting skip_cross_project_access_check :index, :starred def index - @projects = load_projects(params.merge(non_public: true)) - respond_to do |format| format.html do - # n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/40260 - Gitlab::GitalyClient.allow_n_plus_1_calls do - render - end + render_projects end format.atom do load_events @@ -51,6 +47,17 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController private + def projects + @projects ||= load_projects(params.merge(non_public: true)) + end + + def render_projects + # n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/40260 + Gitlab::GitalyClient.allow_n_plus_1_calls do + render + end + end + def default_sorting params[:sort] ||= 'latest_activity_desc' @sort = params[:sort] diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index e587cf4045d..8dee842a22d 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -241,6 +241,7 @@ module ProjectsHelper # TODO: Remove this method when removing the feature flag # https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/11209#note_162234863 + # make sure to remove from the EE specific controller as well: ee/app/controllers/ee/dashboard/projects_controller.rb def show_projects?(projects, params) Feature.enabled?(:project_list_filter_bar) || !!(params[:personal] || params[:name] || any_projects?(projects)) end diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 043cca6ad38..c38f96f302a 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -10,4 +10,6 @@ = render 'layouts/page', sidebar: sidebar, nav: nav = footer_message + = render_if_exists "shared/onboarding_guide" + = yield :scripts_body |