Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ELC_elections
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
gestion-des-assemblees
ELC_elections
Commits
382bae09
Commit
382bae09
authored
4 years ago
by
Alexis POYEN
Browse files
Options
Downloads
Patches
Plain Diff
Refactor : factorize code of select area in results
parent
05337d8c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
web/components/visualization/results-zone.js
+19
-26
19 additions, 26 deletions
web/components/visualization/results-zone.js
with
19 additions
and
26 deletions
web/components/visualization/results-zone.js
+
19
−
26
View file @
382bae09
...
@@ -165,7 +165,8 @@ class ResultZoneComponent {
...
@@ -165,7 +165,8 @@ class ResultZoneComponent {
}
}
}
else
if
(
event
.
target
.
id
==
"
select-sections
"
)
{
}
else
if
(
event
.
target
.
id
==
"
select-sections
"
)
{
let
area
=
resultHandler
.
parent
.
results
.
areasResults
.
find
(
let
area
=
resultHandler
.
parent
.
results
.
areasResults
.
find
(
(
areaFind
)
=>
areaFind
.
ID
==
document
.
getElementById
(
"
select-areas
"
).
value
(
areaFind
)
=>
areaFind
.
ID
==
document
.
getElementById
(
"
select-areas
"
).
value
);
);
let
section
=
area
.
Sections
.
find
(
let
section
=
area
.
Sections
.
find
(
(
sectionFind
)
=>
sectionFind
.
ID
==
event
.
target
.
value
(
sectionFind
)
=>
sectionFind
.
ID
==
event
.
target
.
value
...
@@ -342,42 +343,19 @@ class ResultZoneComponent {
...
@@ -342,42 +343,19 @@ class ResultZoneComponent {
}
}
displayAreasResults
()
{
displayAreasResults
()
{
let
selectAreas
=
document
.
getElementById
(
"
select-a
reas
"
);
this
.
refreshA
reas
(
);
document
.
getElementById
(
"
select-sections
"
).
parentNode
.
style
.
display
=
document
.
getElementById
(
"
select-sections
"
).
parentNode
.
style
.
display
=
"
none
"
;
"
none
"
;
for
(
let
i
=
selectAreas
.
options
.
length
-
1
;
i
>=
0
;
i
--
)
{
selectAreas
.
remove
(
i
);
}
this
.
parent
.
results
.
areasResults
.
forEach
((
area
)
=>
{
let
el
=
document
.
createElement
(
"
option
"
);
el
.
textContent
=
area
.
Name
;
el
.
value
=
area
.
ID
;
selectAreas
.
appendChild
(
el
);
});
if
(
this
.
parent
.
zone
==
"
areas
"
&&
this
.
areaDisplayed
!=
undefined
)
{
if
(
this
.
parent
.
zone
==
"
areas
"
&&
this
.
areaDisplayed
!=
undefined
)
{
document
.
getElementById
(
"
select-areas
"
).
value
=
this
.
areaDisplayed
.
ID
;
document
.
getElementById
(
"
select-areas
"
).
value
=
this
.
areaDisplayed
.
ID
;
}
else
this
.
displayZoneResults
(
this
.
parent
.
results
.
areasResults
[
0
]);
}
else
this
.
displayZoneResults
(
this
.
parent
.
results
.
areasResults
[
0
]);
}
}
displaySectionsResults
()
{
displaySectionsResults
()
{
let
selectAreas
=
document
.
getElementById
(
"
select-a
reas
"
);
this
.
refreshA
reas
(
);
document
.
getElementById
(
"
select-sections
"
).
parentNode
.
style
.
display
=
document
.
getElementById
(
"
select-sections
"
).
parentNode
.
style
.
display
=
"
block
"
;
"
block
"
;
for
(
let
i
=
selectAreas
.
options
.
length
-
1
;
i
>=
0
;
i
--
)
{
selectAreas
.
remove
(
i
);
}
this
.
parent
.
results
.
areasResults
.
forEach
((
area
)
=>
{
let
el
=
document
.
createElement
(
"
option
"
);
el
.
textContent
=
area
.
Name
;
el
.
value
=
area
.
ID
;
selectAreas
.
appendChild
(
el
);
});
this
.
refreshSections
(
this
.
parent
.
results
.
areasResults
[
0
]);
this
.
refreshSections
(
this
.
parent
.
results
.
areasResults
[
0
]);
if
(
this
.
parent
.
zone
==
"
sections
"
&&
this
.
sectionDisplayed
!=
undefined
)
{
if
(
this
.
parent
.
zone
==
"
sections
"
&&
this
.
sectionDisplayed
!=
undefined
)
{
...
@@ -524,4 +502,19 @@ class ResultZoneComponent {
...
@@ -524,4 +502,19 @@ class ResultZoneComponent {
selectSections
.
appendChild
(
el
);
selectSections
.
appendChild
(
el
);
}
}
}
}
refreshAreas
()
{
let
selectAreas
=
document
.
getElementById
(
"
select-areas
"
);
for
(
let
i
=
selectAreas
.
options
.
length
-
1
;
i
>=
0
;
i
--
)
{
selectAreas
.
remove
(
i
);
}
this
.
parent
.
results
.
areasResults
.
forEach
((
area
)
=>
{
let
el
=
document
.
createElement
(
"
option
"
);
el
.
textContent
=
area
.
Name
;
el
.
value
=
area
.
ID
;
selectAreas
.
appendChild
(
el
);
});
}
}
}
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