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

feat: generar la lista con links

This commit is contained in:
f 2024-05-17 17:58:44 -03:00
parent 1e413e57f5
commit f89595aff1
No known key found for this signature in database
4 changed files with 15 additions and 4 deletions

View file

@ -32,6 +32,14 @@ class PostsController < ApplicationController
render layout: false render layout: false
end end
def new_related_post
@uuid = params.require(:value).strip
@indexed_post = site.indexed_posts.find_by!(post_id: @uuid)
render layout: false
end
def index def index
authorize Post authorize Post

View file

@ -0,0 +1,2 @@
.col
%p= link_to post.title, post.path

View file

@ -5,7 +5,7 @@
name = "#{base}[#{attribute}][]" name = "#{base}[#{attribute}][]"
form_id = "form-#{Nanoid.generate}" form_id = "form-#{Nanoid.generate}"
%div{ data: { controller: 'modal array', 'array-original-value': metadata.value.to_json, 'array-new-array-value': site_posts_new_array_value_path(site) } } %div{ data: { controller: 'modal array', 'array-original-value': metadata.value.to_json, 'array-new-array-value': site_posts_new_related_post_path(site) } }
.form-group .form-group
= hidden_field_tag name, '' = hidden_field_tag name, ''
= label_tag id, post_label_t(attribute, post: post) = label_tag id, post_label_t(attribute, post: post)
@ -34,9 +34,9 @@
- content_for :"#{id}_body" do - content_for :"#{id}_body" do
.form-group.mb-0{ id: "#{id}_body" } .form-group.mb-0{ id: "#{id}_body" }
- metadata.values.each_pair do |value, key| - metadata.values.each_pair do |value, uuid|
.mb-2{ data: { target: 'array.item', 'searchable-value': value.remove_diacritics.downcase, value: value } } .mb-2{ data: { target: 'array.item', 'searchable-value': value.remove_diacritics.downcase, value: uuid } }
= render 'bootstrap/custom_checkbox', name: name, id: "value-#{Nanoid.generate}", value: key, checked: metadata.value.include?(key), content: value = render 'bootstrap/custom_checkbox', name: name, id: "value-#{Nanoid.generate}", value: uuid, checked: metadata.value.include?(uuid), content: value
- content_for :"#{id}_footer" do - content_for :"#{id}_footer" do
.flex-grow-1 .flex-grow-1

View file

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