From 6b245970aef4ad305356d1a5f5e6ccfbcc494d80 Mon Sep 17 00:00:00 2001 From: David Gay Date: Tue, 25 May 2021 18:02:34 -0400 Subject: Don't render the chat if the user doesn't have an active character --- app/views/application/_chat.html.erb | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'app') 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 @@ -
-
+<% if current_char %> +
+
+
+
+ <%= 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 %> +
-
- <%= 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 %> -
-
+<% end %> -- cgit v1.2.3 From fcaef4f8144221bb2b4b9f77525bd8b8767e226a Mon Sep 17 00:00:00 2001 From: David Gay Date: Tue, 25 May 2021 18:02:56 -0400 Subject: Redirect from home page to current character path there is an active character --- app/controllers/home_controller.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'app') diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index be6be01..a224f7b 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -2,5 +2,6 @@ class HomeController < ApplicationController skip_before_action :authenticate_user! def index + redirect_to character_path(current_char) if current_char end end -- cgit v1.2.3