Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Aep Schedule Generator Rusty Doc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Loïc Francoeur
Aep Schedule Generator Rusty Doc
Commits
7db2fbda
Verified
Commit
7db2fbda
authored
8 months ago
by
Laurent Bourgon
Browse files
Options
Downloads
Patches
Plain Diff
fix: clear course input on select
parent
558da0ae
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aep-schedule-website/src/frontend/components/common/autocomplete.rs
+11
-5
11 additions, 5 deletions
...le-website/src/frontend/components/common/autocomplete.rs
with
11 additions
and
5 deletions
aep-schedule-website/src/frontend/components/common/autocomplete.rs
+
11
−
5
View file @
7db2fbda
...
@@ -54,6 +54,14 @@ pub fn AutoComplete<F: FnMut(String) + Copy + Clone + 'static>(
...
@@ -54,6 +54,14 @@ pub fn AutoComplete<F: FnMut(String) + Copy + Clone + 'static>(
get_suggestions
(
suggestion_list
,
is_hidden
,
value
,
set_suggestion_range
);
get_suggestions
(
suggestion_list
,
is_hidden
,
value
,
set_suggestion_range
);
};
};
let
mut
select_choice
=
move
|
choice
:
String
|
{
input
.update
(|
s
|
s
.clear
());
set_suggestion_range
.set
(
0
..
0
);
is_hidden
.set
(
true
);
submit
(
choice
);
};
let
button_theme
=
move
||
{
let
button_theme
=
move
||
{
let
is_hidden
=
is_hidden
.get
();
let
is_hidden
=
is_hidden
.get
();
match
is_hidden
{
match
is_hidden
{
...
@@ -67,15 +75,13 @@ pub fn AutoComplete<F: FnMut(String) + Copy + Clone + 'static>(
...
@@ -67,15 +75,13 @@ pub fn AutoComplete<F: FnMut(String) + Copy + Clone + 'static>(
<
input
type
=
"text"
class
=
"py-2 px-3 block w-full border-gray-200 rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none text-black"
on
:
input
=
on_input
placeholder
=
placeholder
prop
:
value
=
input
id
=
id
on
:
keyup
=
move
|
ev
|
{
<
input
type
=
"text"
class
=
"py-2 px-3 block w-full border-gray-200 rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none text-black"
on
:
input
=
on_input
placeholder
=
placeholder
prop
:
value
=
input
id
=
id
on
:
keyup
=
move
|
ev
|
{
if
ev
.key
()
==
"Enter"
&&
!
is_hidden
.get
()
{
if
ev
.key
()
==
"Enter"
&&
!
is_hidden
.get
()
{
let
course
=
input
.get
()
.trim
()
.to_uppercase
();
let
course
=
input
.get
()
.trim
()
.to_uppercase
();
input
.update
(|
s
|
s
.clear
());
select_choice
(
course
);
set_suggestion_range
.set
(
0
..
0
);
submit
(
course
);
}
}
}
}
/>
/>
<
button
class
=
button_theme
on
:
pointerdown
=
move
|
_
|
{
<
button
class
=
button_theme
on
:
pointerdown
=
move
|
_
|
{
let
input
=
input
.get
()
.trim
()
.to_uppercase
();
let
input
=
input
.get
()
.trim
()
.to_uppercase
();
s
ubmit
(
input
);
s
elect_choice
(
input
);
}
>
}
>
<
PlusCircle
size
=
"2em"
/>
<
PlusCircle
size
=
"2em"
/>
</
button
>
</
button
>
...
@@ -83,7 +89,7 @@ pub fn AutoComplete<F: FnMut(String) + Copy + Clone + 'static>(
...
@@ -83,7 +89,7 @@ pub fn AutoComplete<F: FnMut(String) + Copy + Clone + 'static>(
{
suggestions
.into_iter
()
.enumerate
()
.map
(|(
i
,
autocomplete
)|
view!
{
{
suggestions
.into_iter
()
.enumerate
()
.map
(|(
i
,
autocomplete
)|
view!
{
<
div
<
div
class
=
(
"hidden"
,
move
||
{
!
suggestion_range
.get
()
.contains
(
&
i
)})
class
=
(
"hidden"
,
move
||
{
!
suggestion_range
.get
()
.contains
(
&
i
)})
on
:
pointerdown
=
move
|
_
|
s
ubmit
(
autocomplete
.value
.clone
())
on
:
pointerdown
=
move
|
_
|
s
elect_choice
(
autocomplete
.value
.clone
())
>
>
{
autocomplete
.label
}
{
autocomplete
.label
}
</
div
>
</
div
>
...
...
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