summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-12-26 18:33:53 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-12-26 18:33:53 +0200
commit465f186954d00fa47c8b05cc91f33e7943aa209a (patch)
tree3c0135ba0edc5ecc3e590f860ce8ce6ba6e3384d
parenta7b7a2dd4c866403ec5536f213df9e4762fa112b (diff)
downloadgitlab-ce-465f186954d00fa47c8b05cc91f33e7943aa209a.tar.gz
Show assigned issues/mr be default on dashboard
This was default before but now it fixed with providing assignee_id parameter making url shareble and dont reset when other filters users. Also this commit removes old methods that are not used any more. Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r--app/controllers/application_controller.rb4
-rw-r--r--app/helpers/dashboard_helper.rb38
-rw-r--r--app/views/layouts/nav/_dashboard.html.haml4
-rw-r--r--features/steps/shared/paths.rb5
4 files changed, 9 insertions, 42 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 41ad5f98ace..4b8cae469e3 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -257,10 +257,6 @@ class ApplicationController < ActionController::Base
# or improve current implementation to filter only issues you
# created or assigned or mentioned
#@filter_params[:authorized_only] = true
-
- unless @filter_params[:assignee_id]
- @filter_params[:assignee_id] = current_user.id
- end
end
@filter_params
diff --git a/app/helpers/dashboard_helper.rb b/app/helpers/dashboard_helper.rb
index 976a396e7b6..3e6f3b41ff5 100644
--- a/app/helpers/dashboard_helper.rb
+++ b/app/helpers/dashboard_helper.rb
@@ -1,13 +1,4 @@
module DashboardHelper
- def entities_per_project(project, entity)
- case entity.to_sym
- when :issue then @issues.where(project_id: project.id)
- when :merge_request then @merge_requests.where(target_project_id: project.id)
- else
- []
- end.count
- end
-
def projects_dashboard_filter_path(options={})
exist_opts = {
sort: params[:sort],
@@ -22,32 +13,11 @@ module DashboardHelper
path
end
- def assigned_entities_count(current_user, entity, scope = nil)
- items = current_user.send('assigned_' + entity.pluralize)
- get_count(items, scope)
- end
-
- def authored_entities_count(current_user, entity, scope = nil)
- items = current_user.send(entity.pluralize)
- get_count(items, scope)
+ def assigned_issues_dashboard_path
+ issues_dashboard_path(assignee_id: current_user.id)
end
- def authorized_entities_count(current_user, entity, scope = nil)
- items = entity.classify.constantize
- get_count(items, scope, true, current_user)
- end
-
- protected
-
- def get_count(items, scope, get_authorized = false, current_user = nil)
- items = items.opened
- if scope.kind_of?(Group)
- items = items.of_group(scope)
- elsif scope.kind_of?(Project)
- items = items.of_projects(scope)
- elsif get_authorized
- items = items.of_projects(current_user.authorized_projects)
- end
- items.count
+ def assigned_mrs_dashboard_path
+ merge_requests_dashboard_path(assignee_id: current_user.id)
end
end
diff --git a/app/views/layouts/nav/_dashboard.html.haml b/app/views/layouts/nav/_dashboard.html.haml
index da1976346d5..a2eaa2d83c5 100644
--- a/app/views/layouts/nav/_dashboard.html.haml
+++ b/app/views/layouts/nav/_dashboard.html.haml
@@ -10,13 +10,13 @@
%span
Projects
= nav_link(path: 'dashboard#issues') do
- = link_to issues_dashboard_path, class: 'shortcuts-issues' do
+ = link_to assigned_issues_dashboard_path, class: 'shortcuts-issues' do
%i.fa.fa-exclamation-circle
%span
Issues
%span.count= current_user.assigned_issues.opened.count
= nav_link(path: 'dashboard#merge_requests') do
- = link_to merge_requests_dashboard_path, class: 'shortcuts-merge_requests' do
+ = link_to assigned_mrs_dashboard_path, class: 'shortcuts-merge_requests' do
%i.fa.fa-tasks
%span
Merge Requests
diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb
index ca038732231..b60d290ae9c 100644
--- a/features/steps/shared/paths.rb
+++ b/features/steps/shared/paths.rb
@@ -1,6 +1,7 @@
module SharedPaths
include Spinach::DSL
include RepoHelpers
+ include DashboardHelper
step 'I visit new project page' do
visit new_project_path
@@ -71,11 +72,11 @@ module SharedPaths
end
step 'I visit dashboard issues page' do
- visit issues_dashboard_path
+ visit assigned_issues_dashboard_path
end
step 'I visit dashboard merge requests page' do
- visit merge_requests_dashboard_path
+ visit assigned_mrs_dashboard_path
end
step 'I visit dashboard search page' do