From 0b1ecdacb4efde2e5512c035535285c1d5d34e25 Mon Sep 17 00:00:00 2001 From: magsout Date: Sat, 3 Jan 2015 11:59:26 +0100 Subject: [PATCH 01/16] Issue #432 - New form position --- webcompat/form.py | 2 +- webcompat/templates/form.html | 83 ++++++++++++----------------------- 2 files changed, 28 insertions(+), 57 deletions(-) diff --git a/webcompat/form.py b/webcompat/form.py index 763db3c9f..27e46a08c 100644 --- a/webcompat/form.py +++ b/webcompat/form.py @@ -48,7 +48,7 @@ class IssueForm(Form): [Required(message=summary_message)]) username = StringField(u'Username', [Length(max=0, message=username_message)]) - description = TextAreaField(u'How can we replicate this?', [Optional()], + description = TextAreaField(u'Give more details (optional)', [Optional()], default=desc_default) site_owner = RadioField(u'Is this your website?', [Optional()], choices=owner_choices) diff --git a/webcompat/templates/form.html b/webcompat/templates/form.html index 314c3c6fe..2d52138fb 100644 --- a/webcompat/templates/form.html +++ b/webcompat/templates/form.html @@ -1,65 +1,36 @@
-
-
-
-
- {{ form.url.label(class_='u-formLabel') }} - {% if form.url.errors %}{% for error in form.url.errors %} - {{ error }} - {% endfor %}{% endif %} - - {{ form.url(class_='u-formInput required', - placeholder='e.g., http://www.example.com', - required=True, type='url', pattern='') }} - + +
+
+
+ What seems to be the trouble? + {% for subradio in form.problem_category %} +
+ {{ subradio }} {{ subradio.label }} +
+ {% endfor %} +
-
-
-
- {{ form.summary.label(class_='u-formLabel') }}{% if form.summary.errors %}{% for error in form.summary.errors %} - {{ error }} - {% endfor %}{% endif %} - - {{ form.summary(class_='u-formInput required', - placeholder='e.g., Website images are upside down', required=True) }} - -
-
-
-
-
-
- Is this your site? - {% for subradio in form.site_owner %} -
- {{ subradio }} {{ subradio.label }} +
+
+ {{ form.url.label(class_='u-formLabel') }} + {% if form.url.errors %}{% for error in form.url.errors %} + {{ error }} + {% endfor %}{% endif %} + + {{ form.url(class_='u-formInput required', + placeholder='e.g., http://www.example.com', + required=True, type='url', pattern='') }} +
- {% endfor %} -
-
-
-
- What seems to be the trouble? - {% for subradio in form.problem_category %} -
- {{ subradio }} {{ subradio.label }} +
+ {{ form.browser.label(class_='u-formLabel') }} {{ form.browser(class_='u-formInput') }} +
+
+ {{ form.os.label(class_='u-formLabel') }} {{ form.os(class_='u-formInput') }}
- {% endfor %} -
-
-
-
-
-
- {{ form.browser.label(class_='u-formLabel') }} {{ form.browser(class_='u-formInput') }} -
-
-
-
- {{ form.os.label(class_='u-formLabel') }} {{ form.os(class_='u-formInput') }}
-
From 458b934a9ea5a71463b5af075de7ba31db67f73c Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Wed, 4 Mar 2015 16:57:02 -0600 Subject: [PATCH 02/16] Issue #432 - Add new bug choices --- webcompat/form.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/webcompat/form.py b/webcompat/form.py index 27e46a08c..8868cecf7 100644 --- a/webcompat/form.py +++ b/webcompat/form.py @@ -23,9 +23,14 @@ SCHEMES = ('http://', 'https://') owner_choices = [(u'True', u'Yes'), (u'False', u'No')] -problem_choices = [(u'browser_bug', u'Looks like the browser has a bug'), - (u'site_bug', u'Looks like the website has a bug.'), - (u'unknown_bug', u'Don\'t know but something\'s wrong.')] +problem_choices = [ + (u'detection_bug', u'Desktop site instead of mobile site'), + (u'mobile_site_bug', u'Mobile site is not usable'), + (u'video_bug', u'Video does\'nt play'), + (u'layout_bug', u'Layout is messed up'), + (u'text_bug', u'Text is not visible'), + (u'unknown_bug', u'Somethign else - I\'ll add details below') +] url_message = u'A URL is required.' summary_message = u'Please give a summary.' username_message = u'A valid username must be {0} characters long'.format( From 859c1f808e070627c37cb58f681bc987768a5a45 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Wed, 4 Mar 2015 17:09:01 -0600 Subject: [PATCH 03/16] Issue #432 - Remove owner related code from form (and use named arguments in the description of build_formdata) --- webcompat/form.py | 42 ++++++++++++++---------------------------- 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/webcompat/form.py b/webcompat/form.py index 8868cecf7..b07211f89 100644 --- a/webcompat/form.py +++ b/webcompat/form.py @@ -22,7 +22,6 @@ PROXY_REPORT = 'github-proxy-report' SCHEMES = ('http://', 'https://') -owner_choices = [(u'True', u'Yes'), (u'False', u'No')] problem_choices = [ (u'detection_bug', u'Desktop site instead of mobile site'), (u'mobile_site_bug', u'Mobile site is not usable'), @@ -55,8 +54,6 @@ class IssueForm(Form): [Length(max=0, message=username_message)]) description = TextAreaField(u'Give more details (optional)', [Optional()], default=desc_default) - site_owner = RadioField(u'Is this your website?', [Optional()], - choices=owner_choices) problem_category = RadioField(u'What seems to be the trouble?', [Optional()], choices=problem_choices) @@ -70,16 +67,6 @@ def get_problem(category): return u'Unknown' -def get_owner(is_site_owner): - '''Return human-readable language (Y/N) for site owner form value.''' - if is_site_owner == 'True': - return u'Yes' - elif is_site_owner == 'False': - return u'No' - else: - return u'Unknown' - - def wrap_label(label): '''Helper method to wrap a label and its type in an HTML comment. @@ -132,7 +119,6 @@ def build_formdata(form_object): URL -> part of body Description -> part of body Category -> labels - Owner -> labels We'll try to parse the Browser and come up with a browser label, as well as labels like mobile, desktop, tablet. @@ -160,22 +146,22 @@ def build_formdata(form_object): else: summary = '{0}'.format(form_object.get('summary')) # Preparing the body - body = u'''{0}{1} -**URL**: {2} -**Browser / Version**: {3} -**Operating System**: {4} -**Problem type**: {5} -**Site owner**: {6} + body = u'''{browser_label}{ua_label} +**URL**: {url} +**Browser / Version**: {browser} +**Operating System**: {os} +**Problem type**: {problem_type} **Steps to Reproduce** -{7}'''.format(get_labels(form_object.get('browser')), - wrap_label(('ua_header', form_object.get('ua_header'))), - form_object.get('url'), - form_object.get('browser'), - form_object.get('os'), - get_problem(form_object.get('problem_category')), - get_owner(form_object.get('site_owner')), - form_object.get('description')) +{description}'''.format( + browser_label=get_labels(form_object.get('browser')), + ua_label=wrap_label(('ua_header', form_object.get('ua_header'))), + url=form_object.get('url'), + browser=form_object.get('browser'), + os=form_object.get('os'), + problem_type=get_problem(form_object.get('problem_category')), + description=form_object.get('description') + ) result = {} result['title'] = summary result['body'] = body From 2bb484acc0449512d6f5d66f7d6bf7fb8b54d25c Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Wed, 4 Mar 2015 17:25:07 -0600 Subject: [PATCH 04/16] Issue #432 - remove summary field [ci skip] --- webcompat/form.py | 5 +---- webcompat/templates/form.html | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/webcompat/form.py b/webcompat/form.py index b07211f89..4c4f7c476 100644 --- a/webcompat/form.py +++ b/webcompat/form.py @@ -31,7 +31,6 @@ (u'unknown_bug', u'Somethign else - I\'ll add details below') ] url_message = u'A URL is required.' -summary_message = u'Please give a summary.' username_message = u'A valid username must be {0} characters long'.format( random.randrange(0, 99)) @@ -48,8 +47,6 @@ class IssueForm(Form): url = StringField(u'Site URL*', [Required(message=url_message)]) browser = StringField(u'Browser / Version', [Optional()]) os = StringField(u'Operating System', [Optional()]) - summary = StringField(u'Problem in 5 words*', - [Required(message=summary_message)]) username = StringField(u'Username', [Length(max=0, message=username_message)]) description = TextAreaField(u'Give more details (optional)', [Optional()], @@ -163,6 +160,6 @@ def build_formdata(form_object): description=form_object.get('description') ) result = {} - result['title'] = summary + result['title'] = 'TODO: Get the title from the selected choice' result['body'] = body return result diff --git a/webcompat/templates/form.html b/webcompat/templates/form.html index 2d52138fb..67c3f2802 100644 --- a/webcompat/templates/form.html +++ b/webcompat/templates/form.html @@ -38,7 +38,7 @@