mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-15 02:11:42 +00:00
usar los layouts del sitio
This commit is contained in:
parent
f589d747fd
commit
265fd9fff5
3 changed files with 20 additions and 51 deletions
|
@ -45,6 +45,10 @@ class Site
|
|||
end
|
||||
end
|
||||
|
||||
def layouts
|
||||
@layouts ||= @jekyll.layouts.keys.sort
|
||||
end
|
||||
|
||||
# Obtener el nombre del sitio
|
||||
def name
|
||||
@name ||= @jekyll.config['source'].split('/').last
|
||||
|
|
|
@ -54,11 +54,6 @@
|
|||
= text_field 'post', 'slug', value: @post.slug,
|
||||
class: 'form-control'
|
||||
%small.text-muted.form-text= t('posts.slug_help')
|
||||
.form-group
|
||||
= label_tag 'post_cover', t('posts.cover')
|
||||
= text_field 'post', 'cover', value: @post.get_front_matter(:cover),
|
||||
class: 'form-control'
|
||||
%small.text-muted.form-text= t('posts.cover_help')
|
||||
.form-group
|
||||
= label_tag 'post_permalink', t('posts.permalink')
|
||||
= text_field 'post', 'permalink', value: @post.get_front_matter(:permalink),
|
||||
|
@ -67,54 +62,9 @@
|
|||
.form-group
|
||||
= label_tag 'post_layout', t('posts.layout')
|
||||
= select_tag 'post[layout]',
|
||||
options_for_select(@site.everything_of(:layout, lang: @lang), @post.get_front_matter(:layout)),
|
||||
options_for_select(@site.layouts, @post.get_front_matter(:layout)),
|
||||
{ class: 'form-control select2' }
|
||||
%small.text-muted.form-text= t('posts.layout_help')
|
||||
.form-group
|
||||
= label_tag 'post_objetivos', t('posts.objetivos')
|
||||
= text_area 'post', 'objetivos', value: @post.get_front_matter(:objetivos),
|
||||
class: field_class
|
||||
%small.text-muted.form-text= t('posts.objetivos_help')
|
||||
.form-group
|
||||
= label_tag 'post_recomendaciones', t('posts.recomendaciones')
|
||||
= text_area 'post', 'recomendaciones', value: @post.get_front_matter(:recomendaciones),
|
||||
class: field_class
|
||||
%small.text-muted.form-text= t('posts.recomendaciones_help')
|
||||
.form-group
|
||||
= label_tag 'post_duracion', t('posts.duracion')
|
||||
= text_field 'post', 'duracion', value: @post.get_front_matter(:duracion),
|
||||
class: 'form-control'
|
||||
%small.text-muted.form-text= t('posts.duracion_help')
|
||||
.form-group
|
||||
= label_tag 'post_habilidades', t('posts.habilidades')
|
||||
= select_tag 'post[habilidades]',
|
||||
options_for_select(@site.everything_of(:habilidades, lang: @lang), @post.get_front_matter(:habilidades)),
|
||||
{ class: 'form-control select2' }
|
||||
%small.text-muted.form-text= t('posts.habilidades_help')
|
||||
.form-group
|
||||
= label_tag 'post_formato', t('posts.formato')
|
||||
= select_tag 'post[formato]',
|
||||
options_for_select(@site.everything_of(:formato, lang: @lang), @post.get_front_matter(:formato)),
|
||||
{ class: 'form-control select2' }
|
||||
%small.text-muted.form-text= t('posts.formato_help')
|
||||
.form-group
|
||||
= label_tag 'post_conocimientos', t('posts.conocimientos')
|
||||
= select_tag 'post[conocimientos][]',
|
||||
options_for_select(@site.everything_of(:conocimientos, lang: @lang), @post.get_front_matter(:conocimientos)),
|
||||
{ class: 'form-control select2', multiple: 'multiple' }
|
||||
%small.text-muted.form-text= t('posts.conocimientos_help')
|
||||
.form-group
|
||||
= label_tag 'post_sesiones_ejercicios_relacionados', t('posts.sesiones_ejercicios_relacionados')
|
||||
= select_tag 'post[sesiones_ejercicios_relacionados][]',
|
||||
options_for_select(@site.everything_of(:title, lang: @lang), @post.get_front_matter(:sesiones_ejercicios_relacionados)),
|
||||
{ class: 'form-control select2', multiple: 'multiple' }
|
||||
%small.text-muted.form-text= t('posts.sesiones_ejercicios_relacionados_help')
|
||||
.form-group
|
||||
= label_tag 'post_materiales_requeridos', t('posts.materiales_requeridos')
|
||||
= select_tag 'post[materiales_requeridos][]',
|
||||
options_for_select(@site.everything_of(:materiales_requeridos, lang: @lang), @post.get_front_matter(:materiales_requeridos)),
|
||||
{ class: 'form-control select2', multiple: 'multiple' }
|
||||
%small.text-muted.form-text= t('posts.materiales_requeridos_help')
|
||||
- if @site.i18n?
|
||||
- @site.translations.each do |lang|
|
||||
- next if lang == @lang
|
||||
|
|
|
@ -63,4 +63,19 @@ class SiteTest < ActiveSupport::TestCase
|
|||
assert_equal v, @site.posts[k].order
|
||||
end
|
||||
end
|
||||
|
||||
test 'Un sitio tiene traducciones' do
|
||||
assert_equal %w[ar es en], @site.translations
|
||||
assert @site.i18n?
|
||||
end
|
||||
|
||||
test 'El idioma por defecto es el idioma actual de la plataforma' do
|
||||
assert_equal 'es', @site.default_lang
|
||||
end
|
||||
|
||||
test 'El sitio tiene layouts' do
|
||||
assert_equal %w[anexo archive default feed header.ar header.en
|
||||
header.es header license.ar license.en license.es license pandoc
|
||||
politicas sesion simple style ].sort, @site.layouts
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue