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
2e6dbaf8
Unverified
Commit
2e6dbaf8
authored
1 year ago
by
Sébastien Gaya
Browse files
Options
Downloads
Patches
Plain Diff
fix
parent
dbd578c5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/models/communication/website/page.rb
+1
-0
1 addition, 0 deletions
app/models/communication/website/page.rb
app/models/communication/website/with_special_pages.rb
+7
-1
7 additions, 1 deletion
app/models/communication/website/with_special_pages.rb
with
8 additions
and
1 deletion
app/models/communication/website/page.rb
+
1
−
0
View file @
2e6dbaf8
...
@@ -103,6 +103,7 @@ class Communication::Website::Page < ApplicationRecord
...
@@ -103,6 +103,7 @@ class Communication::Website::Page < ApplicationRecord
end
end
def
references
def
references
[
parent
]
+
menu_items
menu_items
end
end
...
...
This diff is collapsed.
Click to expand it.
app/models/communication/website/with_special_pages.rb
+
7
−
1
View file @
2e6dbaf8
...
@@ -28,6 +28,12 @@ module Communication::Website::WithSpecialPages
...
@@ -28,6 +28,12 @@ module Communication::Website::WithSpecialPages
def
translate_special_page
(
type
,
language
)
def
translate_special_page
(
type
,
language
)
# Not found for given language, we create it from the page in default_language
# Not found for given language, we create it from the page in default_language
original_special_page
=
pages
.
where
(
type:
type
.
to_s
,
language_id:
default_language_id
).
first
original_special_page
=
pages
.
where
(
type:
type
.
to_s
,
language_id:
default_language_id
).
first
original_special_page
.
translate!
(
language
)
if
original_special_page
.
present?
return
unless
original_special_page
.
present?
translated_special_page
=
original_special_page
.
translate!
(
language
)
# When we translate a new post, it will generate the permalink by looking for the posts special page
# It will try to find it, or translate it if not found
# At this moment, we need to sync the page with git (in case it's already published)
translated_special_page
.
sync_with_git
translated_special_page
end
end
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