- Legacy-Id: 8051
This commit is contained in:
parent
8326a5a85e
commit
00f6bb6023
|
@ -1,10 +1,19 @@
|
|||
from django.contrib import admin
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
from ietf.liaisons.models import LiaisonStatement
|
||||
|
||||
|
||||
class LiaisonStatementAdmin(admin.ModelAdmin):
|
||||
list_display = ['id', 'title', 'from_name', 'to_name', 'submitted', 'purpose', 'related_to']
|
||||
list_display_links = ['id', 'title']
|
||||
ordering = ('title', )
|
||||
raw_id_fields = ('from_contact', 'related_to', 'from_group', 'to_group', 'attachments')
|
||||
raw_id_fields = ('from_contact', 'attachments')
|
||||
filter_horizontal = ('from_groups', 'to_groups')
|
||||
|
||||
def related_to(self, obj):
|
||||
return '<br />'.join(['<a href="%s">%s</a>' % (reverse('admin:liaisons_liaisonstatement_change', None, (i.target.id, )), str(i.target)) for i in obj.source_of_set.select_related('target').all()])
|
||||
related_to.allow_tags = True
|
||||
|
||||
|
||||
admin.site.register(LiaisonStatement, LiaisonStatementAdmin)
|
||||
|
|
|
@ -497,6 +497,7 @@ class SearchLiaisonForm(forms.Form):
|
|||
results = LiaisonStatement.objects.filter(state__slug='approved').extra(
|
||||
select={
|
||||
'_submitted': 'SELECT time FROM liaisons_liaisonstatementevent WHERE liaisons_liaisonstatement.id = liaisons_liaisonstatementevent.statement_id AND liaisons_liaisonstatementevent.type_id = "submit"',
|
||||
'_awaiting_action': 'SELECT count(*) FROM liaisons_liaisonstatement_tags WHERE liaisons_liaisonstatement.id = liaisons_liaisonstatement_tags.liaisonstatement_id AND liaisons_liaisonstatement_tags.liaisonstatementtagname_id = "required"',
|
||||
'from_concat': 'SELECT GROUP_CONCAT(name SEPARATOR ", ") FROM group_group JOIN liaisons_liaisonstatement_from_groups WHERE liaisons_liaisonstatement.id = liaisons_liaisonstatement_from_groups.liaisonstatement_id AND liaisons_liaisonstatement_from_groups.group_id = group_group.id',
|
||||
'to_concat': 'SELECT GROUP_CONCAT(name SEPARATOR ", ") FROM group_group JOIN liaisons_liaisonstatement_to_groups WHERE liaisons_liaisonstatement.id = liaisons_liaisonstatement_to_groups.liaisonstatement_id AND liaisons_liaisonstatement_to_groups.group_id = group_group.id',
|
||||
})
|
||||
|
|
|
@ -69,6 +69,12 @@ class LiaisonStatement(models.Model):
|
|||
def action_taken(self):
|
||||
return bool(self.tags.filter(slug='taken').count())
|
||||
|
||||
@property
|
||||
def awaiting_action(self):
|
||||
if getattr(self, '_awaiting_action', None) != None:
|
||||
return bool(self._awaiting_action)
|
||||
return bool(self.tags.filter(slug='awaiting').count())
|
||||
|
||||
|
||||
class LiaisonStatementAttachments(models.Model):
|
||||
statement = models.ForeignKey(LiaisonStatement)
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if liaison.awaiting_action %}<span class="awaiting">Action needed</span>{% endif %}
|
||||
{{ liaison.deadline|default:"-"|date:"Y-m-d" }}
|
||||
</td>
|
||||
<td>
|
||||
|
|
|
@ -38,8 +38,25 @@
|
|||
<script type="text/javascript">
|
||||
$(document).ready(function()
|
||||
{
|
||||
var widgetIETF = {css: ["evenrow", "oddrow"]};
|
||||
$.tablesorter.addWidget({
|
||||
id: "ietf",
|
||||
format: function(table) {
|
||||
var $tr, row = -1, odd;
|
||||
$("tr:visible", table.tBodies[0]).each(function (i) {
|
||||
$tr = $(this);
|
||||
if (!$tr.hasClass(table.config.cssChildRow)) row++;
|
||||
odd = (row % 2 == 0);
|
||||
$tr.removeClass(
|
||||
widgetIETF.css[odd ? 0 : 1]).addClass(
|
||||
widgetIETF.css[odd ? 1 : 0])
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$("#LiaisonListTable").tablesorter({
|
||||
sortList: [[0, 1]]
|
||||
sortList: [[0, 1]],
|
||||
widgets: ["ietf"]
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
|
@ -104,6 +104,16 @@ th.headerSortDown {
|
|||
background-image: url(/images/sort-header-filled.png);
|
||||
}
|
||||
|
||||
td span.awaiting {
|
||||
background-color: #ffcc33;
|
||||
border-radius: 3px;
|
||||
float: right;
|
||||
width: 35px;
|
||||
padding: 4px 8px;
|
||||
text-align: center;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.noActionTaken, .actionTaken { padding: 2px 5px; }
|
||||
.actionTaken { border: 1px solid green; background-color: #ccffbb; }
|
||||
.noActionTaken { border: 1px solid red; background-color: #ffccbb; }
|
||||
|
|
Loading…
Reference in a new issue