5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-06-23 19:46:08 +00:00

crear articulo segun layout

This commit is contained in:
f 2019-11-15 13:35:27 -03:00
parent eb8c45a87a
commit 352beedd67
No known key found for this signature in database
GPG key ID: 2AE5A13E321F953D
3 changed files with 5 additions and 3 deletions

View file

@ -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'

View file

@ -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

View file

@ -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)