Only offer users accessible in the collection
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
class Prompts::Collections::UsersController < ApplicationController
|
||||
include CollectionScoped
|
||||
|
||||
def index
|
||||
@users = @collection.users
|
||||
render layout: false
|
||||
end
|
||||
end
|
||||
@@ -1,6 +0,0 @@
|
||||
class Prompts::UsersController < ApplicationController
|
||||
def index
|
||||
@users = User.all
|
||||
render layout: false
|
||||
end
|
||||
end
|
||||
@@ -1,6 +1,6 @@
|
||||
module RichTextHelper
|
||||
def mentions_prompt
|
||||
content_tag "lexical-prompt", "", trigger: "@", src: prompts_users_path, name: "mention"
|
||||
def mentions_prompt(collection)
|
||||
content_tag "lexical-prompt", "", trigger: "@", src: prompts_collection_users_path(collection), name: "mention"
|
||||
end
|
||||
|
||||
def cards_prompt
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
action: "turbo:submit-end->local-save#submit keydown.ctrl+enter->form#submit:prevent keydown.meta+enter->form#submit:prevent keydown.esc->form#cancel:stop" } do |form| %>
|
||||
<%= form.rich_textarea :body, required: true, placeholder: new_comment_placeholder(card),
|
||||
data: { local_save_target: "input", action: "actiontext:change->local-save#save turbo:morph-element->local-save#restoreContent" } do %>
|
||||
<%= mentions_prompt %>
|
||||
<%= mentions_prompt(@card.collection) %>
|
||||
<%= cards_prompt %>
|
||||
<% end %>
|
||||
<%= form.button class: "comment__submit btn btn--reversed flex-item-justify-start" do %>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<%= form_with model: [ @card, @comment ], class: "flex flex-column gap full-width",
|
||||
data: { controller: "form", action: "keydown.ctrl+enter->form#submit:prevent keydown.meta+enter->form#submit:prevent keydown.esc->form#cancel:stop" } do |form| %>
|
||||
<%= form.rich_textarea :body, required: true, autofocus: true, placeholder: new_comment_placeholder(@card) do %>
|
||||
<%= mentions_prompt %>
|
||||
<%= mentions_prompt(@card.collection) %>
|
||||
<%= cards_prompt %>
|
||||
<% end %>
|
||||
<div class="flex gap-half justify-start">
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<%= form.rich_textarea :description, class: "card-field__description",
|
||||
placeholder: "Add some notes, context, pictures, or video about this…",
|
||||
data: { action: "actiontext:change->auto-save#change focusout->auto-save#submit keydown.ctrl+enter->form#submit:prevent keydown.meta+enter->form#submit:prevent keydown.esc->form#cancel:stop" } do %>
|
||||
<%= mentions_prompt %>
|
||||
<%= mentions_prompt(card.collection) %>
|
||||
<%= cards_prompt %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<%= form.rich_textarea :description, class: "card-field__description rich-text-content",
|
||||
placeholder: "Add some notes, context, pictures, or video about this…",
|
||||
data: { action: "keydown.ctrl+enter->form#submit:prevent keydown.meta+enter->form#submit:prevent keydown.esc->form#cancel:stop" } do %>
|
||||
<%= mentions_prompt %>
|
||||
<%= mentions_prompt(@card.collection) %>
|
||||
<%= cards_prompt %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<%= render partial: "prompts/collections/users/user", collection: @users %>
|
||||
@@ -1 +0,0 @@
|
||||
<%= render partial: "prompts/users/user", collection: @users %>
|
||||
+5
-1
@@ -104,8 +104,12 @@ Rails.application.routes.draw do
|
||||
end
|
||||
|
||||
namespace :prompts do
|
||||
resources :users
|
||||
resources :cards
|
||||
resources :collections do
|
||||
scope module: :collections do
|
||||
resources :users
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
namespace :public do
|
||||
|
||||
Reference in New Issue
Block a user