mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 12:46:21 +00:00
Merge branch 'rails' of 0xacab.org:sutty/sutty into usar-sutty-editor
This commit is contained in:
commit
94482ef4ee
3 changed files with 14 additions and 11 deletions
|
@ -166,8 +166,10 @@ class Site < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
# Similar a site.i18n en jekyll-locales
|
# Similar a site.i18n en jekyll-locales
|
||||||
|
#
|
||||||
|
# @return [Hash]
|
||||||
def i18n
|
def i18n
|
||||||
data[I18n.locale.to_s]
|
data[I18n.locale.to_s] || {}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Devuelve el idioma por defecto del sitio, el primero de la lista.
|
# Devuelve el idioma por defecto del sitio, el primero de la lista.
|
||||||
|
@ -470,7 +472,7 @@ class Site < ApplicationRecord
|
||||||
config.theme = design.gem unless design.no_theme?
|
config.theme = design.gem unless design.no_theme?
|
||||||
config.description = description
|
config.description = description
|
||||||
config.title = title
|
config.title = title
|
||||||
config.url = url
|
config.url = url(slash: false)
|
||||||
config.hostname = hostname
|
config.hostname = hostname
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
.form-group
|
.form-group
|
||||||
- if metadata.static_file
|
- if metadata.static_file
|
||||||
= hidden_field_tag "#{base}[#{attribute}][path]", metadata.value['path']
|
|
||||||
|
|
||||||
- case metadata.static_file.blob.content_type
|
- case metadata.static_file.blob.content_type
|
||||||
- when %r{\Avideo/}
|
- when %r{\Avideo/}
|
||||||
= video_tag url_for(metadata.static_file),
|
= video_tag url_for(metadata.static_file),
|
||||||
|
@ -14,13 +12,17 @@
|
||||||
- else
|
- else
|
||||||
= link_to t('posts.attribute_ro.file.download'),
|
= link_to t('posts.attribute_ro.file.download'),
|
||||||
url_for(metadata.static_file)
|
url_for(metadata.static_file)
|
||||||
|
-# Mantener el valor si no enviamos ninguna imagen
|
||||||
|
= hidden_field_tag "#{base}[#{attribute}][path]", metadata.value['path']
|
||||||
|
-# Los archivos requeridos solo se pueden reemplazar
|
||||||
|
- unless metadata.required
|
||||||
.custom-control.custom-switch
|
.custom-control.custom-switch
|
||||||
= check_box_tag "#{base}[#{attribute}][path]", '', false, id: "#{base}_#{attribute}_destroy", class: 'custom-control-input'
|
= check_box_tag "#{base}[#{attribute}][path]", '', false, id: "#{base}_#{attribute}_destroy", class: 'custom-control-input'
|
||||||
= label_tag "#{base}_#{attribute}_destroy", t('posts.attributes.file.destroy'), class: 'custom-control-label'
|
= label_tag "#{base}_#{attribute}_destroy", t('posts.attributes.file.destroy'), class: 'custom-control-label'
|
||||||
|
|
||||||
.custom-file
|
.custom-file
|
||||||
= file_field(*field_name_for(base, attribute, :path),
|
= file_field(*field_name_for(base, attribute, :path),
|
||||||
**field_options(attribute, metadata),
|
**field_options(attribute, metadata, required: (metadata.required && !metadata.path?)),
|
||||||
class: "custom-file-input #{invalid(post, attribute)}",
|
class: "custom-file-input #{invalid(post, attribute)}",
|
||||||
data: { preview: "#{attribute}-preview" })
|
data: { preview: "#{attribute}-preview" })
|
||||||
= label_tag "#{base}_#{attribute}_path",
|
= label_tag "#{base}_#{attribute}_path",
|
||||||
|
@ -30,7 +32,7 @@
|
||||||
|
|
||||||
.form-group
|
.form-group
|
||||||
= label_tag "#{base}_#{attribute}_description",
|
= label_tag "#{base}_#{attribute}_description",
|
||||||
post_label_t(attribute, :description, post: post)
|
post_label_t(attribute, :description, post: post, required: false)
|
||||||
= text_field(*field_name_for(base, attribute, :description),
|
= text_field(*field_name_for(base, attribute, :description),
|
||||||
value: metadata.value['description'],
|
value: metadata.value['description'],
|
||||||
dir: dir, lang: locale,
|
dir: dir, lang: locale,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.form-group
|
.form-group
|
||||||
- if metadata.uploaded?
|
- if metadata.static_file
|
||||||
= image_tag url_for(metadata.static_file),
|
= image_tag url_for(metadata.static_file),
|
||||||
alt: metadata.value['description'],
|
alt: metadata.value['description'],
|
||||||
class: 'img-fluid',
|
class: 'img-fluid',
|
||||||
|
@ -37,4 +37,3 @@
|
||||||
**field_options(attribute, metadata, required: false))
|
**field_options(attribute, metadata, required: false))
|
||||||
= render 'posts/attribute_feedback',
|
= render 'posts/attribute_feedback',
|
||||||
post: post, attribute: [attribute, :description], metadata: metadata
|
post: post, attribute: [attribute, :description], metadata: metadata
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue