diff options
author | David Gay <david@davidgay.org> | 2021-05-25 18:02:34 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-05-25 18:02:34 -0400 |
commit | 6b245970aef4ad305356d1a5f5e6ccfbcc494d80 (patch) | |
tree | dba955ed6289d4b47f62eb7cb2c4ec57d08c5d61 /app/views | |
parent | 69d8373e5af170fd23ba46067f76bc69cfb1337d (diff) |
Don't render the chat if the user doesn't have an active character
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/application/_chat.html.erb | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/app/views/application/_chat.html.erb b/app/views/application/_chat.html.erb index 8abe73c..f8aa4ad 100644 --- a/app/views/application/_chat.html.erb +++ b/app/views/application/_chat.html.erb @@ -1,13 +1,15 @@ -<div data-controller="chat" class="flex flex-col h-full text-sm"> - <div data-chat-target="output" id="chat_output" class="overflow-auto flex-grow"> +<% if current_char %> + <div data-controller="chat" class="flex flex-col h-full text-sm"> + <div data-chat-target="output" id="chat_output" class="overflow-auto flex-grow"> + </div> + <div class="flex-none"> + <%= form_with model: ChatMessage.new, html: { autocomplete: "off" }, local: false, + data: { action: "chat#send" }, class: "flex" do |f| %> + <%= f.collection_select :chat_room_id, ChatRoom.accessible_to(current_char.user), + :id, :short_name, class: "flex-none" %> + <%= f.text_field :body, size: "1", maxlength: 255, required: true, + data: { chat_target: "message" }, class: "flex-grow inline-flex" %> + <% end %> + </div> </div> - <div class="flex-none"> - <%= form_with model: ChatMessage.new, html: { autocomplete: "off" }, local: false, - data: { action: "chat#send" }, class: "flex" do |f| %> - <%= f.collection_select :chat_room_id, ChatRoom.accessible_to(current_char.user), - :id, :short_name, class: "flex-none" %> - <%= f.text_field :body, size: "1", maxlength: 255, required: true, - data: { chat_target: "message" }, class: "flex-grow inline-flex" %> - <% end %> - </div> -</div> +<% end %> |