From 105f0c09b1db12cf067a1a30390545785817e8c6 Mon Sep 17 00:00:00 2001 From: Torsten Date: Mon, 23 Jan 2023 12:22:57 +0200 Subject: [PATCH] login/out for mobile menu --- app/views/layouts/_mobile_menu.haml | 9 +++++++++ app/views/members/edit.html.haml | 2 +- app/views/stories/edit.html.haml | 2 +- app/views/stories/new.html.haml | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/views/layouts/_mobile_menu.haml b/app/views/layouts/_mobile_menu.haml index d66c423..d16ff01 100644 --- a/app/views/layouts/_mobile_menu.haml +++ b/app/views/layouts/_mobile_menu.haml @@ -21,6 +21,15 @@ %li %a.w-full.h-full.block.tracking-wide.text-xl.p-2.rounded-lg.hover:bg-cyan-200{ :href => link , :title => text} = text + -if(current_member) + = form_tag( main_app.destroy_member_session_path , {method: :delete ,class: "text-center"}) do + %button.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 + -else + %a.inline-flex.items-center.justify-center.h-12.px-6.font-medium.tracking-wide.text-white.transition.duration-200.rounded-lg.shadow-md.bg-green-800.hover:bg-blue-800.focus:shadow-outline.focus:outline-none{"aria-label" => "Sign up", :href => main_app.member_session_path, :title => "Log in or Sign up"} + Login :javascript var drop_hidden = true; function menu_on() { diff --git a/app/views/members/edit.html.haml b/app/views/members/edit.html.haml index 86961f0..46e22cb 100644 --- a/app/views/members/edit.html.haml +++ b/app/views/members/edit.html.haml @@ -8,7 +8,7 @@ = simple_form_for @member do |f| .flex.justify-center - .column{class: "w-11/12 md:w-10/12 lg:w-8/12 xl:w-6/12"} + .column{class: "w-11/12 md:w-10/12"} .grid.grid-cols-1.md:grid-cols-2.mx-20.gap-10 = render "merged/form/editor" , object: @member , field: :bio, form: f .info.mr-8 diff --git a/app/views/stories/edit.html.haml b/app/views/stories/edit.html.haml index 1a691be..0c469f4 100644 --- a/app/views/stories/edit.html.haml +++ b/app/views/stories/edit.html.haml @@ -1,7 +1,7 @@ %script{:src => "https://cdn.jsdelivr.net/npm/vue@2.7.14/dist/vue.js"} %script{:src => "https://cdn.jsdelivr.net/npm/marked/marked.min.js"} .flex.justify-center - .column{class: "w-10/12 md:w-8/12 lg:w-5/12 xl:w-4/12"} + .column{class: "w-10/12 md:w-8/12 lg:w-7/12 xl:w-6/12"} .text-2xl.font-bold.my-4 Edit Story = render 'form' diff --git a/app/views/stories/new.html.haml b/app/views/stories/new.html.haml index 441bee3..0c18074 100644 --- a/app/views/stories/new.html.haml +++ b/app/views/stories/new.html.haml @@ -1,7 +1,7 @@ %script{:src => "https://cdn.jsdelivr.net/npm/vue@2.7.14/dist/vue.js"} %script{:src => "https://cdn.jsdelivr.net/npm/marked/marked.min.js"} .flex.justify-center - .column{class: "w-10/12 md:w-8/12 lg:w-5/12 xl:w-4/12"} + .column{class: "w-10/12 md:w-8/12 lg:w-7/12 xl:w-6/12"} .text-2xl.font-bold.my-4 New Story = render 'form'