mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 01:16:23 +00:00
crear articulo segun layout
This commit is contained in:
parent
eb8c45a87a
commit
352beedd67
3 changed files with 5 additions and 3 deletions
|
@ -34,7 +34,7 @@ class PostsController < ApplicationController
|
|||
usuarie: current_usuarie,
|
||||
params: params)
|
||||
|
||||
if service.create.persisted?
|
||||
if (@post = service.create.persisted?)
|
||||
redirect_to site_posts_path(@site)
|
||||
else
|
||||
render 'posts/new'
|
||||
|
|
|
@ -8,8 +8,8 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do
|
|||
#
|
||||
# @return Post
|
||||
def create
|
||||
# TODO: Implementar layout
|
||||
self.post = site.posts(lang: params[:post][:lang] || I18n.locale).build
|
||||
self.post = site.posts(lang: params[:post][:lang] || I18n.locale)
|
||||
.build(layout: params[:post][:layout])
|
||||
post.usuaries << usuarie
|
||||
params[:post][:draft] = true if site.invitade? usuarie
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
-# Botones de guardado
|
||||
= render 'posts/submit', site: site, post: post
|
||||
|
||||
= hidden_field_tag 'post[layout]', params[:layout] || 'post'
|
||||
|
||||
-# Dibuja cada atributo
|
||||
- post.attributes.each do |attribute|
|
||||
- metadata = post.send(attribute)
|
||||
|
|
Loading…
Reference in a new issue