This commit is contained in:
f 2019-07-29 15:20:19 -03:00
parent dc726fdbe0
commit bb55551266
No known key found for this signature in database
GPG key ID: 2AE5A13E321F953D
2 changed files with 26 additions and 23 deletions

View file

@ -56,7 +56,7 @@ class PostsController < ApplicationController
# Las usuarias pueden especificar una autora, de la contrario por
# defecto es la usuaria actual
if current_user.is_a? Usuaria
if @site.usuarie? current_usuarie
@post.update_attributes(author: params[:post][:author])
else
# Todo lo que crean lxs invitadxs es borrador
@ -99,7 +99,7 @@ class PostsController < ApplicationController
@post.update_attributes(repair_nested_params(post_params))
# Solo las usuarias pueden modificar la autoría
if current_user.is_a? Usuaria
if @site.usuarie? current_usuarie
if params[:post][:author].present?
@post.update_attributes(author: params[:post][:author])
end

View file

@ -1,19 +1,22 @@
- tags = %w[h1 h2 h3 h4 h5 h6 p a ul ol li table tr td th tbody thead tfoot em strong sup blockquote cite pre]
.row
.col
= render 'layouts/breadcrumb',
crumbs: [ link_to(t('sites.index'), sites_path),
@site.name,
link_to(t('posts.index'),
site_posts_path(@site)),
@post.title ]
crumbs: [link_to(t('sites.index'), sites_path),
@site.name,
link_to(t('posts.index'),
site_posts_path(@site)),
@post.title]
.row
.col
%h1{class: @post.get_front_matter(:dir)}= @post.title
%h1{ class: @post.get_front_matter(:dir) }= @post.title
%p
- translations = @post.translations.map do |translation|
- link_to translation.title, site_post_path(@site, translation, lang: translation.lang)
- link_to translation.title,
site_post_path(@site, translation, lang: translation.lang)
= raw translations.join(' / ')
.row
@ -24,16 +27,17 @@
.row
.col
.content{class: @post.get_front_matter(:dir)}
= sanitized_markdown @post.content,
tags: %w[h1 h2 h3 h4 h5 h6 p a ul ol li table tr td th tbody thead tfoot em strong sup blockquote cite pre]
.content{ class: @post.get_front_matter(:dir) }
= sanitize_markdown @post.content,
tags: tags
-# Representar los datos en una tabla:
-# Texto: tal cual en una celda
-# Array: píldoras
-# Array de Hashes: Tabla
-# Hash: Tabla
-# TODO DRY
-#
Representar los datos en una tabla:
Texto: tal cual en una celda
Array: píldoras
Array de Hashes: Tabla
Hash: Tabla
TODO DRY
%table.table.table-condensed.table-striped.table-responsive
%tbody
- @post.front_matter.each do |key, data|
@ -51,7 +55,7 @@
%tbody
- data.each do |r|
%tr
- r.each do |_,v|
- r.each do |_, v|
%td
- if v.is_a? Array
- v.each do |s|
@ -73,16 +77,15 @@
%td= v
- elsif data.respond_to? :content
-# Contenido del artículo
= sanitized_markdown data.content,
tags: %w[h1 h2 h3 h4 h5 h6 p a ul ol li table tr td th tbody thead tfoot em strong sup blockquote cite pre]
= sanitize_markdown data.content, tags: tags
- elsif data.respond_to? :strftime
-# Fecha
= data.strftime('%F')
- else
-# Texto
- if @post.image? key
%img.img-fluid{src: @site.get_url_for_sutty(data)}
%img.img-fluid{ src: @site.get_url_for_sutty(data) }
- elsif @post.url? key
%a{href: @site.get_url_for_sutty(data)}= data
%a{ href: @site.get_url_for_sutty(data) }= data
- else
= data