mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-15 02:31:42 +00:00
los posts tiene autoria
This commit is contained in:
parent
c6ace605fb
commit
451bdc36e0
4 changed files with 23 additions and 0 deletions
|
@ -45,6 +45,9 @@ class PostsController < ApplicationController
|
|||
@post = Post.new(site: @site, lang: @lang, template: @template)
|
||||
@post.update_attributes(repair_nested_params(post_params))
|
||||
|
||||
# El author no se modifica
|
||||
@post.update_attributes({author: current_user.username})
|
||||
|
||||
if @post.save
|
||||
redirect_to site_posts_path(@site, lang: @lang)
|
||||
else
|
||||
|
@ -69,6 +72,11 @@ 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
|
||||
@post.update_attributes({author: params[:post][:author]})
|
||||
end
|
||||
|
||||
if @post.save
|
||||
redirect_to site_posts_path(@site, category: session[:category], lang: @lang)
|
||||
else
|
||||
|
|
|
@ -19,6 +19,17 @@
|
|||
= hidden_field_tag 'template', params[:template]
|
||||
.form-group
|
||||
= submit_tag t('posts.save'), class: 'btn btn-success submit-post'
|
||||
- if current_user.is_a? Usuaria
|
||||
.form-group
|
||||
= label_tag 'post_author', t('posts.author')
|
||||
- todxs = (@site.usuarias + @site.invitadxs).map(&:username)
|
||||
= select_tag 'post[author]',
|
||||
options_for_select(todxs, @post.author),
|
||||
{ class: 'form-control select2',
|
||||
data: { tags: true,
|
||||
placeholder: t('posts.select.placeholder'),
|
||||
'allow-clear': true } }
|
||||
%small.text-muted.form-text= t('posts.author_help')
|
||||
- if @post.has_field? :dir
|
||||
.form-group
|
||||
= label_tag 'post_dir', t('posts.dir')
|
||||
|
|
|
@ -173,6 +173,8 @@ en:
|
|||
index: 'Posts'
|
||||
edit: 'Edit'
|
||||
save: 'Save'
|
||||
author: 'Author'
|
||||
author_help: 'You can change the authorship of the post. If your site accepts guests, changing the authorship to an e-mail address will allow them to edit the post.'
|
||||
date: 'Publication date'
|
||||
date_help: 'This changes the articles order!'
|
||||
title: 'Title'
|
||||
|
|
|
@ -171,6 +171,8 @@ es:
|
|||
index: 'Artículos'
|
||||
edit: 'Editar'
|
||||
save: 'Guardar'
|
||||
author: 'Autorx'
|
||||
author_help: 'Puedes cambiar la autoría del artículo aquí. Si el sitio acepta invitadxs, poner la dirección de correo de alguien aquí le permite editarlo.'
|
||||
date: 'Fecha de publicación'
|
||||
date_help: '¡Esto cambia el orden de los artículos!'
|
||||
title: 'Título'
|
||||
|
|
Loading…
Reference in a new issue