[extensions-web] Remove the document-ready handler for error reports



commit e142afc58b953f0d2932741e29235ceee4599160
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sun Nov 13 22:57:04 2011 -0500

    Remove the document-ready handler for error reports

 .../templates/errorreports/report.html             |    8 +-------
 sweettooth/static/js/extensions.js                 |    4 ++--
 sweettooth/static/js/main.js                       |    1 +
 3 files changed, 4 insertions(+), 9 deletions(-)
---
diff --git a/sweettooth/errorreports/templates/errorreports/report.html b/sweettooth/errorreports/templates/errorreports/report.html
index 446ec16..9b5fabc 100644
--- a/sweettooth/errorreports/templates/errorreports/report.html
+++ b/sweettooth/errorreports/templates/errorreports/report.html
@@ -4,7 +4,7 @@
 <h2><em>{{ version.extension.name }}</em> is malfunctioning?</h2>
 
 <p>Please look through the information below and edit out any unwanted information.</p>
-<form action="" method="POST" id="error_report">
+<form action="" method="POST" id="error_report" data-uuid="{{ version.extension.uuid }}">
   {% csrf_token %}
 
   <h3> Comments for the author </h3>
@@ -19,10 +19,4 @@
 
 {% endblock %}
 
-{% block document-ready %}
-require(['jquery', 'extensions'], function($) {
-    $("#error_report").fillInErrors("{{ version.extension.uuid }}");
-});
-{% endblock %}
-
 {% block navclass %}main{% endblock %}
diff --git a/sweettooth/static/js/extensions.js b/sweettooth/static/js/extensions.js
index 648c6fc..11050f5 100644
--- a/sweettooth/static/js/extensions.js
+++ b/sweettooth/static/js/extensions.js
@@ -226,10 +226,10 @@ function($, messages, dbusProxy) {
         });
     };
 
-    $.fn.fillInErrors = function (uuid) {
+    $.fn.fillInErrors = function () {
         var $form = $(this);
         var $textarea = $form.find('textarea');
-        dbusProxy.GetErrors(uuid).done(function(errors) {
+        dbusProxy.GetErrors($form.data('uuid')).done(function(errors) {
             var errorString;
 
             if (errors && errors.length) {
diff --git a/sweettooth/static/js/main.js b/sweettooth/static/js/main.js
index 76397b7..89da7af 100644
--- a/sweettooth/static/js/main.js
+++ b/sweettooth/static/js/main.js
@@ -90,6 +90,7 @@ require(['jquery', 'messages',
         });
 
         $('#local_extensions').addLocalExtensions();
+        $('#error_report').fillInErrors();
 
         if (window._SW)
             try {



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