Commits

Tetsuya Morimoto  committed 9f436fb

changed the style of new ticket hyper-link with relationships
added ticket.css for ticket.html

  • Participants
  • Parent commits e73db06

Comments (0)

Files changed (5)

File ticketref/htdocs/ticket.css

+/* ticketref css for ticket.html */
+a.tref-link {
+    background: none repeat scroll 0 0 transparent;
+    border-style: dotted;
+    border-width: 1px;
+    font-size: .9em;
+    margin: 0 .2em;
+    padding: .1em;
+}

File ticketref/locale/ja/LC_MESSAGES/ticketref.mo

Binary file modified.

File ticketref/locale/ja/LC_MESSAGES/ticketref.po

 "Project-Id-Version: TracTicketReferencePlugin 0.1.0\n"
 "Report-Msgid-Bugs-To: http://trac-"
 "hacks.org/wiki/TracTicketReferencePlugin\n"
-"POT-Creation-Date: 2012-01-17 17:16+0900\n"
+"POT-Creation-Date: 2012-01-18 16:48+0900\n"
 "PO-Revision-Date: 2012-01-17 16:07+0900\n"
 "Last-Translator: Tetsuya Morimoto\n"
 "Language-Team: ja <LL@li.org>\n"
 msgid "Relationships"
 msgstr "関連"
 
-#: ticketref/web_ui.py:115
+#: ticketref/web_ui.py:118
 msgid "Open new ticket with relationships"
 msgstr "このチケットに関連付けて新しいチケットを登録する"
 
+#: ticketref/web_ui.py:120
+msgid "new"
+msgstr "登録"
+

File ticketref/locale/messages.pot

 "Project-Id-Version: TracTicketReferencePlugin 0.1.0\n"
 "Report-Msgid-Bugs-To: http://trac-"
 "hacks.org/wiki/TracTicketReferencePlugin\n"
-"POT-Creation-Date: 2012-01-17 17:16+0900\n"
+"POT-Creation-Date: 2012-01-18 16:48+0900\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
 msgid "Relationships"
 msgstr ""
 
-#: ticketref/web_ui.py:115
+#: ticketref/web_ui.py:118
 msgid "Open new ticket with relationships"
 msgstr ""
 
+#: ticketref/web_ui.py:120
+msgid "new"
+msgstr ""
+

File ticketref/web_ui.py

 
 from genshi.builder import tag
 from trac.core import *
-from trac.web.api import ITemplateStreamFilter
-from trac.web.chrome import ITemplateProvider
+from trac.web.api import IRequestFilter, ITemplateStreamFilter
+from trac.web.chrome import ITemplateProvider, add_stylesheet
 from trac.resource import ResourceNotFound
 from trac.ticket.model import Ticket
 from trac.util.text import shorten_line
 class TicketRefsTemplate(Component):
     """ Extend template for ticket cross-reference """
 
-    implements(ITemplateStreamFilter, ITemplateProvider)
+    implements(IRequestFilter, ITemplateProvider, ITemplateStreamFilter)
 
     def __init__(self):
         add_domain(self.env.path, resource_filename(__name__, "locale"))
                 new = self._link_new(req, ticket, field)
                 if ticket[TREF]:
                     field["rendered"] = self._link_refs(req, ticket[TREF])
-                    field["rendered"].append(", ")
+                    field["rendered"].append(" ")
                     field["rendered"].append(new)
                 else:
                     field["rendered"] = tag([new])
         for field in COPY_TICKET_FIELDS:
             if ticket[field]:
                 param[field] = ticket[field]
-        href = req.href.newticket(**param)
-        title = _("Open new ticket with relationships")
-        new_link = tag.a("+new", class_="", href=href, title=title)
-        return new_link
+        attr = {
+            "class_": "tref-link",
+            "target": "_blank",
+            "href": req.href.newticket(**param),
+            "title": _("Open new ticket with relationships"),
+        }
+        return tag.a(_("new"), **attr)
+
+    # IRequestFilter methods
+    def pre_process_request(self, req, handler):
+        return handler
+
+    def post_process_request(self, req, template, content_type):
+        return template, content_type
+
+    def post_process_request(self, req, template, data, content_type):
+        if template == "ticket.html":
+            add_stylesheet(req, "ticketref/ticket.css")
+        return template, data, content_type
 
     # ITemplateProvider methods
     def get_htdocs_dirs(self):