5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 20:06:22 +00:00

feat: cargar el formulario del post sin decoración

This commit is contained in:
f 2024-05-18 12:10:37 -03:00
parent a734b65a9e
commit 4876c61d10
No known key found for this signature in database
3 changed files with 24 additions and 0 deletions

View file

@ -40,6 +40,22 @@ class PostsController < ApplicationController
render layout: false
end
# El formulario de un Post, si pasamos el uuid, estamos editando, sino
# estamos creando.
def form
uuid = params.permit(:uuid).try(:[], :uuid)
@post =
if uuid.present?
site.indexed_posts.find_by!(post_id: uuid).post
else
# @todo Usar la base de datos
site.posts(lang: locale).build(layout: params.require(:layout))
end
render layout: false
end
def index
authorize Post

View file

@ -0,0 +1,7 @@
-#
El formulario sin ninguna decoración, para incluir dentro de otros
elementos.
@param :site [Site]
@param :post [Post]
= render 'posts/form', site: @site, post: @post

View file

@ -103,6 +103,7 @@ Rails.application.routes.draw do
get :'posts/new_array', to: 'posts#new_array'
get :'posts/new_array_value', to: 'posts#new_array_value'
get :'posts/new_related_post', to: 'posts#new_related_post'
get :'posts/form', to: 'posts#form'
resources :posts do
get 'p/:page', action: :index, on: :collection