incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [2/3] git commit: [#4703] ticket:539 Made 'related_artifacts' macro more verbose.
Date Thu, 20 Feb 2014 20:15:00 GMT
[#4703] ticket:539 Made 'related_artifacts' macro more verbose.

Made macro display list of artifacts sorted by project and tool names displaying these fields
as well.


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/761a191b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/761a191b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/761a191b

Branch: refs/heads/master
Commit: 761a191be38245871165dddce96ef622ee3cf8ac
Parents: 88cdedb
Author: Ferens Dmitriy <ferensdima@gmail.com>
Authored: Mon Feb 17 19:32:38 2014 +0200
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Thu Feb 20 15:38:57 2014 +0000

----------------------------------------------------------------------
 Allura/allura/model/artifact.py               | 2 +-
 Allura/allura/templates/jinja_master/lib.html | 9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/761a191b/Allura/allura/model/artifact.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/artifact.py b/Allura/allura/model/artifact.py
index d54a08e..cd8f5e2 100644
--- a/Allura/allura/model/artifact.py
+++ b/Allura/allura/model/artifact.py
@@ -193,7 +193,7 @@ class Artifact(MappedClass):
                     artifact.set_context(app.repo)
             if artifact not in related_artifacts and (getattr(artifact, 'deleted', False)
== False):
                 related_artifacts.append(artifact)
-        return related_artifacts
+        return sorted(related_artifacts, key=lambda a: a.url())
 
     def subscribe(self, user=None, topic=None, type='direct', n=1, unit='day'):
         """Subscribe ``user`` to the :class:`allura.model.notification.Mailbox`

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/761a191b/Allura/allura/templates/jinja_master/lib.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/lib.html b/Allura/allura/templates/jinja_master/lib.html
index 133eee8..700e409 100644
--- a/Allura/allura/templates/jinja_master/lib.html
+++ b/Allura/allura/templates/jinja_master/lib.html
@@ -35,7 +35,14 @@
     <h4>Related</h4>
     <p>
     {% for related in related_artifacts %}
-      <a href="{{related.url()}}">{{related.type_s}}: {{related.link_text()}}</a><br>
+      {% set project=related.app_config.project.name %}
+      {% set tool=related.app_config.tool_name %}
+      {% if project and tool %}
+        {% set prefix='%s [%s]' % (project, tool) %}
+      {% elif tool %}
+        {% set prefix='[%s]' % (tool,) %}
+      {% endif %}
+      <a href="{{related.url()}}">{{prefix}} {{related.type_s}}: {{related.link_text()}}</a><br>
     {% endfor %}
     </p>
   {% endif %}


Mime
View raw message