layout cleanups
This commit is contained in:
parent
b495cae6cd
commit
7b71359733
3 changed files with 20 additions and 8 deletions
14
sso/forms.py
14
sso/forms.py
|
@ -23,6 +23,18 @@ class MultiCheckboxField(SelectMultipleField):
|
||||||
option_widget = widgets.CheckboxInput()
|
option_widget = widgets.CheckboxInput()
|
||||||
|
|
||||||
|
|
||||||
|
class RadioField(SelectField):
|
||||||
|
"""
|
||||||
|
A multiple-select, except displays a list of checkboxes.
|
||||||
|
|
||||||
|
Iterating the field will produce subfields, allowing custom rendering of
|
||||||
|
the enclosed checkbox fields.
|
||||||
|
"""
|
||||||
|
|
||||||
|
widget = widgets.ListWidget(prefix_label=False)
|
||||||
|
option_widget = widgets.RadioInput()
|
||||||
|
|
||||||
|
|
||||||
class LoginForm(FlaskForm):
|
class LoginForm(FlaskForm):
|
||||||
username = StringField("username", validators=[DataRequired()])
|
username = StringField("username", validators=[DataRequired()])
|
||||||
password = PasswordField("password", validators=[DataRequired()])
|
password = PasswordField("password", validators=[DataRequired()])
|
||||||
|
@ -48,7 +60,7 @@ class ClientForm(FlaskForm):
|
||||||
default=["code"],
|
default=["code"],
|
||||||
)
|
)
|
||||||
|
|
||||||
token_endpoint_auth_method = SelectField(
|
token_endpoint_auth_method = RadioField(
|
||||||
"Token endpoint authentication method",
|
"Token endpoint authentication method",
|
||||||
choices=[("client_secret_basic", "Basic"), ("client_secret_post", "POST"), ("client_secret_get", "Query args (DEPRECATED)")],
|
choices=[("client_secret_basic", "Basic"), ("client_secret_post", "POST"), ("client_secret_get", "Query args (DEPRECATED)")],
|
||||||
validators=[DataRequired()],
|
validators=[DataRequired()],
|
||||||
|
|
|
@ -11,7 +11,7 @@ None
|
||||||
{% macro format_currency_raw(amount, precision=0) -%}
|
{% macro format_currency_raw(amount, precision=0) -%}
|
||||||
{{ ("%%.%sf" | format(precision) | format(amount/100)) }}SOG
|
{{ ("%%.%sf" | format(precision) | format(amount/100)) }}SOG
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
{% macro render_field(field, prefix=None, suffix=None, layout=True, label=True, split=3) %}
|
{% macro render_field(field, prefix=None, suffix=None, layout=True, label=True, split=4) %}
|
||||||
{% if field.type == 'HiddenField' or field.type == 'CSRFTokenField' %}
|
{% if field.type == 'HiddenField' or field.type == 'CSRFTokenField' %}
|
||||||
{{ field(**kwargs) }}
|
{{ field(**kwargs) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -4,15 +4,15 @@
|
||||||
|
|
||||||
{% macro static_field(id, label, value) %}
|
{% macro static_field(id, label, value) %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-3 control-label control-label-required" for="{{ id }}">{{ label }}</label>
|
<label class="col-md-4 control-label control-label-required" for="{{ id }}">{{ label }}</label>
|
||||||
<div class="col-md-9">
|
<div class="col-md-8">
|
||||||
<input class="form-control" id="{{ id }}" name="{{ id }}" required="" type="text" value="{{ value }}" readonly>
|
<input class="form-control" id="{{ id }}" name="{{ id }}" required="" type="text" value="{{ value }}" readonly>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="col-md-8 col-md-offset-2">
|
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
|
||||||
<h2 class="page-header">
|
<h2 class="page-header">
|
||||||
{% if client is defined %}Client edit{% else %}Client registration{% endif %}
|
{% if client is defined %}Client edit{% else %}Client registration{% endif %}
|
||||||
</h2>
|
</h2>
|
||||||
|
@ -26,15 +26,15 @@
|
||||||
{{ render_field(form.response_types) }}
|
{{ render_field(form.response_types) }}
|
||||||
{{ render_field(form.scope) }}
|
{{ render_field(form.scope) }}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-md-9 col-md-offset-3">
|
<div class="col-md-8 col-md-offset-4">
|
||||||
<button type="submit" class="btn btn-primary btn-block">Save</button>
|
<button type="submit" class="btn btn-primary btn-block">Save</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% if client is defined %}
|
{% if client is defined %}
|
||||||
{{ static_field('client_id', 'Client ID', client.client_id) }}
|
{{ static_field('client_id', 'Client ID', client.client_id) }}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-3 control-label control-label-required" for="client_secret">Client secret</label>
|
<label class="col-md-4 control-label control-label-required" for="client_secret">Client secret</label>
|
||||||
<div class="col-md-9">
|
<div class="col-md-8">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input class="form-control" id="client_secret" name="client_secret" required="" type="password" value="{{ client.client_secret }}" readonly>
|
<input class="form-control" id="client_secret" name="client_secret" required="" type="password" value="{{ client.client_secret }}" readonly>
|
||||||
<span class="input-group-btn">
|
<span class="input-group-btn">
|
||||||
|
|
Loading…
Reference in a new issue