From b2f9bf1f2e0c47025d3ef19fef2049a2f5d1293d Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Tue, 1 Jul 2025 18:27:38 +0200 Subject: [PATCH] Stub for command prompts --- .../prompts/commands_controller.rb | 7 +++++ app/helpers/rich_text_helper.rb | 4 +++ app/views/commands/_form.html.erb | 1 + app/views/prompts/commands/index.html.erb | 26 +++++++++++++++++++ config/routes.rb | 1 + 5 files changed, 39 insertions(+) create mode 100644 app/controllers/prompts/commands_controller.rb create mode 100644 app/views/prompts/commands/index.html.erb diff --git a/app/controllers/prompts/commands_controller.rb b/app/controllers/prompts/commands_controller.rb new file mode 100644 index 000000000..85709922c --- /dev/null +++ b/app/controllers/prompts/commands_controller.rb @@ -0,0 +1,7 @@ +class Prompts::CommandsController < ApplicationController + def index + if stale? etag: @tags + render layout: false + end + end +end diff --git a/app/helpers/rich_text_helper.rb b/app/helpers/rich_text_helper.rb index 8cd4cf36c..986e24fd0 100644 --- a/app/helpers/rich_text_helper.rb +++ b/app/helpers/rich_text_helper.rb @@ -11,6 +11,10 @@ module RichTextHelper content_tag "lexical-prompt", "", trigger: "#", src: prompts_tags_path, name: "tag" end + def commands_prompt + content_tag "lexical-prompt", "", trigger: "/", src: prompts_commands_path, name: "command", "insert-editable-text": true + end + def cards_prompt content_tag "lexical-prompt", "", trigger: "#", src: prompts_cards_path, name: "card", "insert-editable-text": true, "remote-filtering": true end diff --git a/app/views/commands/_form.html.erb b/app/views/commands/_form.html.erb index 7997dfcd7..58a008ca5 100644 --- a/app/views/commands/_form.html.erb +++ b/app/views/commands/_form.html.erb @@ -31,6 +31,7 @@ spellcheck: "false" do %> <%= global_mentions_prompt %> <%= tags_prompt %> + <%= commands_prompt %> <% end %> <%= hidden_field_tag "confirmed", nil, data: { terminal_target: "confirmation" } %> diff --git a/app/views/prompts/commands/index.html.erb b/app/views/prompts/commands/index.html.erb new file mode 100644 index 000000000..28685d139 --- /dev/null +++ b/app/views/prompts/commands/index.html.erb @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + diff --git a/config/routes.rb b/config/routes.rb index 4026c9c25..4e17f0819 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -118,6 +118,7 @@ Rails.application.routes.draw do resources :cards resources :users resources :tags + resources :commands resources :collections do scope module: :collections do