Skip to content

Commit

Permalink
Merge branch 'release-2.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
abidibo committed Feb 22, 2021
2 parents 07cb0fc + ea7cdae commit a468da8
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ The autocomplete field will call a custom api at every keyup event. Such api rec
In order to activate this functionality you should add the BATON configuration:


You should provide the results length and the data as an array of objects which must contain the `label` and `url` keys. The `icon` key is optional.
You should provide the results length and the data as an array of objects which must contain the `label` and `url` keys. The `icon` key is optional and is treated as css class given to an `i` element.

Let's see an example:

Expand Down
2 changes: 1 addition & 1 deletion baton/static/baton/app/dist/baton.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion baton/static/baton/app/dist/baton.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion baton/static/baton/app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion baton/static/baton/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "baton",
"version": "2.1.1",
"version": "2.1.2",
"description": "Django Baton App",
"main": "index.js",
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions baton/static/baton/app/src/core/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ let Menu = {
}
}

field.on('blur', () => dataList.empty())
field.on('focus', () => field.trigger('keyup', { keyCode: 39 }))
field.on('blur', e => setTimeout(() => dataList.hide(), 150))
field.on('focus', e => dataList.show())
field.on('keyup', e => {
var code = e.keyCode || e.which

Expand Down Expand Up @@ -162,7 +162,7 @@ let Menu = {
container.removeClass('loading')
dataList.empty()
data.data.forEach((r, index) => dataList.append(`
<div class="datalist-option${index === 0 ? ' selected' : ''}" data-url="${r.url}"><span>${r.label}</span>${r.icon ? '<i class="' + r.icon + '"></i>' : ''}</div>`)
<div class="datalist-option${index === 0 ? ' selected' : ''}" onclick="location.href='${r.url}'" data-url="${r.url}"><a href="${r.url}">${r.label}</a>${r.icon ? `<i onclick="location.href='${r.url}'" class="${r.icon}"></i>` : ''}</div>`)
)
})
.fail((jqxhr, textStatus, err) => {
Expand Down
18 changes: 17 additions & 1 deletion baton/static/baton/app/src/styles/_menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ body:not(.menu-mobile) {
border-color: $search-field-input-border-color;
color: $search-field-color;
padding-right: 30px;

&:focus {
box-shadow: 0 0 0 transparent;
outline: 0 none;
}
}

&::after {
Expand Down Expand Up @@ -191,7 +196,18 @@ body:not(.menu-mobile) {
padding: .5rem;

&.selected {
background: lighten($search-field-datalist-bg, 5%);
background: $search-field-selected-bg;
color: $search-field-selected-color;

a {
color: $search-field-selected-color;
}

}

a {
color: $search-field-link-color;
text-decoration: none;
}

i {
Expand Down
3 changes: 3 additions & 0 deletions baton/static/baton/app/src/styles/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ $search-field-input-border-color: $menu-bg;
$search-field-color: $menu-color;
$search-field-datalist-bg: darken($menu-bg, 5%);
$search-field-icon-color: lighten(#007eed, 25%);
$search-field-link-color: #fff;
$search-field-selected-bg: lighten($menu-bg, 20%);
$search-field-selected-color: #fff;

// dashboard
$dashboard-bg: #f5f5f5;
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
# built documents.
#
# The short X.Y version.
version = u'2.1.1'
version = u'2.1.2'
# The full version, including alpha/beta/rc tags.
release = u'2.1.1'
release = u'2.1.2'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ The autocomplete field will call a custom api at every keyup event. Such api rec
]
}

You should provide the results length and the data as an array of objects which must contain the ``label`` and ``url`` keys. The ``icon`` key is optional.
You should provide the results length and the data as an array of objects which must contain the ``label`` and ``url`` keys. The ``icon`` key is optional and is treated as css class given to an ``i`` element.

Let's see an example: ::

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

setup(
name='django-baton',
version='2.1.1',
version='2.1.2',
packages=['baton', 'baton.autodiscover', 'baton.templatetags'],
include_package_data=True,
license='MIT License',
Expand Down
1 change: 1 addition & 0 deletions testapp/app/app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def admin_search(request):
res.append({
'label': 'Lucio Dalla Wikipedia',
'url': 'https://www.google.com',
'icon': 'fab fa-wikipedia-w'
})
return JsonResponse({
'length': len(res),
Expand Down
Binary file modified testapp/app/db.sqlite3
Binary file not shown.

0 comments on commit a468da8

Please sign in to comment.