Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
web-et-numerique
Factory
Resin
Client
Commits
e2244d3d
Commit
e2244d3d
authored
3 years ago
by
Antonin COQUET
Browse files
Options
Downloads
Patches
Plain Diff
add querystring to route param
parent
8bf82fdb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!178
release V1.10.0
,
!135
Dev
,
!122
Feat/structure query param
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/structure-list/components/search/search.component.ts
+24
-1
24 additions, 1 deletion
src/app/structure-list/components/search/search.component.ts
with
24 additions
and
1 deletion
src/app/structure-list/components/search/search.component.ts
+
24
−
1
View file @
e2244d3d
...
...
@@ -9,6 +9,8 @@ import { Filter } from '../../models/filter.model';
import
{
Module
}
from
'
../../models/module.model
'
;
import
{
StructureCounter
}
from
'
../../models/structureCounter.model
'
;
import
{
SearchService
}
from
'
../../services/search.service
'
;
import
{
Location
}
from
'
@angular/common
'
;
import
{
ActivatedRoute
}
from
'
@angular/router
'
;
@
Component
({
selector
:
'
app-structure-list-search
'
,
...
...
@@ -36,20 +38,34 @@ export class SearchComponent implements OnInit, OnChanges {
public
numberAccompanimentChecked
=
0
;
public
numberMoreFiltersChecked
=
0
;
public
queryString
=
'
placeholder
'
;
// Modal confirmation variable
public
isConfirmationModalOpen
=
false
;
public
confirmationModalContent
=
'
Afin d’ajouter votre structure,vous allez être redirigé vers le formulaire Grand Lyon à remplir.
'
;
constructor
(
public
searchService
:
SearchService
,
private
fb
:
FormBuilder
,
private
geoJsonService
:
GeojsonService
)
{
constructor
(
public
searchService
:
SearchService
,
private
fb
:
FormBuilder
,
private
geoJsonService
:
GeojsonService
,
private
activatedRoute
:
ActivatedRoute
,
private
location
:
Location
)
{
this
.
searchForm
=
this
.
fb
.
group
({
searchTerm
:
''
,
});
}
ngOnInit
():
void
{
// Will store the different categories
this
.
queryString
=
this
.
activatedRoute
.
snapshot
.
queryParamMap
.
get
(
'
search
'
);
this
.
categories
=
[];
this
.
checkedModulesFilter
=
new
Array
();
if
(
this
.
queryString
)
{
console
.
log
(
'
we search
'
,
this
.
queryString
);
const
filters
:
Filter
[]
=
[];
filters
.
push
(
new
Filter
(
'
query
'
,
this
.
queryString
));
this
.
searchEvent
.
emit
(
filters
);
}
}
ngOnChanges
(
changes
:
SimpleChanges
):
void
{
...
...
@@ -75,6 +91,13 @@ export class SearchComponent implements OnInit, OnChanges {
// Sends an array containing all filters
public
applyFilter
(
term
:
string
):
void
{
// Add search input filter
if
(
term
)
{
this
.
location
.
go
(
'
/acteurs?search=
'
+
term
);
}
else
{
this
.
location
.
go
(
'
/acteurs
'
);
}
this
.
queryString
=
this
.
activatedRoute
.
snapshot
.
queryParamMap
.
get
(
'
search
'
);
console
.
log
(
'
query string is:
'
,
this
.
queryString
);
const
filters
:
Filter
[]
=
[];
if
(
term
)
{
filters
.
push
(
new
Filter
(
'
query
'
,
term
));
...
...
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