mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-15 04:51:43 +00:00
por defecto la autora es la usuaria actual
This commit is contained in:
parent
451bdc36e0
commit
32d8ebd1e8
2 changed files with 7 additions and 3 deletions
|
@ -45,8 +45,12 @@ 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})
|
||||
# Las usuarias pueden especificar una autora, de la contrario por
|
||||
# defecto es la usuaria actual
|
||||
if current_user.is_a? Usuaria
|
||||
@post.update_attributes({author: params[:post][:author]})
|
||||
end
|
||||
@post.update_attributes({author: current_user.username}) unless @post.author
|
||||
|
||||
if @post.save
|
||||
redirect_to site_posts_path(@site, lang: @lang)
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
= label_tag 'post_author', t('posts.author')
|
||||
- todxs = (@site.usuarias + @site.invitadxs).map(&:username)
|
||||
= select_tag 'post[author]',
|
||||
options_for_select(todxs, @post.author),
|
||||
options_for_select(todxs, @post.author || current_user.email),
|
||||
{ class: 'form-control select2',
|
||||
data: { tags: true,
|
||||
placeholder: t('posts.select.placeholder'),
|
||||
|
|
Loading…
Reference in a new issue