5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 16:56:21 +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, usuarie: current_usuarie,
params: params) params: params)
if service.create.persisted? if (@post = service.create.persisted?)
redirect_to site_posts_path(@site) redirect_to site_posts_path(@site)
else else
render 'posts/new' render 'posts/new'

View file

@ -8,8 +8,8 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do
# #
# @return Post # @return Post
def create def create
# TODO: Implementar layout self.post = site.posts(lang: params[:post][:lang] || I18n.locale)
self.post = site.posts(lang: params[:post][:lang] || I18n.locale).build .build(layout: params[:post][:layout])
post.usuaries << usuarie post.usuaries << usuarie
params[:post][:draft] = true if site.invitade? usuarie params[:post][:draft] = true if site.invitade? usuarie

View file

@ -19,6 +19,8 @@
-# Botones de guardado -# Botones de guardado
= render 'posts/submit', site: site, post: post = render 'posts/submit', site: site, post: post
= hidden_field_tag 'post[layout]', params[:layout] || 'post'
-# Dibuja cada atributo -# Dibuja cada atributo
- post.attributes.each do |attribute| - post.attributes.each do |attribute|
- metadata = post.send(attribute) - metadata = post.send(attribute)