Skip to content
This repository has been archived by the owner on Oct 28, 2020. It is now read-only.

Commit

Permalink
[fix bug 1070902][fix bug 1055647] Display action items of the Reps d…
Browse files Browse the repository at this point in the history
…ashboard.

* Static template for the action items.
  • Loading branch information
akatsoulas committed Oct 24, 2014
1 parent 465829d commit 840e921
Show file tree
Hide file tree
Showing 6 changed files with 274 additions and 28 deletions.
63 changes: 61 additions & 2 deletions remo/base/static/base/css/app-fd4.less
Original file line number Diff line number Diff line change
Expand Up @@ -3231,12 +3231,12 @@ table tr.assigned-request:nth-of-type(2n) {
}

#dashboard-continuous-reports-mine-block,
#dashboard-action-items-mine-block,
.dashboard-stats-activities-block {
table {
text-align: center;
td {
font-weight: bold;
font-size: 16px;
line-height: 1.7;
.date-range {
.grayed;
Expand All @@ -3261,7 +3261,8 @@ table tr.assigned-request:nth-of-type(2n) {
}

@media only screen and (max-width: @breakSmall) {
#dashboard-continuous-reports-mine-block {
#dashboard-continuous-reports-mine-block,
#dashboard-action-items-mine-block {
td .date-range {
display: none;
}
Expand All @@ -3270,13 +3271,18 @@ table tr.assigned-request:nth-of-type(2n) {

#dashboard-continuous-reports-mine-block,
#dashboard-continuous-reports-mentees-block,
#dashboard-action-items-mine-block,
#dashboard-action-items-mentees-block,
#dashboard-continuous-reports-all-block {
margin-bottom: 20px;
table {
margin-bottom: 10px;
}
}

#dashboard-action-items-mentees-block,
#dashboard-action-items-mine-block,
#dashboard-continuous-reports-mine-block,
#dashboard-continuous-reports-mentees-block,
.dashboard-continuous-reports-mozillians-unavailable {
.inactive-high a {
Expand All @@ -3297,6 +3303,21 @@ table tr.assigned-request:nth-of-type(2n) {
color: darken(#808080, 20%);
}
}
.priority-minor {
color: #6495ed;
}
.priority-normal {
color: #228b22;
}
.priority-major {
color: #808080;
}
.priority-critical {
color: #f68b01;
}
.priority-blocker {
color: #ff0000;
}
}

.inactive-reference,
Expand Down Expand Up @@ -3337,6 +3358,44 @@ table tr.assigned-request:nth-of-type(2n) {
}
}

.dashboard-priority-reference {
float: left;

ul {
list-style: none;
li {
position: relative;
font-size: 12px;
text-indent: 12px;
}
}
li, p {
&.dashboard-priority-minor:before {
background-color: #6495ed;
}
&.dashboard-priority-normal:before {
background-color: #228b22;
}
&.dashboard-priority-major:before {
background-color: #808080;
}
&.dashboard-priority-critical:before {
background-color: #f68b01;
}
&.dashboard-priority-blocker:before {
background-color: #ff0000;
}
&:before {
position: absolute;
top: 6px;
left: 0;
content: '';
width: 8px;
height: 8px;
}
}
}

.unavailable-reports-mozillians:before {
.pictogram;
content: "!";
Expand Down
28 changes: 27 additions & 1 deletion remo/base/static/base/js/dashboard.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
$(document).ready(function () {
'use strict';

// Continuouis reports containers
// Action Items containers
var $action_items_mine_block = $('#dashboard-action-items-mine-block');
var $action_items_mentees_block = $('#dashboard-action-items-mentees-block');

// Action Items buttons
var $action_items_mine_button = $('#dashboard-action-items-mine-button');
var $action_items_mentees_button = $('#dashboard-action-items-mentees-button');

// Continuous reports containers
var $cont_reports_mine_block = $('#dashboard-continuous-reports-mine-block');
var $cont_reports_mentees_block = $('#dashboard-continuous-reports-mentees-block');
var $cont_reports_all_block = $('#dashboard-continuous-reports-all-block');
Expand Down Expand Up @@ -31,6 +39,24 @@ $(document).ready(function () {
var $sr_all_block = $('#dashboard-sr-all-block');
var $sr_my_block = $('#dashboard-sr-my-block');

$action_items_mine_button.on('click', function (e) {
e.preventDefault();
$action_items_mine_block.show('fast');
$action_items_mentees_block.hide('fast');

$(this).parent().addClass('active');
$action_items_mentees_button.parent().removeClass('active');
});

$action_items_mentees_button.on('click', function (e) {
e.preventDefault();
$action_items_mentees_block.show('fast');
$action_items_mine_block.hide('fast');

$(this).parent().addClass('active');
$action_items_mine_button.parent().removeClass('active');
});

$cont_reports_mine_button.on('click', function (e) {
e.preventDefault();
$cont_reports_mine_block.show('fast');
Expand Down
23 changes: 23 additions & 0 deletions remo/dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
from django.db import models
from django.db.models.signals import post_save


Item = namedtuple('Item', ['name', 'user', 'priority', 'due_date'])
BUGZILLA_URL = 'https://bugzilla.mozilla.org/show_bug.cgi?id='


class ActionItem(models.Model):
Expand Down Expand Up @@ -38,6 +40,27 @@ class ActionItem(models.Model):
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey('content_type', 'object_id')

def get_absolute_url(self):
from remo.events.models import Event
from remo.remozilla.models import Bug
from remo.reports.models import NGReport
from remo.voting.models import Poll
ctype = self.content_type

if ctype.app_label == 'remozilla' and ctype.model == 'bug':
bug = Bug.objects.get(pk=self.object_id)
url = BUGZILLA_URL + '{0}'.format(bug.bug_id)
return url
elif ctype.app_label == 'voting' and ctype.model == 'poll':
poll = Poll.objects.get(pk=self.object_id)
return poll.get_absolute_url()
elif ctype.app_label == 'events' and ctype.model == 'event':
event = Event.objects.get(pk=self.object_id)
return event.get_absolute_url()
elif ctype.app_label == 'reports' and ctype.model == 'ngreport':
report = NGReport.objects.get(pk=self.object_id)
return report.get_absolute_url()

class Meta:
ordering = ['-due_date', '-updated_on', '-created_on']
unique_together = ('name', 'user', 'object_id')
Expand Down
173 changes: 154 additions & 19 deletions remo/dashboard/templates/dashboard_reps.html
Original file line number Diff line number Diff line change
@@ -1,30 +1,165 @@
{% extends "dashboard.html" %}

{% block body_content %}
<!-- Post event metrics notifications -->
{% if owned_events %}
<!-- Action Items Section -->
<div class="dashboard-box">
<div class="row">
<div class="large-12 columns">
<h2>Notifications</h2>
<div class="large-7 columns">
<h2>Action Items</h2>
</div>
</div>
<div class="row">
<div class="large-12 columns post-event-notifications">
<p>
Looks like you need to add the actual metrics for your recent event(s)
<p>
<ul>
{% for event in owned_events %}
<li>
<a href="{{ url('events_edit_event', slug=event.slug) }}">
{{ event.name }}
<div class="large-5 columns">
<dl class="sub-nav dashboard-filter">
<dt>Filter:</dt>
<dd class="active">
<a role="button" id="dashboard-action-items-mine-button" href="#">
Mine
</a>
</dd>
{% if mentees_action_items %}
<dd>
<a role="button" id="dashboard-action-items-mentees-button" href="#">
My mentees
</a>
</li>
{% endfor %}
</ul>
</dd>
{% endif %}
</dl>
</div>
</div>
{% endif %}

<div class="row">
<!-- my block -->
{% if action_items %}
<div id="dashboard-action-items-mine-block" class="large-12 columns">
<table class="dashboard-table responsive">
<thead>
<tr>
<th>Summary</th>
<th>Expires</th>
<th>Priority</th>
</tr>
</thead>
<tbody>
{% cache action_items %}
{% for action_item in action_items %}
<tr>
<td>
<a href="{{ action_item.get_absolute_url() }}">{{ action_item }}</a>
</td>
<td>
{% if action_item.due_date %}
<span class="date-range">
{{ action_item.due_date|strftime('%d %b %Y') }}
</span>
{% endif %}
</td>
<td class="priority-{{ action_item.get_priority_display()|lower }}">
{{ action_item.get_priority_display() }}
</td>
</tr>
{% endfor %}
{% endcache %}
</tbody>
</table>
<div class="dashboard-priority-reference">
<ul>
<li class="dashboard-priority-minor">
Minor
</li>
<li class="dashboard-priority-normal">
Normal
</li>
<li class="dashboard-priority-major">
Major
</li>
<li class="dashboard-priority-critical">
Critical
</li>
<li class="dashboard-priority-blocker">
Blocker
</li>
</ul>
</div>
<div class="align-right">
<a href="#" role="button" class="small button">
View my action items
</a>
</div>
</div>
{% else %}
<div class="large-12 columns reports-found">
<p>Congratulations! No Action Items found!</p>
</div>
{% endif %}
<!-- end my block -->

<!-- mentees block -->
{% if mentees_action_items %}
<div id="dashboard-action-items-mentees-block" class="large-12 columns hidden">
<table class="dashboard-table responsive">
<thead>
<tr>
<th>Name</th>
<th>Summary</th>
<th>Expires</th>
<th>Priority</th>
</tr>
</thead>
<tbody>
{% cache mentees_action_items %}
{% for action_item in mentees_action_items %}
<tr>
<td>
<a href="{{ url('profiles_view_profile',
action_item.user|get_display_name) }}">
{{ action_item.user.get_full_name() }}
</td>
<td>
<a href="{{ action_item.get_absolute_url() }}">{{ action_item }}</a>
</td>
<td>
{% if action_item.due_date %}
<span class="date-range">
{{ action_item.due_date|strftime('%d %b %Y') }}
</span>
{% endif %}
</td>
<td class="priority-{{ action_item.get_priority_display()|lower }}">
{{ action_item.get_priority_display() }}
</td>
</tr>
{% endfor %}
{% endcache %}
</tbody>
</table>
<div class="dashboard-priority-reference">
<ul>
<li class="dashboard-priority-minor">
Minor
</li>
<li class="dashboard-priority-normal">
Normal
</li>
<li class="dashboard-priority-major">
Major
</li>
<li class="dashboard-priority-critical">
Critical
</li>
<li class="dashboard-priority-blocker">
Blocker
</li>
</ul>
</div>
<div class="align-right">
<a href="#" role="button" class="small button">
Mentees action items
</a>
</div>
</div>
{% endif %}
<!-- end mentees block -->
</div>
</div>

<!-- continuous reports block -->
<div class="dashboard-box">
Expand Down

0 comments on commit 840e921

Please sign in to comment.