From c56ae729266249b2e020021b2c4db60095d60e4f Mon Sep 17 00:00:00 2001 From: Torsten Date: Tue, 3 Jan 2023 19:38:04 +0200 Subject: [PATCH] fix sign out and empty member --- app/helpers/application_helper.rb | 3 ++- app/views/layouts/_member_menu.haml | 10 +++++----- app/views/members/show.html.haml | 3 ++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8a15369..9a46d19 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -11,6 +11,7 @@ module ApplicationHelper end def markdown(text) + return "" if text.blank? text = text.text unless text.is_a?(String) return "" if text.blank? self.renderer.render(text).html_safe @@ -19,5 +20,5 @@ module ApplicationHelper def main_app Rails.application.routes.url_helpers end - + end diff --git a/app/views/layouts/_member_menu.haml b/app/views/layouts/_member_menu.haml index d09c5a4..2ca7b48 100644 --- a/app/views/layouts/_member_menu.haml +++ b/app/views/layouts/_member_menu.haml @@ -7,11 +7,11 @@ - if current_member.admin? %a.block.rounded-lg.px-4.py-2.text-sm.text-gray-500.hover:bg-gray-50.hover:text-gray-700{:href => merged.pages_path(), :role => "menuitem"} CMS - %form{:action => "#", :method => "POST"} - %button.flex.w-full.items-center.gap-2.rounded-lg.px-4.py-2.text-sm.text-blue-700.hover:bg-red-50{:role => "menuitem", :type => "submit"} - %svg.h-4.w-4{:fill => "none", :stroke => "currentColor", "stroke-width" => "2", :viewbox => "0 0 24 24", :xmlns => "http://www.w3.org/2000/svg"} - %path{:d => "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16", "stroke-linecap" => "round", "stroke-linejoin" => "round"} - Sign out + = form_tag( main_app.destroy_member_session_path , {method: :delete } ) do + %button.flex.w-full.items-center.gap-2.rounded-lg.px-4.py-2.text-sm.text-blue-700.hover:bg-red-50{:role => "menuitem", :type => "submit"} + %svg.h-4.w-4{:fill => "none", :stroke => "currentColor", "stroke-width" => "2", :viewbox => "0 0 24 24", :xmlns => "http://www.w3.org/2000/svg"} + %path{:d => "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16", "stroke-linecap" => "round", "stroke-linejoin" => "round"} + Sign out :javascript var drop_hidden = true; diff --git a/app/views/members/show.html.haml b/app/views/members/show.html.haml index 22fc1e4..75b66a5 100644 --- a/app/views/members/show.html.haml +++ b/app/views/members/show.html.haml @@ -1,7 +1,8 @@ .px-4.py-16.mx-auto.sm:max-w-xl.md:max-w-full.lg:max-w-screen-xl.md:px-24.lg:px-8.lg:py-20 .flex.flex-col.max-w-screen-lg.overflow-hidden.bg-white.border.rounded.shadow-sm.lg:flex-row.sm:mx-auto .relative{:class => "lg:w-1/2"} - = image_tag @member.picture_url, class: "object-cover w-full lg:absolute h-80 lg:h-full" + -if @member.picture_url + = image_tag @member.picture_url, class: "object-cover w-full lg:absolute h-80 lg:h-full" .flex.flex-col.justify-center.p-8.lg:p-16.lg:pl-10{:class => "lg:w-1/2"} %div %p.inline-block.px-3.py-px.mb-4.text-xs.font-semibold.tracking-wider.text-teal-900.uppercase.rounded-full.bg-teal-accent-400