Select cards with #
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
class Prompts::CardsController < ApplicationController
|
||||
def index
|
||||
@cards = if filter_param.present?
|
||||
Current.user.accessible_cards.mentioning(filter_param)
|
||||
else
|
||||
Current.user.accessible_cards.latest.limit(10)
|
||||
end
|
||||
render layout: false
|
||||
end
|
||||
|
||||
private
|
||||
def filter_param
|
||||
params[:filter]
|
||||
end
|
||||
end
|
||||
@@ -2,4 +2,8 @@ module RichTextHelper
|
||||
def mentions_prompt
|
||||
content_tag "lexical-prompt", "", trigger: "@", src: prompts_users_path, name: "mention"
|
||||
end
|
||||
|
||||
def cards_prompt
|
||||
content_tag "lexical-prompt", "", trigger: "#", src: prompts_cards_path, name: "card", "insert-editable-text": true, "remote-filtering": true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -45,7 +45,7 @@ module Card::Searchable
|
||||
private
|
||||
# TODO: Temporary until we stabilize the search API
|
||||
def title_and_description
|
||||
[ title, description.to_plain_text ].join(" ")
|
||||
[ id.to_s, title, description.to_plain_text ].join(" ")
|
||||
end
|
||||
|
||||
def search_embedding_content
|
||||
|
||||
@@ -68,3 +68,4 @@ module Searchable
|
||||
search_embedding&.destroy
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
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 %>
|
||||
<%= cards_prompt %>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= form.button "Save changes", type: :submit, class: "btn btn--reversed", style: "--btn-background: #{@card.color}" %>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<lexical-prompt-item>
|
||||
<template type="menu">
|
||||
#<%= card.id %> <%= card.title %>
|
||||
</template>
|
||||
<template type="editor">
|
||||
<%= link_to "##{card.id} #{card.title}", collection_card_url(card.collection, card) %>
|
||||
</template>
|
||||
</lexical-prompt-item>
|
||||
@@ -0,0 +1 @@
|
||||
<%= render partial: "prompts/cards/card", collection: @cards %>
|
||||
@@ -105,6 +105,7 @@ Rails.application.routes.draw do
|
||||
|
||||
namespace :prompts do
|
||||
resources :users
|
||||
resources :cards
|
||||
end
|
||||
|
||||
namespace :public do
|
||||
|
||||
Generated
+1
@@ -324,6 +324,7 @@ ActiveRecord::Schema[8.1].define(version: 2025_06_09_102553) do
|
||||
t.datetime "created_at", null: false
|
||||
t.string "title"
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["title"], name: "index_tags_on_account_id_and_title", unique: true
|
||||
end
|
||||
|
||||
create_table "users", force: :cascade do |t|
|
||||
|
||||
+17
-1
@@ -2200,7 +2200,23 @@ indexes:
|
||||
nulls_not_distinct:
|
||||
comment:
|
||||
valid: true
|
||||
tags: []
|
||||
tags:
|
||||
- !ruby/object:ActiveRecord::ConnectionAdapters::IndexDefinition
|
||||
table: tags
|
||||
name: index_tags_on_account_id_and_title
|
||||
unique: true
|
||||
columns:
|
||||
- title
|
||||
lengths: {}
|
||||
orders: {}
|
||||
opclasses: {}
|
||||
where:
|
||||
type:
|
||||
using:
|
||||
include:
|
||||
nulls_not_distinct:
|
||||
comment:
|
||||
valid: true
|
||||
users:
|
||||
- !ruby/object:ActiveRecord::ConnectionAdapters::IndexDefinition
|
||||
table: users
|
||||
|
||||
Reference in New Issue
Block a user