[view] add ticket icon in primary view title too (closes #1484254, #999610)

This introduce a clear visual distinction between different type and priority of ticket in primary view. The textual information stay for clarify and edition purpose.

The ticket icons use the same CSS mechanism used for incontext view.

authorPierre-Yves David <pierre-yves.david@logilab.fr>
changesetdd195e53fa72
branchdefault
phasepublic
hiddenno
parent revision#52dbac323d29 Added tag cubicweb-tracker-debian-version-1.12.1-1 for changeset 2efa498a6d21
child revision#c03dde161692 Move __permissions__ from relation types onto relation definitions.
files modified by this revision
views/ticket.py
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@logilab.fr>
# Date 1369302668 -7200
# Thu May 23 11:51:08 2013 +0200
# Node ID dd195e53fa726d24b209128a6e7cc5a5289ab8c3
# Parent 52dbac323d29316665534259bdb73b92495c5278
[view] add ticket icon in primary view title too (closes #1484254, #999610)

This introduce a clear visual distinction between different type and priority of
ticket in primary view. The textual information stay for clarify and edition
purpose.

The ticket icons use the same CSS mechanism used for ``incontext`` view.

diff --git a/views/ticket.py b/views/ticket.py
@@ -37,15 +37,17 @@
1      """
2      __select__ = primary.PrimaryView.__select__ & is_instance('Ticket')
3 
4      def render_entity_title(self, entity):
5          self._cw.add_css('cubes.tracker.css')
6 -        self.w(u'<h1>%s %s<span class="state"> [%s]</span></h1>'
7 -               % (xml_escape(entity.project.name),
8 -                  xml_escape(entity.dc_title()),
9 -                  xml_escape(self._cw._(entity.cw_adapt_to('IWorkflowable').state))))
10 -
11 +        self.w(u'<h1 class="%s ticket_%s">' % (entity.priority, entity.type))
12 +        self.w(xml_escape(entity.project.name))
13 +        self.w(u' ')
14 +        self.w(xml_escape(entity.dc_title()))
15 +        i18nstate = self._cw._(entity.cw_adapt_to('IWorkflowable').state)
16 +        self.w(u'<span class="state"> [%s]</span>' % xml_escape(i18nstate))
17 +        self.w(u'</h1>')
18 
19  # pluggable sections ###########################################################
20 
21  _pvs.tag_object_of(('*', 'identical_to', 'Ticket'), 'hidden')
22  _pvs.tag_subject_of(('Ticket', 'identical_to', '*'), 'hidden')