Skip to content

Commit

Permalink
Allow user to swap back to legislature list on create page
Browse files Browse the repository at this point in the history
Add a link to re-show the legislature list and hide the manual popolo
list.

Fixes #1126
  • Loading branch information
struan committed Feb 22, 2016
1 parent a9616ed commit 81de85d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions nuntium/templates/nuntium/create_new_writeitinstance.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ <h2>{% trans "Create your new Site" %}</h2>
<span class="helptext js-low-contact-count-warning"></span>
</div>
<p><a href="#" class="js-show-manual-popolo">I have my own suitably formatted popolo</a></p>
<p><a href="#" class="js-show-legislature-list">I'd like to choose from the list of countries</a></p>
{% csrf_token %}
{{form.as_p}}
<button class='btn btn-primary js-submit-button'>{% trans 'Create' %}</button>
Expand All @@ -41,8 +42,12 @@ <h2>{% trans "Create your new Site" %}</h2>
<script>
var notEnoughContactDetails = $('.js-not-enough-contact-details');
notEnoughContactDetails.hide();
var showLegislatureList = $('.js-show-legislature-list').closest('p');
showLegislatureList.hide();
var showPopitUrl = $('.js-show-manual-popolo');
var popitUrl = $('#id_popit_url').closest('p');
popitUrl.hide();
popitUrl.after(showLegislatureList);
var countriesList = $('.js-countries-list');
var submitButton = $('.js-submit-button');
var lowContactCountWarning = $('.js-low-contact-count-warning');
Expand All @@ -52,9 +57,18 @@ <h2>{% trans "Create your new Site" %}</h2>
e.preventDefault();
submitButton.removeAttr('disabled');
popitUrl.show();
showLegislatureList.show();
countriesList.closest('div').hide();
$(this).hide();
});
$('.js-show-legislature-list').click(function(e) {
e.preventDefault();
submitButton.prop('disabled', true);
countriesList.closest('div').show();
popitUrl.hide();
showPopitUrl.show();
$(this).closest('p').hide();
});
countriesList.change(function(e) {
notEnoughContactDetails.hide();
lowContactCountWarning.hide();
Expand Down

0 comments on commit 81de85d

Please sign in to comment.