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
b1752cb0
Commit
b1752cb0
authored
2 years ago
by
Arnaud Levy
Browse files
Options
Downloads
Patches
Plain Diff
fix
parent
3ba3d9f9
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/block/template/post.rb
+4
-10
4 additions, 10 deletions
app/models/communication/block/template/post.rb
with
4 additions
and
10 deletions
app/models/communication/block/template/post.rb
+
4
−
10
View file @
b1752cb0
...
...
@@ -16,13 +16,7 @@ class Communication::Block::Template::Post < Communication::Block::Template
end
def
selected_posts
if
kind
==
'all'
@selected_posts
||=
all_posts
elsif
kind
==
'selection'
@selected_posts
||=
free_posts
elsif
kind
==
'category'
@selected_posts
||=
category_posts
end
@selected_posts
||=
send
"selected_posts_
#{
kind
}
"
end
protected
...
...
@@ -31,17 +25,17 @@ class Communication::Block::Template::Post < Communication::Block::Template
@kind
||=
data
[
'kind'
]
||
'all'
end
def
all
_posts
def
selected
_posts
_all
quantity
=
data
[
'posts_quantity'
]
||
3
block
.
about
&
.
website
.
posts
.
ordered
.
limit
(
quantity
)
end
def
category
_posts
def
selected_posts_
category
quantity
=
data
[
'posts_quantity'
]
||
3
category
.
posts
.
ordered
.
limit
(
quantity
)
end
def
free
_posts
def
selected
_posts
_free
elements
.
map
{
|
element
|
post
(
element
[
'id'
])
}
.
compact
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