mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-15 02:21:42 +00:00
empezar a implementar layouts
This commit is contained in:
parent
da58998039
commit
8d622d625f
3 changed files with 3 additions and 5 deletions
|
@ -31,8 +31,7 @@ class PostsController < ApplicationController
|
|||
def new
|
||||
authorize Post
|
||||
@site = find_site
|
||||
# TODO: Implementar layout
|
||||
@post = @site.posts.build(lang: I18n.locale)
|
||||
@post = @site.posts.build(lang: I18n.locale, layout: params[:layout])
|
||||
end
|
||||
|
||||
def create
|
||||
|
|
|
@ -57,7 +57,7 @@ class PostRelation < Array
|
|||
def build_layout(layout = nil)
|
||||
return layout if layout.is_a? Layout
|
||||
|
||||
site.layouts[layout || :post]
|
||||
site.layouts[layout.try(:to_sym) || :post]
|
||||
end
|
||||
|
||||
# Devuelve una colección Jekyll que hace pasar el documento
|
||||
|
|
|
@ -206,8 +206,7 @@ class Site < ApplicationRecord
|
|||
# @return Array
|
||||
def everything_of(attr, lang: nil)
|
||||
posts(lang: lang).map do |p|
|
||||
# XXX: Tener cuidado con los métodos que no existan
|
||||
p.send(attr).try :value
|
||||
p.send(attr).try(:value) if p.attribute? attr
|
||||
end.flatten.uniq.compact
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue