Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
flask-admin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Python-Dev
flask-admin
Commits
d2dc7074
Commit
d2dc7074
authored
Nov 29, 2013
by
Davide Silvestri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed checkbox input and boolean default column formatter for bootstrap3
parent
11bb8670
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
14 deletions
+50
-14
typefmt.py
flask_admin/model/typefmt.py
+2
-1
admin.css
flask_admin/static/admin/css/admin.css
+26
-0
lib.html
flask_admin/templates/admin/lib.html
+22
-13
No files found.
flask_admin/model/typefmt.py
View file @
d2dc7074
...
@@ -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
):
...
...
flask_admin/static/admin/css/admin.css
View file @
d2dc7074
...
@@ -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
flask_admin/templates/admin/lib.html
View file @
d2dc7074
...
@@ -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"
>
*
</strong>
<strong
style=
"color: red"
>
*
</strong>
{% else %}
{% else %}
{% 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 }}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment