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
321ff630
Commit
321ff630
authored
3 years ago
by
Arnaud Levy
Browse files
Options
Downloads
Patches
Plain Diff
refactor
parent
cfc6f117
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
+8
-72
8 additions, 72 deletions
app/models/communication/website/menu/item.rb
with
8 additions
and
72 deletions
app/models/communication/website/menu/item.rb
+
8
−
72
View file @
321ff630
...
...
@@ -34,6 +34,7 @@
class
Communication::Website::Menu::Item
<
ApplicationRecord
include
WithTree
include
WithPosition
include
WithTargets
attr_accessor
:skip_publication_callback
...
...
@@ -80,6 +81,7 @@ class Communication::Website::Menu::Item < ApplicationRecord
target
=
nil
active
=
website
.
send
"menu_item_kind_
#{
kind
}
?"
return
nil
unless
active
# Les méthodes target_for_ sont définies dans le concern WithTarget
method
=
"target_for_
#{
kind
}
"
target
=
respond_to?
(
method
)
?
send
(
method
)
:
about
&
.
path
...
...
@@ -88,75 +90,6 @@ class Communication::Website::Menu::Item < ApplicationRecord
:
"
#{
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
|
...
...
@@ -177,9 +110,12 @@ class Communication::Website::Menu::Item < ApplicationRecord
end
def
has_about?
kind_page?
||
kind_program?
||
kind_news_category?
||
kind_news_article?
||
kind_research_volume?
||
kind_research_article?
kind_page?
||
kind_program?
||
kind_news_category?
||
kind_news_article?
||
kind_research_volume?
||
kind_research_article?
end
def
sync_menu
...
...
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