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
fa8f3092
Commit
fa8f3092
authored
1 year ago
by
pabois
Browse files
Options
Downloads
Patches
Plain Diff
adjust
parent
b36b21da
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/with_menus.rb
+11
-5
11 additions, 5 deletions
app/models/communication/website/with_menus.rb
with
11 additions
and
5 deletions
app/models/communication/website/with_menus.rb
+
11
−
5
View file @
fa8f3092
...
...
@@ -87,13 +87,19 @@ module Communication::Website::WithMenus
end
def
find_or_create_menu
(identifier,
language)
menu
=
menus
.
where
(
identifier:
identifier
,
university:
university,
language:
language
)
.
first_or_initialize
do
|menu|
menu
=
menus
_for_language(language)
.
where
(
identifier:
identifier)
.
first_or_initialize
do
|menu|
menu
.
title
=
I18n
.
t
(
"communication.website.menus.default_title.
#{
identifier
}
"
,
locale:
language
.
iso_code
)
if
language
.
id
!=
default_language_
id
menu_original
=
menus
.
where
(
identifier:
identifier,
university:
university,
language:
default_language)
.
first
menu
.
original_id
=
menu_original
.
id
end
menu
.
original_id
=
original_menu(identifier)
.
id
if
language
.
id
!=
default_language_
id
end
menu
.
save
unless
menu
.
persisted?
end
def
menus_for_language
(language)
menus
.
where
(
university:
university,
language:
language)
end
def
original_menu
(identifier)
menus_for_language(default_language)
.
where
(
identifier:
identifier)
.
first
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