[damned-lies] Updated team_detail JS code to ease resolving #710062



commit b69489143195b9b481a0008c933b168432eea52f
Author: Claude Paroz <claude 2xlibre net>
Date:   Tue Oct 29 18:09:42 2013 +0100

    Updated team_detail JS code to ease resolving #710062

 templates/teams/team_detail.html |   40 +++++++++++++++++++-------------------
 1 files changed, 20 insertions(+), 20 deletions(-)
---
diff --git a/templates/teams/team_detail.html b/templates/teams/team_detail.html
index 6985f4a..f831fe6 100644
--- a/templates/teams/team_detail.html
+++ b/templates/teams/team_detail.html
@@ -7,27 +7,26 @@
       title="{% blocktrans with team.get_description as lang %}Last actions made by the {{ lang }} team of 
the GNOME Translation Project{% endblocktrans %}"
       href="/rss/teams/{{ team.name }}" />
 
+<style>img.toggler { cursor: pointer; }</style>
 <script type="text/javascript">
 $(document).ready(function() {
-        $(".archives").click(function(event) {
-            event.preventDefault();
-            arch_div = $("#div-rel-archives-"+this.id);
-            is_visible = arch_div.is(':visible');
-            if (is_visible) {
-                arch_div.hide();
-                $(this).children('img').attr("src", "{{ STATIC_URL }}img/closed.png");
-            } else {
-                if (arch_div.attr("class") == "empty") {
-                    // Load the archive stats dynamically
-                    arch_div.load("/languages/"+this.id.replace('__','@')+"/rel-archives/");
-                    arch_div.attr("class", "loaded");
-                }
-                arch_div.show();
-                $(this).children('img').attr("src", "{{ STATIC_URL }}img/open.png");
+    $("img.toggler").click(function(event) {
+        event.preventDefault();
+        var target_div = $("#togglable-" + this.id);
+        if (target_div.is(':visible')) {
+            target_div.hide();
+            $(this).children('img').attr("src", "{{ STATIC_URL }}img/closed.png");
+        } else {
+            if (target_div.attr("class") == "empty") {
+                // Load the archive stats dynamically
+                target_div.load(target_div.data('url'));
+                target_div.attr("class", "loaded");
             }
-        });
-    }
-);
+            target_div.show();
+            $(this).children('img').attr("src", "{{ STATIC_URL }}img/open.png");
+        }
+    });
+});
 </script>
 {% endblock %}
 
@@ -71,8 +70,9 @@ $(document).ready(function() {
 
     <p><strong>{% trans "Plural forms:" %}</strong> {{ lang.get_plurals }}</p>
 
-    <h3><a href="." class="archives" id="{{ lang.locale|escapeat }}"><img alt="{% trans 'Show/hide archived 
translations' %}" src="{{ STATIC_URL }}img/closed.png" /></a>&nbsp;{% trans "Archives" %}</h3>
-    <div id="div-rel-archives-{{ lang.locale|escapeat }}" class="empty" style="display:none;"></div>
+    <h3><img class="toggler" id="{{ lang.locale|escapeat }}" title="{% trans 'Show/hide archived 
translations' %}" src="{{ STATIC_URL }}img/closed.png" />&nbsp;{% trans "Archives" %}</h3>
+    <div id="togglable-{{ lang.locale|escapeat }}" class="empty" style="display:none;"
+         data-url="{% url 'language_release_archives' lang.locale %}"></div>
 
 {% endfor %}
 


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