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
cdb1405f
Commit
cdb1405f
authored
2 years ago
by
Arnaud Levy
Browse files
Options
Downloads
Patches
Plain Diff
fix
parent
fa65ffa4
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/block/template/page.rb
+16
-11
16 additions, 11 deletions
app/models/communication/block/template/page.rb
app/models/communication/website/page.rb
+10
-3
10 additions, 3 deletions
app/models/communication/website/page.rb
with
26 additions
and
14 deletions
app/models/communication/block/template/page.rb
+
16
−
11
View file @
cdb1405f
class
Communication::Block::Template::Page
<
Communication
::
Block
::
Template
def
build_git_dependencies
add_dependency
selected_pages
selected_pages
.
each
do
|
page
|
add_dependency
main_page
.
page
selected_pages
.
each
do
|
hash
|
page
=
hash
.
page
add_dependency
page
add_dependency
page
.
active_storage_blobs
end
end
...
...
@@ -26,15 +28,18 @@ class Communication::Block::Template::Page < Communication::Block::Template
def
free_pages
elements
.
map
{
|
element
|
p
=
page
(
element
[
'id'
])
next
if
p
.
nil?
{
page:
p
,
show_description:
element
[
'show_description'
]
||
false
,
show_image:
element
[
'show_image'
]
||
false
}.
to_dot
}
.
compact
p
=
page
(
element
[
'id'
])
next
if
p
.
nil?
hash_from_page
(
p
,
element
)
}.
compact
end
def
hash_from_page
(
page
,
element
)
{
page:
page
,
show_description:
element
[
'show_description'
]
||
false
,
show_image:
element
[
'show_image'
]
||
false
}.
to_dot
end
def
page
(
id
)
...
...
This diff is collapsed.
Click to expand it.
app/models/communication/website/page.rb
+
10
−
3
View file @
cdb1405f
...
...
@@ -74,9 +74,16 @@ class Communication::Website::Page < ApplicationRecord
validates
:title
,
presence:
true
validates
:slug
,
presence:
true
,
unless: :kind_home?
validate
:slug_must_be_unique
validates
:slug
,
format:
{
with:
/\A[a-z0-9\-]+\z/
,
message:
I18n
.
t
(
'slug_error'
)
},
unless: :kind_home?
validates
:slug
,
presence:
true
,
unless: :kind_home?
validate
:slug_must_be_unique
validates
:slug
,
format:
{
with:
/\A[a-z0-9\-]+\z/
,
message:
I18n
.
t
(
'slug_error'
)
},
unless: :kind_home?
before_validation
:check_slug
,
:make_path
after_save
:update_children_paths
,
if: :saved_change_to_path?
...
...
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