Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nk20
Manage
Activity
Members
Labels
Plan
Issues
31
Issue boards
Milestones
Wiki
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BDE
nk20
Commits
d95cd8c7
Commit
d95cd8c7
authored
4 years ago
by
ynerant
Browse files
Options
Downloads
Patches
Plain Diff
🎨
Better autocomplete field
parent
5b3361f0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!104
Beta
,
!98
Morefront
,
!91
Documents
Pipeline
#8376
passed with warnings with stages
in 5 minutes and 10 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
apps/api/urls.py
+1
-1
1 addition, 1 deletion
apps/api/urls.py
apps/member/views.py
+2
-2
2 additions, 2 deletions
apps/member/views.py
static/js/autocomplete_model.js
+6
-0
6 additions, 0 deletions
static/js/autocomplete_model.js
with
9 additions
and
3 deletions
apps/api/urls.py
+
1
−
1
View file @
d95cd8c7
...
...
@@ -54,7 +54,7 @@ class UserViewSet(ReadProtectedModelViewSet):
serializer_class
=
UserSerializer
filter_backends
=
[
DjangoFilterBackend
,
SearchFilter
]
filterset_fields
=
[
'
id
'
,
'
username
'
,
'
first_name
'
,
'
last_name
'
,
'
email
'
,
'
is_superuser
'
,
'
is_staff
'
,
'
is_active
'
,
]
search_fields
=
[
'
$username
'
,
'
$first_name
'
,
'
$last_name
'
,
]
search_fields
=
[
'
$username
'
,
'
$first_name
'
,
'
$last_name
'
,
'
$note__alias__name
'
,
'
$note__alias__normalized_name
'
,
]
# This ViewSet is the only one that is accessible from all authenticated users!
...
...
This diff is collapsed.
Click to expand it.
apps/member/views.py
+
2
−
2
View file @
d95cd8c7
...
...
@@ -326,8 +326,8 @@ class ClubListView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView):
qs
=
qs
.
filter
(
Q
(
name__iregex
=
pattern
)
|
Q
(
note__alias__name__iregex
=
"
^
"
+
pattern
)
|
Q
(
note__alias__normalized_name__iregex
=
Alias
.
normalize
(
"
^
"
+
pattern
))
|
Q
(
note__alias__name__iregex
=
pattern
)
|
Q
(
note__alias__normalized_name__iregex
=
Alias
.
normalize
(
pattern
))
)
return
qs
...
...
This diff is collapsed.
Click to expand it.
static/js/autocomplete_model.js
+
6
−
0
View file @
d95cd8c7
...
...
@@ -10,6 +10,8 @@ $(document).ready(function () {
if
(
!
name_field
)
name_field
=
"
name
"
;
let
input
=
target
.
val
();
target
.
addClass
(
"
is-invalid
"
);
target
.
removeClass
(
"
is-valid
"
);
$
(
"
#
"
+
prefix
+
"
_reset
"
).
removeClass
(
"
d-none
"
);
$
.
getJSON
(
api_url
+
(
api_url
.
includes
(
"
?
"
)
?
"
&
"
:
"
?
"
)
+
"
format=json&search=^
"
+
input
+
api_url_suffix
,
function
(
objects
)
{
...
...
@@ -27,6 +29,10 @@ $(document).ready(function () {
target
.
val
(
obj
[
name_field
]);
$
(
"
#
"
+
prefix
+
"
_pk
"
).
val
(
obj
.
id
);
results_list
.
html
(
""
);
target
.
removeClass
(
"
is-invalid
"
);
target
.
addClass
(
"
is-valid
"
);
if
(
typeof
autocompleted
!=
'
undefined
'
)
autocompleted
(
obj
,
prefix
)
});
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment