From d3c23cdd746314591db089a92bd214a44b48f636 Mon Sep 17 00:00:00 2001 From: Torsten Date: Sat, 21 Jan 2023 20:25:58 +0200 Subject: [PATCH] fixing menues (mobile mostly) --- app/assets/stylesheets/application.css | 6 +----- app/helpers/application_helper.rb | 19 +++++++++++++++++++ app/models/entity.rb | 1 + app/views/layouts/_footer.haml | 4 ++-- app/views/layouts/_header.haml | 4 ++-- app/views/layouts/_member_menu.haml | 11 +++-------- app/views/layouts/_mobile_menu.haml | 9 +++++++-- app/views/members/show.html.haml | 1 - config/environments/development.rb | 2 +- config/routes.rb | 2 +- 10 files changed, 37 insertions(+), 22 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index b6b1288..d017789 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -11,12 +11,8 @@ * It is generally better to create a new file per style scope. * *= require_self + *= require merged/tailwind_styles */ #thredded--container{ max-width: 60rem; } - -.prose{ - color: inherit; - --tw-prose-bullets: #6b7280; -} diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f839217..11f5da0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -25,4 +25,23 @@ module ApplicationHelper image_tag(image , alt: someone.name , class: classes ) end + def main_menu + [["/retreats" , "Retreats"], ["/studios" , "Studios"], + ["/makerspace" , "Makerspace"],["/coworking" , "Coworking"], + ["/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/models/entity.rb b/app/models/entity.rb index 2220c8f..9d823f7 100644 --- a/app/models/entity.rb +++ b/app/models/entity.rb @@ -21,6 +21,7 @@ class Entity < ApplicationRecord end def self.response(path = "") + return "" if Rails.env.development? host = Rails.application.credentials.weather_dev host = Rails.application.credentials.weather_pro if Rails.env.production? token = Rails.application.credentials.weather_token diff --git a/app/views/layouts/_footer.haml b/app/views/layouts/_footer.haml index 4ffed6a..2126577 100644 --- a/app/views/layouts/_footer.haml +++ b/app/views/layouts/_footer.haml @@ -21,7 +21,7 @@ %p.font-medium.text-gray-900 Main %nav.mt-6{"aria-label" => "Footer Navigation - Services"} %ul.space-y-4.text-sm - -[:restreats , :studios , :makerspace , :coworking].each do |main| + -[:retreats , :studios , :makerspace , :coworking].each do |main| %li %a.text-gray-700.transition.hover:opacity-75{:href => "/#{main}"} =main.capitalize @@ -75,7 +75,7 @@ .pt-8.mt-8.border-t.border-gray-100 .grid.grid-cols-1.gap-8.lg:grid-cols-2 %p.text-xs.text-left.text-gray-500 - 2020-22. Osuuskunta Hub Feenix. All rights reserved. + 2020-23. Osuuskunta Hub Feenix. All rights reserved. %nav{"aria-label" => "Footer Navigation - Support"} %ul.flex.flex-wrap.justify-start.gap-4.text-xs.lg:justify-end %li diff --git a/app/views/layouts/_header.haml b/app/views/layouts/_header.haml index 1d03c5d..9beed92 100644 --- a/app/views/layouts/_header.haml +++ b/app/views/layouts/_header.haml @@ -4,9 +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 - - [:retreats , :studios , :makerspace , :coworking, :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 32e4f19..96011d0 100644 --- a/app/views/layouts/_member_menu.haml +++ b/app/views/layouts/_member_menu.haml @@ -1,13 +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"} - Settings - - unless Rails.env.production? - - 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 + - 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 ee1b4ee..0824cca 100644 --- a/app/views/layouts/_mobile_menu.haml +++ b/app/views/layouts/_mobile_menu.haml @@ -11,9 +11,14 @@ %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 - - [:retreats , :studios , :makerspace , :coworking, :about].each do |link| + - main_menu.each do |link , text| %li - %a.font-medium.tracking-wide.text-xl{ :href => "/#{link}" , :title => link.capitalize}= link.capitalize + %a.font-medium.tracking-wide.text-xl{ :href => "/#{link}" , :title => text }= text + %li + %hr + - mobile_menu.each do |link , text| + %li + %a.font-medium.tracking-wide.text-xl{ :href => "/#{link}" , :title => text }= text :javascript var drop_hidden = true; function menu_on() { diff --git a/app/views/members/show.html.haml b/app/views/members/show.html.haml index 17b293b..981204d 100644 --- a/app/views/members/show.html.haml +++ b/app/views/members/show.html.haml @@ -5,7 +5,6 @@ Settings and profiles %h4.text-xl.mt-4.md:text-2xl View and edit your profiles, and change settings - .grid.grid-cols-1.mx-8.gap-8.md:grid-cols-2.mx-12.gap-12.lg:grid-cols-3.mx-16.gap-16 .flex.flex-col.justify-between %h3.text-2xl.bg-gray-200.p-4.text-center Settings diff --git a/config/environments/development.rb b/config/environments/development.rb index 1877d81..a4ca1c3 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -58,7 +58,7 @@ Rails.application.configure do config.active_record.verbose_query_logs = true # Suppress logger output for asset requests. - config.assets.quiet = true + config.assets.quiet = false # Raises error for missing translations. # config.i18n.raise_on_missing_translations = true diff --git a/config/routes.rb b/config/routes.rb index 6788534..e1378aa 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -12,7 +12,7 @@ Rails.application.routes.draw do mount Thredded::Engine => '/forum' - mount Merged::Engine => "/merged" + mount Merged::Engine => "/merged" unless Rails.env.production? get "/news/:id" , to: "merged/view#page" , id: :id , as: :view_blog get ":id" , to: "merged/view#page" , id: :id , as: :view_page