5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-07-02 10:56:08 +00:00

usar el orden cronológico inverso

This commit is contained in:
f 2019-10-17 16:18:38 -03:00
parent 74e47274ff
commit e87643acd4
No known key found for this signature in database
GPG key ID: 2AE5A13E321F953D
2 changed files with 7 additions and 3 deletions

View file

@ -173,9 +173,13 @@ class Site < ApplicationRecord
@posts[lang] = PostRelation.new site: self
# Jekyll lee los documentos en orden cronológico pero los invierte
# durante la renderización. Usamos el orden cronológico inverso por
# defecto para mostrar los artículos más nuevos primero.
docs = collections[lang.to_s].try(:docs).try(:sort) { |a, b| b <=> a }
# No fallar si no existe colección para este idioma
# XXX: queremos fallar silenciosamente?
(collections[lang.to_s].try(:docs) || []).each do |doc|
(docs || []).each do |doc|
layout = layouts[doc.data['layout'].to_sym]
@posts[lang].build(document: doc, layout: layout, lang: lang)

View file

@ -48,7 +48,7 @@ class EditorTest < ActionDispatch::IntegrationTest
}
}
@post = @site.posts.last
@post = @site.posts.first
assert_equal md_content.strip, @post.content.value
end
@ -67,7 +67,7 @@ class EditorTest < ActionDispatch::IntegrationTest
}
}
@post = @site.posts.last
@post = @site.posts.first
assert_equal trix_md.strip, @post.content.value
end