diff --git a/app/views/bar/_bar.html.erb b/app/views/bar/_bar.html.erb index 633ac5ca9..c0a26a59b 100644 --- a/app/views/bar/_bar.html.erb +++ b/app/views/bar/_bar.html.erb @@ -4,24 +4,35 @@ controller: "bar", bar_dialog_outlet: "#bar-modal", bar_search_url_value: search_path, - bar_search_turbo_frame_name_value: "search", bar_ask_url_value: conversation_path, - bar_ask_turbo_frame_name_value: "conversation", - action: " - keydown.meta+k@document->bar#search keydown.ctrl+k@document->bar#search - keydown.meta+a@document->bar#ask keydown.ctrl+a@document->bar#ask" } do %> - - <%= render "searches/form", query_terms: @query_terms %> + <%= tag.dialog \ id: "bar-modal", diff --git a/app/views/conversations/_composer.html.erb b/app/views/conversations/_composer.html.erb new file mode 100644 index 000000000..f4bb0cc3e --- /dev/null +++ b/app/views/conversations/_composer.html.erb @@ -0,0 +1,21 @@ +<%= form_with model: Conversation::Message.new, local: true, + class: "conversation__composer", + data: { + action: "turbo:submit-end->conversation--composer#submitEnd", + controller: "conversation--composer", + conversation__composer_conversation__messages_outlet: "#conversation-messages" } do |form| %> + + <%= form.hidden_field :client_message_id, data: { conversation__composer_target: "clientMessageIdInput" } %> + +
+ <%= form.text_field :content, + autofocus: "on", + placeholder: "Ask something…", + class: "input input--textarea", + data: { + action: " + keydown.enter->conversation--composer#submit + keydown.ctrl+enter->conversation--composer#submit", + conversation__composer_target: "textInput" } %> +
+<% end %> diff --git a/app/views/conversations/show.html.erb b/app/views/conversations/show.html.erb index d17f697da..80abb90e3 100644 --- a/app/views/conversations/show.html.erb +++ b/app/views/conversations/show.html.erb @@ -9,7 +9,7 @@ <%= turbo_frame_tag dom_id(@conversation, :messages_container), src: conversation_messages_path, target: "_top" %> <%= render partial: "conversations/show/thinking_indicator", locals: { conversation: @conversation } %> - <%= render partial: "conversations/show/composer", locals: { conversation: @conversation } %> + <%= render partial: "composer" %> <% end %> diff --git a/app/views/conversations/show/_composer.html.erb b/app/views/conversations/show/_composer.html.erb deleted file mode 100644 index 517ea2455..000000000 --- a/app/views/conversations/show/_composer.html.erb +++ /dev/null @@ -1,23 +0,0 @@ -<%= form_with model: Conversation::Message.new, local: true, - id: dom_id(conversation, :composer), - class: "conversation__composer", - data: { - action: "turbo:submit-end->conversation--composer#submitEnd", - controller: "conversation--composer", - conversation__composer_conversation__messages_outlet: "##{dom_id(conversation, :messages)}" } do |form| %> - - <%= form.hidden_field :client_message_id, data: { conversation__composer_target: "clientMessageIdInput" } %> - -
- <%= form.text_area :content, autofocus: "on", placeholder: "Ask something…", rows: 1, - class: "input input--textarea", data: { action: "keydown.enter->conversation--composer#submit keydown.ctrl+enter->conversation--composer#submit", conversation__composer_target: "textInput" } %> -
- -
- <%= form.button type: "submit", class: "btn btn--link txt-small", - data: { conversation__composer_target: "submitButton", action: "click->conversation--composer#submit"} do %> - <%= icon_tag "arrow-up" %> - Send message - <% end %> -
-<% end %>