Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rescheduled 🗓️
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Analyze
Contributor analytics
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
c3lingo
rescheduled 🗓️
Commits
983451ad
Commit
983451ad
authored
2 weeks ago
by
Teal Bauer
Committed by
Teal
2 weeks ago
Browse files
Options
Downloads
Patches
Plain Diff
Bring back mobile hamburger
parent
c2adebb3
No related branches found
Branches containing commit
No related tags found
1 merge request
!37
Bring back mobile hamburger
Pipeline
#38427
passed
2 weeks ago
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/views/layouts/application.html.erb
+52
-12
52 additions, 12 deletions
app/views/layouts/application.html.erb
with
52 additions
and
12 deletions
app/views/layouts/application.html.erb
+
52
−
12
View file @
983451ad
...
...
@@ -76,9 +76,8 @@
</button>
<!-- Mobile dropdown menu -->
<div
id=
"main-mobile-menu"
class=
"hidden absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 rounded shadow-lg z-50"
>
<div
id=
"main-mobile-menu"
class=
"hidden absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 rounded shadow-lg
border border-gray-200 dark:border-gray-700
z-50"
>
<div
class=
"py-2"
>
<div
class=
"px-4 py-2 font-semibold text-sm text-gray-500 dark:text-gray-400 border-b border-gray-200 dark:border-gray-700"
>
Navigation
</div>
<%=
link_to
'Conferences'
,
conferences_path
,
class:
'block px-4 py-2 text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700'
%>
<%=
link_to
'Assignments'
,
assignments_path
,
class:
'block px-4 py-2 text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700'
%>
...
...
@@ -102,8 +101,29 @@
<!-- Not logged in state -->
<div
class=
"flex items-center space-x-4"
>
<span
class=
"px-2 text-gray-600 dark:text-gray-300 hidden md:inline"
>
not logged in
</span>
<%=
link_to
"Assignments"
,
assignments_path
,
class:
"text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-white"
%>
<%=
link_to
"Log in"
,
new_user_session_path
,
class:
"text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-white"
%>
<%=
link_to
"Sign Up"
,
new_user_registration_path
,
class:
"text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-white"
%>
</div>
<!-- Mobile hamburger menu for non-logged in users -->
<div
class=
"md:hidden relative ml-4"
>
<button
id=
"guest-menu-toggle"
class=
"text-gray-900 dark:text-white"
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
class=
"h-6 w-6"
fill=
"none"
viewBox=
"0 0 24 24"
stroke=
"currentColor"
>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
stroke-width=
"2"
d=
"M4 6h16M4 12h16M4 18h16"
/>
</svg>
</button>
<!-- Mobile dropdown menu for guests -->
<div
id=
"guest-mobile-menu"
class=
"hidden absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 rounded shadow-lg border border-gray-200 dark:border-gray-700 z-50"
>
<div>
<%=
link_to
'Conferences'
,
conferences_path
,
class:
'block px-4 py-2 text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700'
%>
<%=
link_to
'Assignments'
,
assignments_path
,
class:
'block px-4 py-2 text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700'
%>
<div
class=
"px-4 py-2 font-semibold text-sm text-gray-500 dark:text-gray-400 border-b border-gray-200 dark:border-gray-700 mt-2"
>
Account
</div>
<%=
link_to
"Log in"
,
new_user_session_path
,
class:
'block px-4 py-2 text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700'
%>
<%=
link_to
"Sign Up"
,
new_user_registration_path
,
class:
'block px-4 py-2 text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700'
%>
</div>
</div>
</div>
<%
end
%>
</nav>
...
...
@@ -111,7 +131,8 @@
</header>
<script>
function
initializeMainNavMenu
()
{
function
initializeNavMenus
()
{
// Initialize main menu for logged in users
const
menuToggle
=
document
.
getElementById
(
'
main-menu-toggle
'
);
const
mobileMenu
=
document
.
getElementById
(
'
main-mobile-menu
'
);
...
...
@@ -124,22 +145,41 @@
e
.
stopPropagation
();
mobileMenu
.
classList
.
toggle
(
'
hidden
'
);
});
}
// Initialize guest menu for non-logged in users
const
guestMenuToggle
=
document
.
getElementById
(
'
guest-menu-toggle
'
);
const
guestMobileMenu
=
document
.
getElementById
(
'
guest-mobile-menu
'
);
if
(
guestMenuToggle
&&
guestMobileMenu
)
{
// Remove any existing event listeners to prevent duplicates
const
newGuestMenuToggle
=
guestMenuToggle
.
cloneNode
(
true
);
guestMenuToggle
.
parentNode
.
replaceChild
(
newGuestMenuToggle
,
guestMenuToggle
);
// Close the menu when clicking outside
document
.
addEventListener
(
'
click
'
,
function
(
e
)
{
if
(
mobileMenu
&&
!
mobileMenu
.
contains
(
e
.
target
)
&&
e
.
target
!==
newMenuToggle
)
{
mobileMenu
.
classList
.
add
(
'
hidden
'
);
}
newGuestMenuToggle
.
addEventListener
(
'
click
'
,
function
(
e
)
{
e
.
stopPropagation
();
guestMobileMenu
.
classList
.
toggle
(
'
hidden
'
);
});
}
// Close all menus when clicking outside
document
.
addEventListener
(
'
click
'
,
function
(
e
)
{
if
(
mobileMenu
&&
!
mobileMenu
.
contains
(
e
.
target
)
&&
e
.
target
!==
menuToggle
)
{
mobileMenu
.
classList
.
add
(
'
hidden
'
);
}
if
(
guestMobileMenu
&&
!
guestMobileMenu
.
contains
(
e
.
target
)
&&
e
.
target
!==
guestMenuToggle
)
{
guestMobileMenu
.
classList
.
add
(
'
hidden
'
);
}
});
}
// Initialize on DOMContentLoaded
document
.
addEventListener
(
'
DOMContentLoaded
'
,
initialize
Main
NavMenu
);
document
.
addEventListener
(
'
DOMContentLoaded
'
,
initializeNavMenu
s
);
// Re-initialize on Turbo navigation
document
.
addEventListener
(
'
turbo:load
'
,
initialize
Main
NavMenu
);
document
.
addEventListener
(
'
turbo:render
'
,
initialize
Main
NavMenu
);
document
.
addEventListener
(
'
turbo:load
'
,
initializeNavMenu
s
);
document
.
addEventListener
(
'
turbo:render
'
,
initializeNavMenu
s
);
</script>
<main>
...
...
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