[extensions-web] errorreports: Merge "errors" and "comments" fields



commit f217af48db87bcd363e9210f97a79d62ce52174e
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Oct 26 13:28:35 2011 -0400

    errorreports: Merge "errors" and "comments" fields
    
    Rather than create a UI with two textboxes and confuse everyone, merge the two
    text fields and pre-fill the new one with a template comment for the user to
    fill in.

 .../0002_auto__del_field_errorreport_errors.py     |   98 ++++++++++++++++++++
 sweettooth/errorreports/models.py                  |    1 -
 .../templates/errorreports/report.html             |    5 +-
 sweettooth/errorreports/views.py                   |    6 -
 sweettooth/static/js/extensions.js                 |   19 ++--
 5 files changed, 110 insertions(+), 19 deletions(-)
---
diff --git a/sweettooth/errorreports/migrations/0002_auto__del_field_errorreport_errors.py b/sweettooth/errorreports/migrations/0002_auto__del_field_errorreport_errors.py
new file mode 100644
index 0000000..5ffaa08
--- /dev/null
+++ b/sweettooth/errorreports/migrations/0002_auto__del_field_errorreport_errors.py
@@ -0,0 +1,98 @@
+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        
+        # Deleting field 'ErrorReport.errors'
+        db.delete_column('errorreports_errorreport', 'errors')
+
+
+    def backwards(self, orm):
+        
+        # Adding field 'ErrorReport.errors'
+        db.add_column('errorreports_errorreport', 'errors', self.gf('django.db.models.fields.TextField')(default='', blank=True), keep_default=False)
+
+
+    models = {
+        'auth.group': {
+            'Meta': {'object_name': 'Group'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        'auth.permission': {
+            'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+        },
+        'auth.user': {
+            'Meta': {'object_name': 'User'},
+            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+        },
+        'contenttypes.contenttype': {
+            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+        },
+        'errorreports.errorreport': {
+            'Meta': {'object_name': 'ErrorReport'},
+            'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'blank': 'True', 'to': "orm['auth.User']"}),
+            'version': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['extensions.ExtensionVersion']"})
+        },
+        'extensions.extension': {
+            'Meta': {'object_name': 'Extension'},
+            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'creator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
+            'description': ('django.db.models.fields.TextField', [], {}),
+            'icon': ('django.db.models.fields.files.ImageField', [], {'default': "'/static/images/plugin.png'", 'max_length': '100', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+            'screenshot': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'blank': 'True'}),
+            'slug': ('autoslug.fields.AutoSlugField', [], {'unique_with': '()', 'max_length': '50', 'populate_from': 'None', 'db_index': 'True'}),
+            'url': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
+            'uuid': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200', 'db_index': 'True'})
+        },
+        'extensions.extensionversion': {
+            'Meta': {'unique_together': "(('extension', 'version'),)", 'object_name': 'ExtensionVersion'},
+            'extension': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'versions'", 'to': "orm['extensions.Extension']"}),
+            'extra_json_fields': ('django.db.models.fields.TextField', [], {}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'shell_versions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['extensions.ShellVersion']", 'symmetrical': 'False'}),
+            'source': ('django.db.models.fields.files.FileField', [], {'max_length': '223'}),
+            'status': ('django.db.models.fields.PositiveIntegerField', [], {}),
+            'version': ('django.db.models.fields.IntegerField', [], {'default': '0'})
+        },
+        'extensions.shellversion': {
+            'Meta': {'object_name': 'ShellVersion'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'major': ('django.db.models.fields.PositiveIntegerField', [], {}),
+            'minor': ('django.db.models.fields.PositiveIntegerField', [], {}),
+            'point': ('django.db.models.fields.IntegerField', [], {})
+        }
+    }
+
+    complete_apps = ['errorreports']
diff --git a/sweettooth/errorreports/models.py b/sweettooth/errorreports/models.py
index fda70e4..6edc99b 100644
--- a/sweettooth/errorreports/models.py
+++ b/sweettooth/errorreports/models.py
@@ -6,7 +6,6 @@ from extensions.models import ExtensionVersion
 
 class ErrorReport(models.Model):
     comment = models.TextField(blank=True)
-    errors = models.TextField(blank=True)
 
     # In the case that a user isn't logged in, they can supply an optional
     # email address for the extension author to reply to.
diff --git a/sweettooth/errorreports/templates/errorreports/report.html b/sweettooth/errorreports/templates/errorreports/report.html
index d64dc27..19f83bd 100644
--- a/sweettooth/errorreports/templates/errorreports/report.html
+++ b/sweettooth/errorreports/templates/errorreports/report.html
@@ -7,11 +7,8 @@
   any private information.</p>
 <form action="" method="POST" id="error_report">
   {% csrf_token %}
-  <h3> Detected errors with this extension </h3>
-  <input type="hidden" name="has_errors" value="">
-  <textarea name="error" id="error_log"></textarea>
 
-  <h3> Additional comments for the author </h3>
+  <h3> Comments for the author </h3>
   <textarea name="comment" id="comment"></textarea>
 
   {% if not request.user.is_authenticated %}
diff --git a/sweettooth/errorreports/views.py b/sweettooth/errorreports/views.py
index fcb80c4..8e34fb3 100644
--- a/sweettooth/errorreports/views.py
+++ b/sweettooth/errorreports/views.py
@@ -13,11 +13,6 @@ def report_error_view(request, obj):
     extension, version = obj.extension, obj
 
     if request.method == 'POST':
-        if request.POST['has_errors']:
-            errors = request.POST['error']
-        else:
-            errors = ""
-
         comment = request.POST['comment']
 
         if request.user.is_authenticated():
@@ -27,7 +22,6 @@ def report_error_view(request, obj):
 
         report = ErrorReport(version=version,
                              comment=comment,
-                             errors=errors,
                              user=user,
                              email=email)
         report.save()
diff --git a/sweettooth/static/js/extensions.js b/sweettooth/static/js/extensions.js
index 58c930f..d6d1b35 100644
--- a/sweettooth/static/js/extensions.js
+++ b/sweettooth/static/js/extensions.js
@@ -225,18 +225,21 @@ function($, messages, dbusProxy) {
 
     $.fn.fillInErrors = function (uuid) {
         var $form = $(this);
-        var $textarea = $form.find('textarea[name=error]');
-        var $hidden = $form.find('input:hidden[name=has_errors]');
+        var $textarea = $form.find('textarea');
         dbusProxy.GetErrors(uuid).done(function(errors) {
+            var errorString;
+
             if (errors && errors.length) {
-                $textarea.text(errors.join('\n\n')).
-                    removeClass('no-errors').removeAttr('disabled');
-                $hidden.val('true');
+                errorString = errors.join('\n\n================\n\n');
             } else {
-                $textarea.text("Could not detect any errors").
-                    addClass('no-errors').attr('disabled', 'disabled');
-                $hidden.val('');
+                errorString = "GNOME Shell Extensions did not detect any errors with this extension.";
             }
+
+            var template = ("What's wrong?\n\n\n" +
+                            "What have I tried?\n\n\n" +
+                            "Automatically detected errors:\n\n" + errorString);
+
+            $textarea.text(template);
         });
     };
 



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