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:
parent
eb8c45a87a
commit
352beedd67
3 changed files with 5 additions and 3 deletions
|
@ -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'
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue