From 5da39f8b175e43fe6bdbaaaf62af550df62d5d32 Mon Sep 17 00:00:00 2001 From: drusepth Date: Tue, 6 Dec 2022 16:28:06 -0800 Subject: [PATCH] fix 500s when logged out in forum layout --- app/views/layouts/forum.html.erb | 140 ++++++++++++++++--------------- 1 file changed, 72 insertions(+), 68 deletions(-) diff --git a/app/views/layouts/forum.html.erb b/app/views/layouts/forum.html.erb index 0fc6c11d..702d81ca 100644 --- a/app/views/layouts/forum.html.erb +++ b/app/views/layouts/forum.html.erb @@ -46,36 +46,38 @@
-
- -
+ <% if user_signed_in? %> +
+ +
-
-
- <% @user_notifications.each do |notification| %> - <%= link_to main_app.notification_path(notification), class: 'flex items-center px-4 py-3 border-b hover:bg-gray-100 -mx-2' do %> - <%= notification.icon %> -
- <%= notification.message_html.html_safe %> -
-
- <%= time_ago_in_words notification.happened_at %> ago -
+
+
+ <% @user_notifications.each do |notification| %> + <%= link_to main_app.notification_path(notification), class: 'flex items-center px-4 py-3 border-b hover:bg-gray-100 -mx-2' do %> + <%= notification.icon %> +
+ <%= notification.message_html.html_safe %> +
+
+ <%= time_ago_in_words notification.happened_at %> ago +
+ <% end %> <% end %> +
+ <%= link_to main_app.mark_all_read_path, class: 'block bg-blue-100 hover:bg-blue-50 text-black text-center py-2' do %> + Mark all notifications read + <% end %> + <%= link_to main_app.notifications_path, class: 'block bg-notebook-blue hover:bg-blue-500 text-white text-center font-bold py-2' do %> + See all notifications <% end %>
- <%= link_to main_app.mark_all_read_path, class: 'block bg-blue-100 hover:bg-blue-50 text-black text-center py-2' do %> - Mark all notifications read - <% end %> - <%= link_to main_app.notifications_path, class: 'block bg-notebook-blue hover:bg-blue-500 text-white text-center font-bold py-2' do %> - See all notifications - <% end %>
-
+ <% end %> <%= form_tag main_app.search_path, method: :get, class: 'inline-block relative -top-2' do %> <% end %> -
- -
+ <% if user_signed_in? %> +
+ +
-
-
- <%= link_to current_user do %> - <%= image_tag current_user.image_url(size=32), class: 'rounded-full mr-2 p-1 border-2 border-notebook-blue' %> - <% end %> -
-
You're signed in as
-
- <%= link_to current_user.display_name, current_user %> +
+
+ <%= link_to current_user do %> + <%= image_tag current_user.image_url(size=32), class: 'rounded-full mr-2 p-1 border-2 border-notebook-blue' %> + <% end %> +
+
You're signed in as
+
+ <%= link_to current_user.display_name, current_user %> +
-
- <%= link_to current_user.profile_url, class: 'flex items-center px-4 py-2 cursor-pointer group hover:bg-notebook-blue hover:text-white' do %> - <%= User.icon %> - Profile - <% end %> - <%= link_to main_app.subscription_path, class: 'flex items-center px-4 py-2 cursor-pointer group hover:bg-notebook-blue hover:text-white' do %> - credit_card - Billing - - PREMIUM - - <% end %> - <%= link_to main_app.edit_user_registration_path, class: 'flex items-center px-4 py-2 cursor-pointer group hover:bg-notebook-blue hover:text-white border-b border-gray-300' do %> - settings - Settings - <% end %> - <%= link_to main_app.data_vault_path, class: 'flex items-center px-4 py-2 cursor-pointer group hover:bg-notebook-blue hover:text-white' do %> - lock - Data Vault - <% end %> - <%= link_to main_app.help_center_path, class: 'flex items-center px-4 py-2 cursor-pointer group hover:bg-notebook-blue hover:text-white border-b border-gray-300' do %> - help - Help Center - <% end %> - <%= link_to main_app.destroy_user_session_path, class: 'flex items-center px-4 py-2 cursor-pointer group hover:bg-notebook-blue hover:text-white' do %> - power_settings_new - Sign Out - <% end %> + <%= link_to current_user.profile_url, class: 'flex items-center px-4 py-2 cursor-pointer group hover:bg-notebook-blue hover:text-white' do %> + <%= User.icon %> + Profile + <% end %> + <%= link_to main_app.subscription_path, class: 'flex items-center px-4 py-2 cursor-pointer group hover:bg-notebook-blue hover:text-white' do %> + credit_card + Billing + + PREMIUM + + <% end %> + <%= link_to main_app.edit_user_registration_path, class: 'flex items-center px-4 py-2 cursor-pointer group hover:bg-notebook-blue hover:text-white border-b border-gray-300' do %> + settings + Settings + <% end %> + <%= link_to main_app.data_vault_path, class: 'flex items-center px-4 py-2 cursor-pointer group hover:bg-notebook-blue hover:text-white' do %> + lock + Data Vault + <% end %> + <%= link_to main_app.help_center_path, class: 'flex items-center px-4 py-2 cursor-pointer group hover:bg-notebook-blue hover:text-white border-b border-gray-300' do %> + help + Help Center + <% end %> + <%= link_to main_app.destroy_user_session_path, class: 'flex items-center px-4 py-2 cursor-pointer group hover:bg-notebook-blue hover:text-white' do %> + power_settings_new + Sign Out + <% end %> +
-
+ <% end %>