summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-09-08 14:49:20 +0100
committerDouwe Maan <douwe@gitlab.com>2015-09-08 14:49:20 +0100
commit5d785457db3017a17722314a52433543dd925164 (patch)
treea030699b752fcd1f161118be70a9df0f625fa0ef /app/controllers
parent260fcd45209b59ace6b3fd6dcca6c32c2c75a8f1 (diff)
downloadgitlab-ce-5d785457db3017a17722314a52433543dd925164.tar.gz
Clean up overlap between dashboard and explore.
- Split up SnippetsController into separate dashboard and explore sections. - Use consistent page titles, header titles and sidebars between dashboard and explore sections when signed in or not.
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/dashboard/projects_controller.rb15
-rw-r--r--app/controllers/dashboard/snippets_controller.rb10
-rw-r--r--app/controllers/dashboard_controller.rb19
-rw-r--r--app/controllers/explore/application_controller.rb2
-rw-r--r--app/controllers/explore/groups_controller.rb3
-rw-r--r--app/controllers/explore/projects_controller.rb3
-rw-r--r--app/controllers/explore/snippets_controller.rb6
-rw-r--r--app/controllers/groups_controller.rb4
-rw-r--r--app/controllers/projects_controller.rb4
-rw-r--r--app/controllers/root_controller.rb5
-rw-r--r--app/controllers/snippets_controller.rb8
11 files changed, 46 insertions, 33 deletions
diff --git a/app/controllers/dashboard/projects_controller.rb b/app/controllers/dashboard/projects_controller.rb
index da96171e885..467d0f81aca 100644
--- a/app/controllers/dashboard/projects_controller.rb
+++ b/app/controllers/dashboard/projects_controller.rb
@@ -1,6 +1,21 @@
class Dashboard::ProjectsController < Dashboard::ApplicationController
before_action :event_filter
+ def index
+ @projects = current_user.authorized_projects.sorted_by_activity.non_archived
+ @projects = @projects.includes(:namespace)
+ @last_push = current_user.recent_push
+
+ respond_to do |format|
+ format.html
+ format.atom do
+ event_filter
+ load_events
+ render layout: false
+ end
+ end
+ end
+
def starred
@projects = current_user.starred_projects
@projects = @projects.includes(:namespace, :forked_from_project, :tags)
diff --git a/app/controllers/dashboard/snippets_controller.rb b/app/controllers/dashboard/snippets_controller.rb
new file mode 100644
index 00000000000..f4354c6d8ca
--- /dev/null
+++ b/app/controllers/dashboard/snippets_controller.rb
@@ -0,0 +1,10 @@
+class Dashboard::SnippetsController < Dashboard::ApplicationController
+ def index
+ @snippets = SnippetsFinder.new.execute(current_user,
+ filter: :by_user,
+ user: current_user,
+ scope: params[:scope]
+ )
+ @snippets = @snippets.page(params[:page]).per(PER_PAGE)
+ end
+end
diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb
index 2bc2e5e58f5..4ebb3d7276e 100644
--- a/app/controllers/dashboard_controller.rb
+++ b/app/controllers/dashboard_controller.rb
@@ -1,23 +1,8 @@
class DashboardController < Dashboard::ApplicationController
- before_action :load_projects, except: :activity
before_action :event_filter, only: :activity
respond_to :html
- def show
- @projects = @projects.includes(:namespace)
- @last_push = current_user.recent_push
-
- respond_to do |format|
- format.html
- format.atom do
- event_filter
- load_events
- render layout: false
- end
- end
- end
-
def merge_requests
@merge_requests = get_merge_requests_collection
@merge_requests = @merge_requests.page(params[:page]).per(PER_PAGE)
@@ -50,10 +35,6 @@ class DashboardController < Dashboard::ApplicationController
protected
- def load_projects
- @projects = current_user.authorized_projects.sorted_by_activity.non_archived
- end
-
def load_events
project_ids =
if params[:filter] == "starred"
diff --git a/app/controllers/explore/application_controller.rb b/app/controllers/explore/application_controller.rb
index 4b275033d26..461fc059a3c 100644
--- a/app/controllers/explore/application_controller.rb
+++ b/app/controllers/explore/application_controller.rb
@@ -1,3 +1,5 @@
class Explore::ApplicationController < ApplicationController
+ skip_before_action :authenticate_user!, :reject_blocked
+
layout 'explore'
end
diff --git a/app/controllers/explore/groups_controller.rb b/app/controllers/explore/groups_controller.rb
index 55cda0cff17..9575a87ee41 100644
--- a/app/controllers/explore/groups_controller.rb
+++ b/app/controllers/explore/groups_controller.rb
@@ -1,7 +1,4 @@
class Explore::GroupsController < Explore::ApplicationController
- skip_before_action :authenticate_user!,
- :reject_blocked, :set_current_user_for_observers
-
def index
@groups = GroupsFinder.new.execute(current_user)
@groups = @groups.search(params[:search]) if params[:search].present?
diff --git a/app/controllers/explore/projects_controller.rb b/app/controllers/explore/projects_controller.rb
index 6c733c1ae4d..a5aeaed66c5 100644
--- a/app/controllers/explore/projects_controller.rb
+++ b/app/controllers/explore/projects_controller.rb
@@ -1,7 +1,4 @@
class Explore::ProjectsController < Explore::ApplicationController
- skip_before_action :authenticate_user!,
- :reject_blocked
-
def index
@projects = ProjectsFinder.new.execute(current_user)
@tags = @projects.tags_on(:tags)
diff --git a/app/controllers/explore/snippets_controller.rb b/app/controllers/explore/snippets_controller.rb
new file mode 100644
index 00000000000..b70ac51d06e
--- /dev/null
+++ b/app/controllers/explore/snippets_controller.rb
@@ -0,0 +1,6 @@
+class Explore::SnippetsController < Explore::ApplicationController
+ def index
+ @snippets = SnippetsFinder.new.execute(current_user, filter: :all)
+ @snippets = @snippets.page(params[:page]).per(PER_PAGE)
+ end
+end
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
index 279c6ef0f4d..85bf44ee9a5 100644
--- a/app/controllers/groups_controller.rb
+++ b/app/controllers/groups_controller.rb
@@ -14,6 +14,10 @@ class GroupsController < Groups::ApplicationController
layout :determine_layout
+ def index
+ redirect_to (current_user ? dashboard_groups_path : explore_groups_path)
+ end
+
def new
@group = Group.new
end
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index dafc11d0707..540bfa9ac07 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -10,6 +10,10 @@ class ProjectsController < ApplicationController
layout :determine_layout
+ def index
+ redirect_to (current_user ? root_path : explore_root_path)
+ end
+
def new
@project = Project.new
end
diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb
index fdfe00dc135..a3aa86de5b4 100644
--- a/app/controllers/root_controller.rb
+++ b/app/controllers/root_controller.rb
@@ -6,10 +6,10 @@
#
# For users who haven't customized the setting, we simply delegate to
# `DashboardController#show`, which is the default.
-class RootController < DashboardController
+class RootController < Dashboard::ProjectsController
before_action :redirect_to_custom_dashboard, only: [:show]
- def show
+ def index
super
end
@@ -20,6 +20,7 @@ class RootController < DashboardController
case current_user.dashboard
when 'stars'
+ flash.keep
redirect_to starred_dashboard_projects_path
else
return
diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb
index 8e7e45c781f..f5938da936f 100644
--- a/app/controllers/snippets_controller.rb
+++ b/app/controllers/snippets_controller.rb
@@ -24,13 +24,9 @@ class SnippetsController < ApplicationController
scope: params[:scope] }).
page(params[:page]).per(PER_PAGE)
- if @user == current_user
- render 'current_user_index'
- else
- render 'user_index'
- end
+ render 'index'
else
- @snippets = SnippetsFinder.new.execute(current_user, filter: :all).page(params[:page]).per(PER_PAGE)
+ redirect_to (current_user ? dashboard_snippets_path : explore_snippets_path)
end
end