-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove content type sorting constraint #58
Conversation
- Also if the content type doesn't exist in the given preferred_order variable, put the layout at the end of the manifest
lib/voog/dtk/filemanager.rb
Outdated
|
||
layouts.sort do |a, b| | ||
preferred_order.index(a.fetch('content_type')) <=> preferred_order.index(b.fetch('content_type')) | ||
(preferred_order.index(a.fetch('content_type')) <=> preferred_order.index(b.fetch('content_type'))) || 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See ei tööta PR kirjelduses välja reklaamitud kujul (eeldan, et pead siin silmas layouts
struktuuri lõppu sorteerimist):
Additionally, if the content type doesn't exist in the given
preferred_order
array, sort the layout to the end of themanifest.json
file.
Nt konstrueerides struktuur:
layouts = [
{
"content_type" => "product",
},
{
"content_type" => "page",
},
{
"content_type" => "blog_article",
},
{
"content_type" => "blog",
},
{
"content_type" => "ding",
},
{
"content_type" => "dong",
},
]
on tulemus:
"layouts": [
{
"content_type": "ding"
},
{
"content_type": "dong"
},
{
"content_type": "page"
},
{
"content_type": "blog"
},
{
"content_type": "blog_article"
},
{
"content_type": "product"
}
]
Peaks olema:
(preferred_order.index(a.fetch('content_type')) <=> preferred_order.index(b.fetch('content_type'))) || 1 | |
type_index = ->(e) { preferred_order.index(e['content_type']) || Float::INFINITY } | |
layouts.sort { |a, b| type_index[a] <=> type_index[b] } |
Ühtlasi peaks see meetod private
olema.
Closes #56. Closes #57.