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):
:param value:
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):
......
......@@ -137,6 +137,14 @@ table.flters tr td:nth-child(2){
margin-top: 35px;
}
.submit-row {
margin-top: 35px;
}
td>span.glyphicon {
padding-left: 35%;
}
/* Patch Select2 */
.select2-results li {
min-height: 24px !important;
......@@ -177,3 +185,21 @@ a.btn-filter, a.btn-filter:hover {
background-color: #ebebeb;
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,28 +77,37 @@
{# ---------------------- Forms -------------------------- #}
{% macro render_field(form, field, kwargs={}) %}
{% set direct_error = h.is_field_error(field.errors) %}
<div class="form-group{{ ' error' if direct_error else '' }}">
<label for="{{ field.id }}" class="col-sm-2 control-label">{{ field.label.text }}
<div class="form-group{{ ' has-error' if direct_error else '' }}">
{% 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) %}
<strong style="color: red">&#42;</strong>
{% else %}
&nbsp;
{% endif %}
</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 }}
{% if field.description %}
<p class="help-block">{{ field.description }}</p>
{% endif %}
</div>
{% if direct_error %}
<ul{% if direct_error %} class="input-errors"{% endif %}>
<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 %}
</div>
</div>
{% endmacro %}
{% macro render_header(form, text) %}
......@@ -141,7 +150,7 @@
{% macro render_form_buttons(cancel_url, extra=None) %}
<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') }}" />
{% if 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