Add pending tasks badge on top right next to the new and logout button

parent 77d7910b
......@@ -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;
......
......@@ -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
......
......@@ -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
......
......@@ -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?
......
......@@ -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)}";
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment