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
ae0f87a0
Commit
ae0f87a0
authored
3 years ago
by
Arnaud Levy
Browse files
Options
Downloads
Patches
Plain Diff
Wip #183
parent
2a2865bc
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/models/communication/website/menu/item.rb
+73
-36
73 additions, 36 deletions
app/models/communication/website/menu/item.rb
with
73 additions
and
36 deletions
app/models/communication/website/menu/item.rb
+
73
−
36
View file @
ae0f87a0
...
...
@@ -80,47 +80,84 @@ class Communication::Website::Menu::Item < ApplicationRecord
target
=
nil
active
=
website
.
send
"menu_item_kind_
#{
kind
}
?"
return
nil
unless
active
case
self
.
kind
when
'blank'
target
=
''
when
'url'
target
=
url
when
'page'
target
=
about
.
path
if
about
&
.
published
when
'programs'
target
=
"/
#{
website
.
structure
.
education_programs_path
}
"
when
'program'
target
=
"/
#{
website
.
structure
.
education_programs_path
}#{
about
.
path
}
"
when
'news'
target
=
"/
#{
website
.
structure
.
communication_posts_path
}
"
when
'news_article'
target
=
"/
#{
website
.
structure
.
communication_posts_path
}#{
about
.
path
}
"
if
about
&
.
published
&&
about
&
.
published_at
when
'staff'
target
=
"/
#{
website
.
structure
.
persons_path
}
"
when
'administrators'
target
=
"/
#{
website
.
structure
.
administrators_path
}
"
when
'authors'
target
=
"/
#{
website
.
structure
.
authors_path
}
"
when
'researchers'
target
=
"/
#{
website
.
structure
.
researchers_path
}
"
when
'teachers'
target
=
"/
#{
website
.
structure
.
teachers_path
}
"
when
'research_volumes'
target
=
"/
#{
website
.
structure
.
research_volumes_path
}
"
when
'research_volume'
target
=
"/
#{
website
.
structure
.
research_volumes_path
}#{
about
.
path
}
"
if
about
&
.
published
&&
about
&
.
published_at
when
'research_articles'
target
=
"/
#{
website
.
structure
.
research_articles_path
}
"
when
'research_article'
target
=
"/
#{
website
.
structure
.
research_articles_path
}#{
about
.
path
}
"
if
about
&
.
published
&&
about
&
.
published_at
else
target
=
about
&
.
path
end
method
=
"target_for_
#{
kind
}
"
target
=
respond_to?
(
method
)
?
send
(
method
)
:
about
&
.
path
byebug
return
nil
if
target
.
nil?
target
.
end_with?
(
'/'
)
?
target
:
"
#{
target
}
/"
end
def
target_for_blank
''
end
def
target_for_url
url
end
def
target_for_page
about
.
path
if
about
&
.
published
end
def
target_for_programs
"/
#{
website
.
structure
.
education_programs_path
}
"
end
def
target_for_program
"/
#{
website
.
structure
.
education_programs_path
}#{
about
.
path
}
"
end
def
target_for_news
"/
#{
website
.
structure
.
communication_posts_path
}
"
end
def
target_for_news_article
"/
#{
website
.
structure
.
communication_posts_path
}#{
about
.
path
}
"
if
about
&
.
published
&&
about
&
.
published_at
end
def
target_for_news_category
# TODO use communication_categories_path
"/
#{
website
.
structure
.
communication_posts_path
}
/categories
#{
about
.
path
}
"
if
about
end
def
target_for_staff
"/
#{
website
.
structure
.
persons_path
}
"
end
def
target_for_administrators
"/
#{
website
.
structure
.
administrators_path
}
"
end
def
target_for_authors
"/
#{
website
.
structure
.
authors_path
}
"
end
def
target_for_researchers
"/
#{
website
.
structure
.
researchers_path
}
"
end
def
target_for_teachers
"/
#{
website
.
structure
.
teachers_path
}
"
end
def
target_for_research_volumes
"/
#{
website
.
structure
.
research_volumes_path
}
"
end
def
target_for_research_volume
"/
#{
website
.
structure
.
research_volumes_path
}#{
about
.
path
}
"
if
about
&
.
published
&&
about
&
.
published_at
end
def
target_for_research_articles
"/
#{
website
.
structure
.
research_articles_path
}
"
end
def
target_for_research_article
"/
#{
website
.
structure
.
research_articles_path
}#{
about
.
path
}
"
if
about
&
.
published
&&
about
&
.
published_at
end
def
list_of_other_items
items
=
[]
menu
.
items
.
where
.
not
(
id:
id
).
root
.
ordered
.
each
do
|
item
|
...
...
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