diff --git a/app/assets/stylesheets/pages/tasks.scss b/app/assets/stylesheets/pages/tasks.scss index 702d7c55e59..f0e13f4d786 100644 --- a/app/assets/stylesheets/pages/tasks.scss +++ b/app/assets/stylesheets/pages/tasks.scss @@ -2,6 +2,16 @@ * Dashboard tasks queue * */ + +.navbar-nav { + li { + .badge.tasks-pending-count { + background-color: #7f8fa4; + margin-top: -5px; + } + } +} + .tasks { .panel { border-top: none; diff --git a/app/controllers/dashboard/tasks_controller.rb b/app/controllers/dashboard/tasks_controller.rb index 1102745067f..2f049da661c 100644 --- a/app/controllers/dashboard/tasks_controller.rb +++ b/app/controllers/dashboard/tasks_controller.rb @@ -10,9 +10,6 @@ class Dashboard::TasksController < Dashboard::ApplicationController end @tasks = @tasks.page(params[:page]).per(PER_PAGE) - - @pending_count = current_user.tasks.pending.count - @done_count = current_user.tasks.done.count end def destroy diff --git a/app/helpers/tasks_helper.rb b/app/helpers/tasks_helper.rb index 4a87f8d4ca4..cf4eab0ef94 100644 --- a/app/helpers/tasks_helper.rb +++ b/app/helpers/tasks_helper.rb @@ -9,6 +9,14 @@ module TasksHelper end end + def tasks_pending_count + current_user.tasks.pending.count + end + + def tasks_done_count + current_user.tasks.done.count + end + def task_action_name(task) target = task.target_type.titleize.downcase diff --git a/app/views/dashboard/tasks/index.html.haml b/app/views/dashboard/tasks/index.html.haml index 8147d017c3f..2f582009288 100644 --- a/app/views/dashboard/tasks/index.html.haml +++ b/app/views/dashboard/tasks/index.html.haml @@ -5,10 +5,10 @@ %ul.nav-links %li{class: ("active" if params[:state].blank? || params[:state] == 'pending')} = link_to dashboard_tasks_path(state: 'pending') do - Tasks (#{@pending_count}) + Tasks (#{tasks_pending_count}) %li{class: ("active" if params[:state] == 'done')} = link_to dashboard_tasks_path(state: 'done') do - Done (#{@done_count}) + Done (#{tasks_done_count}) .tasks - if @tasks.any? diff --git a/app/views/layouts/header/_default.html.haml b/app/views/layouts/header/_default.html.haml index fcb6b835a7e..d3aec9ae202 100644 --- a/app/views/layouts/header/_default.html.haml +++ b/app/views/layouts/header/_default.html.haml @@ -21,6 +21,10 @@ %li = link_to admin_root_path, title: 'Admin Area', data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do = icon('wrench fw') + %li + = link_to dashboard_tasks_path, title: 'Task Queue', data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do + %span.badge.tasks-pending-count + = tasks_pending_count - if current_user.can_create_project? %li = link_to new_project_path, title: 'New project', data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do @@ -39,4 +43,4 @@ = render 'shared/outdated_browser' - if @project && !@project.empty_repo? :javascript - var findFileURL = "#{namespace_project_find_file_path(@project.namespace, @project, @ref || @project.repository.root_ref)}"; \ No newline at end of file + var findFileURL = "#{namespace_project_find_file_path(@project.namespace, @project, @ref || @project.repository.root_ref)}";