Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Admin
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
osuny
Admin
Commits
7d33be7c
Commit
7d33be7c
authored
3 years ago
by
Arnaud Levy
Browse files
Options
Downloads
Patches
Plain Diff
refactor
parent
c88658e2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/services/appstack/simple_navigation_renderer.rb
+18
-26
18 additions, 26 deletions
app/services/appstack/simple_navigation_renderer.rb
with
18 additions
and
26 deletions
app/services/appstack/simple_navigation_renderer.rb
+
18
−
26
View file @
7d33be7c
...
...
@@ -12,34 +12,26 @@ class Appstack::SimpleNavigationRenderer < SimpleNavigation::Renderer::Base
protected
def
make
(
item
)
options
=
item
.
send
:options
icon
=
options
[
:icon
]
classes
=
item
.
html_options
[
:class
]
include_sub_navigation
=
consider_sub_navigation?
(
item
)
container
=
item
.
send
:container
level
=
container
.
send
:level
content
=
"
<li class=
\"
sidebar-item
#{
classes
}
\"
>"
content
+=
"<a href=
\"
#{
item
.
url
}
\"
class=
\"
sidebar-link
#{
' collapsed'
unless
item
.
selected?
}
\"
"
content
+=
" data-bs-target=
\"
#
#{
item
.
key
}
\"
data-bs-toggle=
\"
collapse
\"
"
if
include_sub_navigation
content
+=
">"
content
+=
"<i class=
\"
fas fa-
#{
options
[
:icon
].
to_s
}
\"
></i>"
if
icon
content
+=
'<span class="align-middle">'
if
level
==
1
content
+=
item
.
name
content
+=
'</span>'
if
level
==
1
content
+=
'</a>'
content
+=
make_subnavigation
(
item
,
level
)
if
include_sub_navigation
content
+=
'</li>'
content
li
=
"<li class=
\"
sidebar-item
#{
item
.
html_options
[
:class
]
}
\"
>"
li
+=
make_a
(
item
)
li
+=
make_subnavigation
(
item
)
if
consider_sub_navigation?
(
item
)
li
+=
'</li>'
li
end
def
make_subnavigation
(
item
,
level
)
content
=
"
<ul id=
\"
#{
item
.
key
}
\"
class=
\"
sidebar-dropdown list-unstyled
#{
item
.
selected?
?
'show'
:
'collapse'
}
\"
>"
content
+=
render_sub_navigation_for
(
item
)
content
+=
'
</ul>'
content
def
make_a
(
item
)
icon
=
item
.
send
(
:options
)[
:icon
]
a
=
"<a href=
\"
#{
item
.
url
}
\"
class=
\"
sidebar-link
#{
item
.
selected?
?
''
:
' collapsed'
}
\"
"
a
+=
" data-bs-target=
\"
#
#{
item
.
key
}
\"
data-bs-toggle=
\"
collapse
\"
"
if
consider_sub_navigation?
(
item
)
a
+=
">"
a
+=
"<i class=
\"
fas fa-
#{
icon
}
\"
></i>"
if
icon
a
+=
"<span class=
\"
align-middle
\"
>
#{
item
.
name
}
</span></a>"
a
end
def
make_subnavigation
(
item
)
"<ul id=
\"
#{
item
.
key
}
\"
class=
\"
sidebar-dropdown list-unstyled
#{
item
.
selected?
?
'show'
:
'collapse'
}
\"
>
#{
render_sub_navigation_for
item
}
</ul>"
end
end
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