Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polish-community-beth
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
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
Beth Davies
polish-community-beth
Commits
8eb919b3
Commit
8eb919b3
authored
4 months ago
by
Beth Davies
Browse files
Options
Downloads
Patches
Plain Diff
Fix javascript functionality
parent
89684a2d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/resources/static/js/layout/accountDropdown.js
+18
-0
18 additions, 0 deletions
src/main/resources/static/js/layout/accountDropdown.js
src/main/resources/templates/layout/layout.html
+2
-2
2 additions, 2 deletions
src/main/resources/templates/layout/layout.html
with
20 additions
and
2 deletions
src/main/resources/static/js/layout/
layout
.js
→
src/main/resources/static/js/layout/
accountDropdown
.js
+
18
−
0
View file @
8eb919b3
document
.
addEventListener
(
'
DOMContentLoaded
'
,
function
()
{
const
accountOptions
=
document
.
getElement
s
By
ClassName
(
'
account-options
'
);
const
accountOptions
=
document
.
getElementBy
Id
(
'
account-options
'
);
const
dropdownContent
=
document
.
getElementsByClassName
(
'
dropdown-content
'
);
accountOptions
.
addEventListener
(
'
click
'
,
function
(
e
)
{
if
(
window
.
innerWidth
<=
768
)
{
e
.
preventDefault
();
dropdownContent
.
style
.
display
=
dropdownContent
.
style
.
display
===
'
block
'
?
'
none
'
:
'
block
'
;
}
[...
dropdownContent
].
forEach
(
dropdown
=>
{
dropdown
.
style
.
display
=
dropdown
.
style
.
display
===
'
block
'
?
'
none
'
:
'
block
'
});
});
//hide dropdown when user clicks outside of element
document
.
addEventListener
(
'
click
'
,
function
(
e
)
{
if
(
!
accountOptions
.
contains
(
e
.
target
))
{
dropdownContent
.
style
.
display
=
'
none
'
;
[...
dropdownContent
]
.
style
.
display
=
'
none
'
;
}
});
window
.
addEventListener
(
'
resize
'
,
function
()
{
if
(
window
.
innerWidth
>
768
)
{
dropdownContent
.
style
.
display
=
''
;
}
});
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/resources/templates/layout/layout.html
+
2
−
2
View file @
8eb919b3
...
...
@@ -62,7 +62,7 @@
</div>
<!-- Profile -->
<div
class
=
"account-options"
id=
"dropdown"
>
<div
id
=
"account-options"
>
<div
sec:authorize=
"isAnonymous()"
>
<img
src=
"/assets/navbarImages/profile.png"
class=
"navIcons anonymous"
>
<span
class=
"navText"
>
Sign in
</span>
...
...
@@ -123,6 +123,6 @@
</div>
</footer>
<script
th:replace=
"~{comments/commentFragment::commentScript}"
></script>
<script
src=
"/js/layout/
layout
.js"
></script>
<script
src=
"/js/layout/
accountDropdown
.js"
></script>
</body>
</html>
\ No newline at end of file
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