make select2 look better in bootstrap

This commit is contained in:
Feliciaan De Palmenaer 2015-03-30 18:37:39 +02:00
parent c2c1b86aae
commit f379448e31
4 changed files with 10 additions and 7 deletions

File diff suppressed because one or more lines are too long

View file

@ -24,8 +24,8 @@
<h4>Order:</h4>
<form method="post" action="{{ url_for('.order_item_create', id=order.id) }}">
{{ form.csrf_token }}
<div class="form-group {{ 'has-errors' if form.product_id.errors else ''}}">
{{ form.product_id.label(class='control-label') }}
<div class="form-group select2-container select2 {{ 'has-errors' if form.product_id.errors}}">
{{ form.product_id.label(class='control-label') }}<br>
{{ form.product_id(class='form-control select') }}
{{ util.render_form_field_errors(form.product_id) }}
</div>
@ -36,7 +36,7 @@
{{ util.render_form_field_errors(form.name) }}
</div>
{% endif %}
<div class="form-group">
<div class="form-group" style="padding-top: 8px;">
{{ form.submit_button(class='btn btn-primary') }}
</div>
</form>
@ -71,6 +71,7 @@
{% block styles %}
{{ super() }}
<link href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0-rc.2/css/select2.min.css" rel="stylesheet" />
<link rel="stylesheet" href="{{ url_for('static', filename='css/select2-bootstrap.min.css') }}">
{% endblock %}
{% block scripts %}
{{ super() }}

View file

@ -17,12 +17,12 @@
<h3>Create new order:</h3>
<form method="post" action="{{ url_for('.order_create') }}">
{{ form.csrf_token }}
<div class="form-group {{ 'has-errors' if form.courrier_id.errors else ''}}">
{{ form.courrier_id.label(class='control-label') }}
<div class="form-group select2 {{ 'has-errors' if form.courrier_id.errors else ''}}">
{{ form.courrier_id.label(class='control-label') }}<br>
{{ form.courrier_id(class='form-control select') }}
{{ util.render_form_field_errors(form.courrier_id) }}
</div>
<div class="form-group {{ 'has-errors' if form.location_id.errors else ''}}{{ ' required' if form.location_id.flags.required }}">
<div class="form-group select2 {{ 'has-errors' if form.location_id.errors else ''}}{{ ' required' if form.location_id.flags.required }}">
{{ form.location_id.label(class='control-label') }}
{{ form.location_id(class='form-control select') }}
{{ util.render_form_field_errors(form.location_id) }}
@ -63,6 +63,7 @@
{{ super() }}
<link href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0-rc.2/css/select2.min.css" rel="stylesheet" />
<link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap-datetimepicker.min.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/select2-bootstrap.min.css') }}">
{%- endblock %}
{% block scripts -%}
{{ super() }}

View file

@ -56,7 +56,7 @@ def order_item_create(id):
abort(404)
if current_order.stoptime and current_order.stoptime < datetime.now():
abort(404)
if current_user.is_anonymous() and not order.public:
if current_user.is_anonymous() and not current_order.public:
flash('Please login to see this order.', 'info')
abort(401)
form = AnonOrderItemForm() if current_user.is_anonymous() else OrderItemForm()