Commit d2dc7074 authored by Davide Silvestri's avatar Davide Silvestri

fixed checkbox input and boolean default column formatter for bootstrap3

parent 11bb8670
...@@ -29,7 +29,8 @@ def bool_formatter(view, value): ...@@ -29,7 +29,8 @@ def bool_formatter(view, value):
:param value: :param value:
Value to check Value to check
""" """
return Markup('<i class="icon-ok"></i>' if value else '') glyph = 'ok-circle' if value else 'minus-sign'
return Markup('<span class="glyphicon glyphicon-%s"></span>' % glyph)
def list_formatter(view, values): def list_formatter(view, values):
......
...@@ -137,6 +137,14 @@ table.flters tr td:nth-child(2){ ...@@ -137,6 +137,14 @@ table.flters tr td:nth-child(2){
margin-top: 35px; margin-top: 35px;
} }
.submit-row {
margin-top: 35px;
}
td>span.glyphicon {
padding-left: 35%;
}
/* Patch Select2 */ /* Patch Select2 */
.select2-results li { .select2-results li {
min-height: 24px !important; min-height: 24px !important;
...@@ -176,4 +184,22 @@ a.btn-filter, a.btn-filter:hover { ...@@ -176,4 +184,22 @@ a.btn-filter, a.btn-filter:hover {
color: #333; color: #333;
background-color: #ebebeb; background-color: #ebebeb;
max-height: 32px; max-height: 32px;
}
.help-block {
margin-bottom: 0px;
}
ul.has-error {
margin-bottom: -8px;
}
.tooltip.top {
font-size: 1.1em;
top: -35px;
}
.checkbox input[type="checkbox"] {
margin-left: 0px;
margin-right: 15px;
} }
\ No newline at end of file
...@@ -77,27 +77,36 @@ ...@@ -77,27 +77,36 @@
{# ---------------------- Forms -------------------------- #} {# ---------------------- Forms -------------------------- #}
{% macro render_field(form, field, kwargs={}) %} {% macro render_field(form, field, kwargs={}) %}
{% set direct_error = h.is_field_error(field.errors) %} {% set direct_error = h.is_field_error(field.errors) %}
<div class="form-group{{ ' error' if direct_error else '' }}"> <div class="form-group{{ ' has-error' if direct_error else '' }}">
<label for="{{ field.id }}" class="col-sm-2 control-label">{{ field.label.text }} {% if field.type == 'BooleanField' %}
<div class="col-md-8 col-md-offset-2 checkbox">
<label class="control-label">{{ field(**kwargs)|safe }}{{ field.label.text }}</label>
{% else %}
<label for="{{ field.id }}" class="col-md-2 control-label">{{ field.label.text }}
{% if h.is_required_form_field(field) %} {% if h.is_required_form_field(field) %}
<strong style="color: red">&#42;</strong> <strong style="color: red">&#42;</strong>
{% else %} {% else %}
&nbsp; &nbsp;
{% endif %} {% endif %}
</label> </label>
<div class="col-sm-8"> <div class="col-md-{% if field.type in ['DateTimeField', 'DateField'] %}2{% else %}4{% endif %}">
{{ field(class="form-control", **kwargs)|safe }} {{ field(class="form-control", **kwargs)|safe }}
{% if field.description %} {% endif %}
<p class="help-block">{{ field.description }}</p> {% if direct_error %}
<span class="help-block">
{% if field.description %}
<p>{{ field.description }}<p>
{% endif %}
<ul class="has-error">
{% for e in field.errors if e is string %}
<li>{{ e }}</li>
{% endfor %}
</ul>
</span>
{% elif field.description %}
<span class="help-block">{{ field.description }}</span>
{% endif %} {% endif %}
</div> </div>
{% if direct_error %}
<ul{% if direct_error %} class="input-errors"{% endif %}>
{% for e in field.errors if e is string %}
<li>{{ e }}</li>
{% endfor %}
</ul>
{% endif %}
</div> </div>
{% endmacro %} {% endmacro %}
...@@ -141,7 +150,7 @@ ...@@ -141,7 +150,7 @@
{% macro render_form_buttons(cancel_url, extra=None) %} {% macro render_form_buttons(cancel_url, extra=None) %}
<div class="form-group"> <div class="form-group">
<div class="col-sm-offset-2 col-sm-10"> <div class="col-sm-offset-2 col-sm-10 submit-row">
<input type="submit" class="btn btn-primary" value="{{ _gettext('Submit') }}" /> <input type="submit" class="btn btn-primary" value="{{ _gettext('Submit') }}" />
{% if extra %} {% if extra %}
{{ extra }} {{ extra }}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment