mirror of
https://0xacab.org/sutty/sutty
synced 2025-02-22 14:31:48 +00:00
si no enviamos fecha hay que poner una por defecto
This commit is contained in:
parent
0dc9d1d157
commit
593b087ba1
1 changed files with 6 additions and 0 deletions
|
@ -413,6 +413,7 @@ class Post
|
||||||
|
|
||||||
def cleanup!
|
def cleanup!
|
||||||
things_to_arrays!
|
things_to_arrays!
|
||||||
|
default_date_is_today!
|
||||||
date_to_time!
|
date_to_time!
|
||||||
clean_content!
|
clean_content!
|
||||||
slugify_title!
|
slugify_title!
|
||||||
|
@ -501,12 +502,17 @@ class Post
|
||||||
@errors
|
@errors
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def default_date_is_today!
|
||||||
|
set_front_matter('date', Time.now) unless date
|
||||||
|
end
|
||||||
|
|
||||||
def date_to_time!
|
def date_to_time!
|
||||||
unless @front_matter.dig(:date).is_a? Time
|
unless @front_matter.dig(:date).is_a? Time
|
||||||
@front_matter['date'] = @front_matter.dig('date').try(:to_time) || Time.now
|
@front_matter['date'] = @front_matter.dig('date').try(:to_time) || Time.now
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# XXX es necesario ahora que tenemos select2?
|
||||||
def things_to_arrays!
|
def things_to_arrays!
|
||||||
[:tags,:categories].each do |c|
|
[:tags,:categories].each do |c|
|
||||||
thing = @front_matter.dig(c.to_s)
|
thing = @front_matter.dig(c.to_s)
|
||||||
|
|
Loading…
Reference in a new issue