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

parent 77d7910b
...@@ -2,6 +2,16 @@ ...@@ -2,6 +2,16 @@
* Dashboard tasks queue * Dashboard tasks queue
* *
*/ */
.navbar-nav {
li {
.badge.tasks-pending-count {
background-color: #7f8fa4;
margin-top: -5px;
}
}
}
.tasks { .tasks {
.panel { .panel {
border-top: none; border-top: none;
......
...@@ -10,9 +10,6 @@ class Dashboard::TasksController < Dashboard::ApplicationController ...@@ -10,9 +10,6 @@ class Dashboard::TasksController < Dashboard::ApplicationController
end end
@tasks = @tasks.page(params[:page]).per(PER_PAGE) @tasks = @tasks.page(params[:page]).per(PER_PAGE)
@pending_count = current_user.tasks.pending.count
@done_count = current_user.tasks.done.count
end end
def destroy def destroy
......
...@@ -9,6 +9,14 @@ module TasksHelper ...@@ -9,6 +9,14 @@ module TasksHelper
end end
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) def task_action_name(task)
target = task.target_type.titleize.downcase target = task.target_type.titleize.downcase
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
%ul.nav-links %ul.nav-links
%li{class: ("active" if params[:state].blank? || params[:state] == 'pending')} %li{class: ("active" if params[:state].blank? || params[:state] == 'pending')}
= link_to dashboard_tasks_path(state: 'pending') do = link_to dashboard_tasks_path(state: 'pending') do
Tasks (#{@pending_count}) Tasks (#{tasks_pending_count})
%li{class: ("active" if params[:state] == 'done')} %li{class: ("active" if params[:state] == 'done')}
= link_to dashboard_tasks_path(state: 'done') do = link_to dashboard_tasks_path(state: 'done') do
Done (#{@done_count}) Done (#{tasks_done_count})
.tasks .tasks
- if @tasks.any? - if @tasks.any?
......
...@@ -21,6 +21,10 @@ ...@@ -21,6 +21,10 @@
%li %li
= link_to admin_root_path, title: 'Admin Area', data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do = link_to admin_root_path, title: 'Admin Area', data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do
= icon('wrench fw') = 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? - if current_user.can_create_project?
%li %li
= link_to new_project_path, title: 'New project', data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do = link_to new_project_path, title: 'New project', data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do
......
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