5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-07-06 14:45:44 +00:00
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 # Las usuarias pueden especificar una autora, de la contrario por
# defecto es la usuaria actual # defecto es la usuaria actual
if current_user.is_a? Usuaria if @site.usuarie? current_usuarie
@post.update_attributes(author: params[:post][:author]) @post.update_attributes(author: params[:post][:author])
else else
# Todo lo que crean lxs invitadxs es borrador # Todo lo que crean lxs invitadxs es borrador
@ -99,7 +99,7 @@ class PostsController < ApplicationController
@post.update_attributes(repair_nested_params(post_params)) @post.update_attributes(repair_nested_params(post_params))
# Solo las usuarias pueden modificar la autoría # Solo las usuarias pueden modificar la autoría
if current_user.is_a? Usuaria if @site.usuarie? current_usuarie
if params[:post][:author].present? if params[:post][:author].present?
@post.update_attributes(author: params[:post][:author]) @post.update_attributes(author: params[:post][:author])
end 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 .row
.col .col
= render 'layouts/breadcrumb', = render 'layouts/breadcrumb',
crumbs: [ link_to(t('sites.index'), sites_path), crumbs: [link_to(t('sites.index'), sites_path),
@site.name, @site.name,
link_to(t('posts.index'), link_to(t('posts.index'),
site_posts_path(@site)), site_posts_path(@site)),
@post.title ] @post.title]
.row .row
.col .col
%h1{class: @post.get_front_matter(:dir)}= @post.title %h1{ class: @post.get_front_matter(:dir) }= @post.title
%p %p
- translations = @post.translations.map do |translation| - 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(' / ') = raw translations.join(' / ')
.row .row
@ -24,16 +27,17 @@
.row .row
.col .col
.content{class: @post.get_front_matter(:dir)} .content{ class: @post.get_front_matter(:dir) }
= sanitized_markdown @post.content, = sanitize_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] tags: tags
-# Representar los datos en una tabla: -#
-# Texto: tal cual en una celda Representar los datos en una tabla:
-# Array: píldoras Texto: tal cual en una celda
-# Array de Hashes: Tabla Array: píldoras
-# Hash: Tabla Array de Hashes: Tabla
-# TODO DRY Hash: Tabla
TODO DRY
%table.table.table-condensed.table-striped.table-responsive %table.table.table-condensed.table-striped.table-responsive
%tbody %tbody
- @post.front_matter.each do |key, data| - @post.front_matter.each do |key, data|
@ -51,7 +55,7 @@
%tbody %tbody
- data.each do |r| - data.each do |r|
%tr %tr
- r.each do |_,v| - r.each do |_, v|
%td %td
- if v.is_a? Array - if v.is_a? Array
- v.each do |s| - v.each do |s|
@ -73,16 +77,15 @@
%td= v %td= v
- elsif data.respond_to? :content - elsif data.respond_to? :content
-# Contenido del artículo -# Contenido del artículo
= sanitized_markdown data.content, = sanitize_markdown data.content, tags: tags
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]
- elsif data.respond_to? :strftime - elsif data.respond_to? :strftime
-# Fecha -# Fecha
= data.strftime('%F') = data.strftime('%F')
- else - else
-# Texto -# Texto
- if @post.image? key - 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 - elsif @post.url? key
%a{href: @site.get_url_for_sutty(data)}= data %a{ href: @site.get_url_for_sutty(data) }= data
- else - else
= data = data