Permalink
Browse files

Only show organisation field when needed.

Signed-off-by: Chris Lamb <lamby@debian.org>
  • Loading branch information...
1 parent 75877ec commit af43d78b249d7a6227db8852bbe8d0d391cb4da4 @lamby lamby committed with Sep 27, 2012
Showing with 17 additions and 1 deletion.
  1. +14 −0 src/media/js/librement.js
  2. +3 −1 src/templates/registration/view.html
View
@@ -18,6 +18,20 @@ $.extend({
}
});
+$.feature('f_registration', function() {
+ var organisation = $('input[name=organisation]');
+
+ $('input[name=account_type]').on('change', function(x) {
+ if (organisation.val() != '') {
+ return;
+ }
+
+ organisation
+ .parents('.control-group')
+ .toggleClass('hide', $(x.target).hasClass('hide-organisation'));
+ });
+});
+
$.feature('f_profile', function() {
var container = $('.rss');
@@ -1,5 +1,7 @@
{% extends "base/base.html" %}
+{% block body_classes %}f_registration{% endblock %}
+
{% block content %}
<section id="registration">
@@ -15,7 +17,7 @@
<div class="controls">
{% for enum,display in form.fields.account_type.choices %}
<label class="radio inline">
- <input type="radio" name="{{ form.account_type.html_name }}" value="{{ enum.slug }}" {% if form.account_type.value == enum %}checked="checked"{% endif %}>
+ <input type="radio" name="{{ form.account_type.html_name }}" value="{{ enum.slug }}" {% if form.account_type.value == enum %}checked="checked"{% endif %} class="{% if enum.slug == "individual" %}hide-organisation{% endif %}">
{{ display }}
</label>
{% endfor %}

0 comments on commit af43d78

Please sign in to comment.