mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 08:26:23 +00:00
archivos faltantes :$
This commit is contained in:
parent
6b03f71e53
commit
0af59fa625
5 changed files with 48 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -25,6 +25,7 @@
|
|||
/_sites/*
|
||||
/_deploy/*
|
||||
/data/*
|
||||
/_storage/*
|
||||
|
||||
.env
|
||||
|
||||
|
|
27
app/models/metadata_locales.rb
Normal file
27
app/models/metadata_locales.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Los valores de este metadato son artículos en otros idiomas
|
||||
class MetadataLocales < MetadataTemplate
|
||||
def default_value
|
||||
[]
|
||||
end
|
||||
|
||||
# Todos los valores posibles para cada idioma disponible
|
||||
#
|
||||
# TODO: Optimizar?
|
||||
#
|
||||
# @return { lang: { title: uuid } }
|
||||
def values
|
||||
@values ||= site.locales.map do |locale|
|
||||
{
|
||||
locale.to_sym => site.posts(lang: locale).map do |post|
|
||||
{ post.title.value => post.uuid.value }
|
||||
end.inject(:merge)
|
||||
}
|
||||
end.inject(:merge)
|
||||
end
|
||||
|
||||
def to_param
|
||||
{ name => [] }
|
||||
end
|
||||
end
|
3
app/models/metadata_markdown.rb
Normal file
3
app/models/metadata_markdown.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class MetadataMarkdown < MetadataText; end
|
9
app/models/metadata_markdown_content.rb
Normal file
9
app/models/metadata_markdown_content.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class MetadataMarkdownContent < MetadataContent
|
||||
# Renderizar a HTML
|
||||
def to_s
|
||||
CommonMarker.render_doc(value, %i[FOOTNOTES SMART],
|
||||
%i[table strikethrough autolink]).to_html
|
||||
end
|
||||
end
|
8
app/views/posts/attributes/_markdown.haml
Normal file
8
app/views/posts/attributes/_markdown.haml
Normal file
|
@ -0,0 +1,8 @@
|
|||
.form-group.markdown-content
|
||||
= label_tag "post_#{attribute}", post_label_t(attribute, post: post)
|
||||
= text_area_tag "post[#{attribute}]", metadata.value,
|
||||
dir: dir, lang: locale,
|
||||
**field_options(attribute, metadata, class: 'content')
|
||||
.editor.mt-1
|
||||
= render 'posts/attribute_feedback',
|
||||
post: post, attribute: attribute, metadata: metadata
|
Loading…
Reference in a new issue