[damned-lies] Prevent a JavaScript ReferenceError



commit 528455b628c57cd18a9e0051a55cb685af76febf
Author: Gil Forcada <gforcada gnome org>
Date:   Fri Apr 26 16:01:15 2013 +0200

    Prevent a JavaScript ReferenceError
    
    On translation teams that do not use vertimus workflows
    'send_mail_defaults' JavaScript variable isn't defined.

 templates/vertimus/vertimus_detail.html |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/templates/vertimus/vertimus_detail.html b/templates/vertimus/vertimus_detail.html
index 36ef48b..e2d4cec 100644
--- a/templates/vertimus/vertimus_detail.html
+++ b/templates/vertimus/vertimus_detail.html
@@ -11,10 +11,12 @@
 <script type="text/javascript">
 $(document).ready(function() {
     $("#id_comment").growfield();
-    $("#id_send_to_ml").attr('checked', send_mail_defaults[$("#id_action").val()]);
-    $("#id_action").change(function () {
-      $("#id_send_to_ml").attr('checked', send_mail_defaults[$(this).val()]);
-    });
+    if(typeof send_mail_defaults == 'undefined') {
+      $("#id_send_to_ml").attr('checked', send_mail_defaults[$("#id_action").val()]);
+      $("#id_action").change(function () {
+        $("#id_send_to_ml").attr('checked', send_mail_defaults[$(this).val()]);
+      });
+    }
 });
 </script>
 {% endblock %}


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