Skip to content

Commit f262981

Browse files
committed
lintfix
1 parent 9397c05 commit f262981

File tree

2 files changed

+38
-37
lines changed

2 files changed

+38
-37
lines changed

kubespawner/templates/form.html

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -20,48 +20,48 @@ <h3>{{ profile.display_name }}</h3>
2020
<div class="js-options-container">
2121
<div class="option">
2222
{%- if option['choices'] %}
23-
<label for="profile-option-{{ profile.slug }}--{{ k }}"
24-
class="js-profile-option-label">{{ option.display_name }}</label>
25-
<select name="profile-option-{{ profile.slug }}--{{ k }}"
26-
class="form-control js-profile-option-select">
27-
{%- for k, choice in option['choices'].items() %}
28-
<option value="{{ k }}" {% if choice.default %}selected{% endif %}>{{ choice.display_name }}</option>
29-
{%- endfor %}
30-
{%- if option['unlisted_choice']['enabled'] %}
31-
<option value="unlisted-choice">{{ option['unlisted_choice']['display_name_in_choices'] }}</option>
32-
{%- endif %}
33-
</select>
23+
<label for="profile-option-{{ profile.slug }}--{{ k }}"
24+
class="js-profile-option-label">{{ option.display_name }}</label>
25+
<select name="profile-option-{{ profile.slug }}--{{ k }}"
26+
class="form-control js-profile-option-select">
27+
{%- for k, choice in option['choices'].items() %}
28+
<option value="{{ k }}" {% if choice.default %}selected{% endif %}>{{ choice.display_name }}</option>
29+
{%- endfor %}
30+
{%- if option['unlisted_choice']['enabled'] %}
31+
<option value="unlisted-choice">{{ option['unlisted_choice']['display_name_in_choices'] }}</option>
32+
{%- endif %}
33+
</select>
3434
{%- endif %}
3535
</div>
3636
{%- if option['unlisted_choice']['enabled'] %}
37-
<div class="option js-other-input-container {%- if option['choices'] %} hidden {%- endif %}">
37+
<div class="option js-other-input-container {%- if option['choices'] %}hidden{%- endif %}">
3838
<label for="profile-option-{{ profile.slug }}--{{ k }}--unlisted-choice">
3939
{{ option['unlisted_choice']['display_name'] }}
4040
</label>
41-
<input
42-
{#- FIXME: This has gotten a bit ugly, ideally we would handle a lot of this
41+
<input
42+
{#- FIXME: This has gotten a bit ugly, ideally we would handle a lot of this
4343
logic all in Javascript and not need this conditional attribute rendering #}
44-
{%- if option['choices'] %}
45-
data-name="profile-option-{{ profile.slug }}--{{ k }}--unlisted-choice"
46-
{%- else %}
47-
name="profile-option-{{ profile.slug }}--{{ k }}--unlisted-choice"
48-
{%- endif %}
49-
{%- if option['unlisted_choice']['validation_regex'] %}
50-
pattern="{{ option['unlisted_choice']['validation_regex'] }}"
51-
{%- endif %}
52-
title="{{ option['unlisted_choice']['validation_message'] }}"
53-
class="form-control js-other-input" />
54-
</div>
55-
{%- endif %}
56-
</div>
57-
{%- endfor %}
58-
</div>
59-
{%- endif %}
60-
</div>
61-
</label>
62-
{%- endfor %}
63-
</div>
64-
<script>
44+
{%- if option['choices'] %}
45+
data-name="profile-option-{{ profile.slug }}--{{ k }}--unlisted-choice"
46+
{%- else %}
47+
name="profile-option-{{ profile.slug }}--{{ k }}--unlisted-choice"
48+
{%- endif %}
49+
{%- if option['unlisted_choice']['validation_regex'] %}
50+
pattern="{{ option['unlisted_choice']['validation_regex'] }}"
51+
{%- endif %}
52+
title="{{ option['unlisted_choice']['validation_message'] }}"
53+
class="form-control js-other-input" />
54+
</div>
55+
{%- endif %}
56+
</div>
57+
{%- endfor %}
58+
</div>
59+
{%- endif %}
60+
</div>
61+
</label>
62+
{%- endfor %}
63+
</div>
64+
<script>
6565
$('.js-profile-option-select, .js-profile-option-label').click(function() {
6666
// we need this bit of JS to select the profile when a <select> inside is clicked.
6767
$(this).parents('.js-profile-label')
@@ -104,4 +104,4 @@ <h3>{{ profile.display_name }}</h3>
104104
$('.js-profile-option-select').trigger('change');
105105
});
106106

107-
</script>
107+
</script>

tests/test_spawner.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ async def test_expansion_hyphens():
982982
'enabled': True,
983983
'display_name': 'Image Location',
984984
'kubespawner_override': {'image': '{value}'},
985-
}
985+
},
986986
},
987987
},
988988
},
@@ -1122,6 +1122,7 @@ async def test_user_options_set_from_form_no_regex():
11221122
await spawner.load_user_options()
11231123
assert getattr(spawner, 'image') == 'invalid/foo:latest'
11241124

1125+
11251126
async def test_user_options_unlisted_choice_without_choices():
11261127
"""
11271128
Test that if a profile does not have `choices` but has an unlisted_choice definition,

0 commit comments

Comments
 (0)