Skip to content

Commit

Permalink
Issue #3250 - makes the wizard form the default
Browse files Browse the repository at this point in the history
Instead of keeping the choice in between the old form and the wizard form, we make the wizard form the default. we should create another issue to finally remove all the code related to the old form.
  • Loading branch information
karlcow committed Mar 26, 2020
1 parent 7ceb984 commit 136e292
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 36 deletions.
9 changes: 1 addition & 8 deletions webcompat/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,21 +751,14 @@ def get_extra_labels(form):
"""Extract extra_labels.
If extra_labels param exists in current session, use it,
otherwise use the value coming from form. Add form-v2-experiment
label if the experiment cookie exists.
otherwise use the value coming from form.
"""

extra_labels = session.pop('extra_labels', [])

if not extra_labels:
extra_labels = json.loads(form.get('extra_labels', '[]') or '[]')

if ab_active('exp') == 'form-v2':
if isinstance(extra_labels, list):
extra_labels.append('form-v2-experiment')
else:
extra_labels = ['form-v2-experiment']

return extra_labels


Expand Down
8 changes: 0 additions & 8 deletions webcompat/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@
<script src="{{ url_for('static', filename='js/dist/ga.js') }}"></script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
<!-- End Google Analytics -->
{%- if ab_active('exp') == 'form-v2' %}
<script src="{{ url_for('static', filename='js/dist/webcompat.formv2.js')|bust_cache }}"></script>
{% else %}
<script src="{{ url_for('static', filename='js/dist/webcompat.min.js')|bust_cache }}"></script>
{% endif -%}
{% else %}
<script src="{{ url_for('static', filename='js/vendor/jquery-3.3.1.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/vendor/lodash.custom.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/vendor/backbone-1.3.3.min.js') }}"></script>
Expand All @@ -41,12 +37,8 @@
<script src="{{ url_for('static', filename='js/lib/autogrow-textfield.js') }}"></script>
<script src="{{ url_for('static', filename='js/lib/bugform-validation.js') }}"></script>
<script src="{{ url_for('static', filename='js/lib/bugform-prefill.js') }}"></script>
{%- if ab_active('exp') == 'form-v2' %}
<script src="{{ url_for('static', filename='js/lib/issue-wizard-popup.js') }}"></script>
<script src="{{ url_for('static', filename='js/lib/issue-wizard-slider.js') }}"></script>
{% else %}
<script src="{{ url_for('static', filename='js/lib/bugform.js') }}"></script>
{% endif -%}
<script src="{{ url_for('static', filename='js/dist/templates.js') }}"></script>
{%- if config['LOCALHOST'] %}
<script src="{{ url_for('get_test_helper',
Expand Down
14 changes: 2 additions & 12 deletions webcompat/templates/new-issue.html
Original file line number Diff line number Diff line change
@@ -1,32 +1,22 @@
{%- extends "layout.html" -%}

{% block extracss %}
{%- if ab_active('exp') == 'form-v2' %}
<link href="{{ url_for('static', filename='css/src/issue-wizard.css') }}" type="text/css" rel="stylesheet">
{% endif %}
{% endblock %}

{% block title %}{{ pagetitle }}{% endblock %}
{%- block body -%}
{% if ab_active('exp') == 'form-v2' %}
{% include "nav/issue-wizard-stepper.html" %}
{% endif %}
{% include "nav/issue-wizard-stepper.html" %}
{% include "nav/topbar.html" %}
<main role="main" class="grid">
<section id="js-ReportForm" class="js-ReportForm grid">
{% if ab_active('exp') == 'form-v2' %}
{% include "issue-wizard-form.html" %}
{% else %}
{% include "form.html" %}
{% endif %}
{% include "issue-wizard-form.html" %}
</section>
</main>
{% endblock %}

{%- block extrascripts -%}
{% if ab_active('exp') == 'form-v2' %}
<script src="{{ url_for('static', filename='js/lib/issue-wizard-bugform.js') }}"></script>
{% endif %}

{% if source and campaign %}
<script nonce={{nonce}}>
Expand Down
10 changes: 2 additions & 8 deletions webcompat/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,8 @@ def create_issue():
# Form Prefill section
if request_type == 'prefill':
form_data = prepare_form(request)

if ab_active('exp') == 'form-v2':
bug_form = get_form(form_data, form=FormWizard)
pagetitle = "New Issue |"
else:
bug_form = get_form(form_data)
pagetitle = "New Issue"

bug_form = get_form(form_data, form=FormWizard)
pagetitle = "New Issue"
session['extra_labels'] = form_data['extra_labels']
source = form_data.pop('utm_source', None)
campaign = form_data.pop('utm_campaign', None)
Expand Down

0 comments on commit 136e292

Please sign in to comment.