[damned-lies] Display a warning when a branch is not linked from any release



commit 957d4baac2e9235d273e38c4932278e8af80b2e3
Author: Claude Paroz <claude 2xlibre net>
Date:   Mon Mar 8 22:01:01 2010 +0100

    Display a warning when a branch is not linked from any release

 stats/models.py              |    5 +++++
 templates/module_detail.html |    3 +++
 2 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/stats/models.py b/stats/models.py
index 8311998..71f5a17 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -196,6 +196,11 @@ class Branch(models.Model):
     def is_head(self):
         return self.name in BRANCH_HEAD_NAMES
 
+    def warnings(self):
+        if self.releases.count() < 1:
+            return _(u"This branch is not linked from any release")
+        return ""
+
     def has_string_frozen(self):
         """ Returns true if the branch is contained in at least one string frozen release """
         return self.releases.filter(string_frozen=True).count() and True or False
diff --git a/templates/module_detail.html b/templates/module_detail.html
index bf87654..c550446 100644
--- a/templates/module_detail.html
+++ b/templates/module_detail.html
@@ -78,6 +78,9 @@ $(document).ready(function() {
   {% for branch in branches %}
     {% ifnotequal forloop.counter 1 %} - {% endifnotequal %}
     <a href="#{{ branch.name }}">{{ branch.name }}</a>
+    {% if branch.warnings %}
+    <img src="{{ MEDIA_URL }}img/warn.png" title="{{ branch.warnings }}" />
+    {% endif %}
   {% endfor %}
   {% if can_edit_branches %}
     <a href="{% url stats.views.module_edit_branches module_name=module.name %}"><img src="{{ MEDIA_URL }}img/edit.png" alt="Edit" /></a>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]