From 10bdfa39cdb55e8a1a0ec753d23dae3d859279dd Mon Sep 17 00:00:00 2001 From: Torsten Date: Sat, 21 Jan 2023 23:34:57 +0200 Subject: [PATCH] fix menues --- app/helpers/application_helper.rb | 18 ++++++++++++++++++ app/views/layouts/_header.haml | 6 ++---- app/views/layouts/_member_menu.haml | 10 +++------- app/views/layouts/_mobile_menu.haml | 15 +++++++++++---- 4 files changed, 34 insertions(+), 15 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 69188e1..8487591 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -54,4 +54,22 @@ module ApplicationHelper rows end + def main_menu + [["/members" , "Volunteers"],["/stories" , "Stories"], ["/info" , "Info"], + ["/arriving" , "Arriving"],["/about" , "About"], ] + end + def member_memu + items =[["/forum" ,"Forum"] , [main_app.member_path(current_member) , "Settings"]] + if current_member.admin? and !Rails.env.production? + items << [merged.pages_path(), "CMS" ] + end + items + end + def mobile_menu + if current_member + member_memu + else + [main_app.member_session_path, "Login"] + end + end end diff --git a/app/views/layouts/_header.haml b/app/views/layouts/_header.haml index 93a8fd3..28ea087 100644 --- a/app/views/layouts/_header.haml +++ b/app/views/layouts/_header.haml @@ -4,11 +4,9 @@ = image_tag("feenix_lintu.webp" , class: "h-20") %span.ml-2.text-xl.font-bold.tracking-wide.text-gray-800.uppercase Hub Feenix %ul.flex.items-center.hidden.space-x-8.lg:flex - %li - %a.font-medium.tracking-wide.text-gray-700.transition-colors.duration-400.hover:text-cyan-800{"aria-label" => "Our product", :href => "/members", :title => "Volunteers"} Volunteers - - [ :stories , :info , :arriving, :about].each do |link| + - main_menu.each do |link , text| %li - %a.font-medium.tracking-wide.text-gray-700.transition-colors.duration-400.hover:text-cyan-800{"aria-label" => "Our product", :href => "/#{link}", :title => link.capitalize}= link.capitalize + %a.font-medium.tracking-wide.text-gray-700.transition-colors.duration-400.hover:text-cyan-800{"aria-label" => "Our product", :href => link, :title => text}= text %li = link_to "https://www.facebook.com/hubfeenix" , :target => "_blank" do = image_tag("fb.webp" , class: "h-10 rounded-md") diff --git a/app/views/layouts/_member_menu.haml b/app/views/layouts/_member_menu.haml index beb6759..933cff5 100644 --- a/app/views/layouts/_member_menu.haml +++ b/app/views/layouts/_member_menu.haml @@ -1,12 +1,8 @@ #menu-dropdown.hidden.absolute.right-0.z-10.mt-4.w-36.origin-top-right.rounded-md.border.border-gray-100.bg-white.shadow-lg{:role => "menu"} .p-2 - %a.block.rounded-lg.px-4.py-2.text-sm.text-gray-500.hover:bg-gray-50.hover:text-gray-700{:href => "/forum", :role => "menuitem"} - Forum - %a.block.rounded-lg.px-4.py-2.text-sm.text-gray-500.hover:bg-gray-50.hover:text-gray-700{:href => main_app.member_path(current_member), :role => "menuitem"} - Profile - - unless Rails.env.production? - %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 + - member_memu.each do |link , text| + %a.block.rounded-lg.px-4.py-2.text-sm.text-gray-500.hover:bg-gray-50.hover:text-gray-700{:href => link, :role => "menuitem"} + =text = 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"} diff --git a/app/views/layouts/_mobile_menu.haml b/app/views/layouts/_mobile_menu.haml index 4f9a31b..d66c423 100644 --- a/app/views/layouts/_mobile_menu.haml +++ b/app/views/layouts/_mobile_menu.haml @@ -1,4 +1,4 @@ -#mobile-menu.absolute.top-0.left-0.w-full.hidden +#mobile-menu.absolute.top-0.left-0.w-full.hidden.z-10 .p-5.bg-white.border.rounded.shadow-sm .flex.items-center.justify-between.mb-4 %div @@ -10,10 +10,17 @@ %svg.w-5.text-gray-600{:viewbox => "0 0 24 24"} %path{:d => "M19.7,4.3c-0.4-0.4-1-0.4-1.4,0L12,10.6L5.7,4.3c-0.4-0.4-1-0.4-1.4,0s-0.4,1,0,1.4l6.3,6.3l-6.3,6.3 c-0.4,0.4-0.4,1,0,1.4C4.5,19.9,4.7,20,5,20s0.5-0.1,0.7-0.3l6.3-6.3l6.3,6.3c0.2,0.2,0.5,0.3,0.7,0.3s0.5-0.1,0.7-0.3 c0.4-0.4,0.4-1,0-1.4L13.4,12l6.3-6.3C20.1,5.3,20.1,4.7,19.7,4.3z", :fill => "currentColor"} %nav - %ul.space-y-6.px-20 - - [:volunteers , :stories , :info , :arriving, :about].each do |link| + %ul.space-y-6.px-20.w-lg.text-center + - main_menu.each do |link , text| %li - %a.font-medium.tracking-wide.text-xl{ :href => "/#{link}" , :title => link.capitalize}= link.capitalize + %a.w-full.h-full.block.tracking-wide.text-xl.p-2.rounded-lg.hover:bg-cyan-200{ :href => link , :title => text} + = text + %li + %hr + - mobile_menu.each do |link , text| + %li + %a.w-full.h-full.block.tracking-wide.text-xl.p-2.rounded-lg.hover:bg-cyan-200{ :href => link , :title => text} + = text :javascript var drop_hidden = true; function menu_on() {