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
810ab660
Commit
810ab660
authored
Oct 10, 2018
by
PJ Janse van Rensburg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set search box size to fit placeholder text.
parent
deef2625
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
5 deletions
+36
-5
app.py
examples/sqla/app.py
+8
-2
admin.css
flask_admin/static/admin/css/bootstrap3/admin.css
+20
-0
layout.html
flask_admin/templates/bootstrap3/admin/model/layout.html
+8
-3
No files found.
examples/sqla/app.py
View file @
810ab660
...
@@ -117,10 +117,16 @@ class PostAdmin(sqla.ModelView):
...
@@ -117,10 +117,16 @@ class PostAdmin(sqla.ModelView):
column_labels
=
dict
(
title
=
'Post Title'
)
# Rename 'title' column in list view
column_labels
=
dict
(
title
=
'Post Title'
)
# Rename 'title' column in list view
column_searchable_list
=
[
column_searchable_list
=
[
'title'
,
'title'
,
User
.
first_name
,
User
.
last_name
,
'tags.name'
,
'tags.name'
,
'user.first_name'
,
'user.last_name'
,
]
]
column_labels
=
{
'title'
:
'Title'
,
'tags.name'
:
'tags'
,
'user.first_name'
:
'user
\'
s first name'
,
'user.last_name'
:
'last name'
,
}
column_filters
=
[
column_filters
=
[
'user'
,
'user'
,
'title'
,
'title'
,
...
...
flask_admin/static/admin/css/bootstrap3/admin.css
View file @
810ab660
...
@@ -108,3 +108,23 @@ body.modal-open {
...
@@ -108,3 +108,23 @@ body.modal-open {
{
{
overflow-x
:
auto
;
overflow-x
:
auto
;
}
}
[
placeholder
]
{
text-overflow
:
ellipsis
;
}
::-webkit-input-placeholder
{
/* Chrome/Opera/Safari */
text-overflow
:
ellipsis
;
}
::-moz-placeholder
{
/* Firefox 19+ */
text-overflow
:
ellipsis
;
}
:-ms-input-placeholder
{
/* IE 10+ */
text-overflow
:
ellipsis
;
}
:-moz-placeholder
{
/* Firefox 18- */
text-overflow
:
ellipsis
;
}
flask_admin/templates/bootstrap3/admin/model/layout.html
View file @
810ab660
...
@@ -58,7 +58,7 @@
...
@@ -58,7 +58,7 @@
<div
class=
"clearfix"
></div>
<div
class=
"clearfix"
></div>
{% endmacro %}
{% endmacro %}
{% macro search_form(
input_class="col-md-5"
) %}
{% macro search_form() %}
<form
method=
"GET"
action=
"{{ return_url }}"
class=
"navbar-form navbar-left"
role=
"search"
>
<form
method=
"GET"
action=
"{{ return_url }}"
class=
"navbar-form navbar-left"
role=
"search"
>
{% for flt_name, flt_value in filter_args.items() %}
{% for flt_name, flt_value in filter_args.items() %}
<input
type=
"hidden"
name=
"{{ flt_name }}"
value=
"{{ flt_value }}"
>
<input
type=
"hidden"
name=
"{{ flt_name }}"
value=
"{{ flt_value }}"
>
...
@@ -72,14 +72,19 @@
...
@@ -72,14 +72,19 @@
{% if sort_desc %}
{% if sort_desc %}
<input
type=
"hidden"
name=
"desc"
value=
"{{ sort_desc }}"
>
<input
type=
"hidden"
name=
"desc"
value=
"{{ sort_desc }}"
>
{% endif %}
{% endif %}
{%- set full_search_placeholder = _gettext('Search') %}
{%- set min_size = config.get('FLASK_ADMIN_SEARCH_SIZE_MIN', 30) %}
{%- set max_size = config.get('FLASK_ADMIN_SEARCH_SIZE_MAX', 100) %}
{%- if search_placeholder %}{% set full_search_placeholder = [full_search_placeholder, search_placeholder] | join(": ") %}{% endif %}
{%- set input_size = [[full_search_placeholder | length, min_size] | max, max_size] | min %}
{% if search %}
{% if search %}
<div
class=
"input-group"
>
<div
class=
"input-group"
>
<input
type=
"
text"
name=
"search"
value=
"{{ search }}"
class=
"{{ input_class }} form-control"
placeholder=
"{{ _gettext('Search') }}{% if search_placeholder %}: {{ search_placeholder }}{% endif %
}"
>
<input
type=
"
search"
name=
"search"
value=
"{{ search }}"
class=
"form-control"
size=
"{{ input_size }}"
placeholder=
"{{ full_search_placeholder }
}"
>
<a
href=
"{{ clear_search_url }}"
class=
"input-group-addon clear"
><span
class=
"fa fa-times glyphicon glyphicon-remove"
></span></a>
<a
href=
"{{ clear_search_url }}"
class=
"input-group-addon clear"
><span
class=
"fa fa-times glyphicon glyphicon-remove"
></span></a>
</div>
</div>
{% else %}
{% else %}
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<input
type=
"
text"
name=
"search"
value=
""
class=
"{{ input_class }} form-control"
placeholder=
"{{ _gettext('Search') }}{% if search_placeholder %}: {{ search_placeholder }}{% endif %
}"
>
<input
type=
"
search"
name=
"search"
value=
""
class=
"form-control"
size=
"{{ input_size }}"
placeholder=
"{{ full_search_placeholder }
}"
>
</div>
</div>
{% endif %}
{% endif %}
</form>
</form>
...
...
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