From ed918880fb09b8beb43df457d5d7488690f4956a Mon Sep 17 00:00:00 2001 From: Torsten Date: Thu, 22 Dec 2022 16:27:05 +0200 Subject: [PATCH] minimember arranging --- app/views/layouts/_header.haml | 38 +++++++++++++++++++++++++++---- app/views/members/_form.html.haml | 31 +++++++++++++------------ app/views/members/edit.html.haml | 11 +++++---- app/views/members/index.html.haml | 38 ++++++++++++++++--------------- app/views/members/show.html.haml | 28 +++++++++++------------ 5 files changed, 89 insertions(+), 57 deletions(-) diff --git a/app/views/layouts/_header.haml b/app/views/layouts/_header.haml index aa3a402..93aa853 100644 --- a/app/views/layouts/_header.haml +++ b/app/views/layouts/_header.haml @@ -11,12 +11,30 @@ = link_to "https://www.facebook.com/hubfeenix" , :target => "_blank" do = image_tag("fb" , class: "h-10 rounded-md") %li - - if member_signed_in? - .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 - =link_to current_member.email , main_app.member_path(current_member) - - else + - unless member_signed_in? %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 + - else + .inline-flex.items-stretch.rounded-md.border + .rounded-l-md.px-4.py-2.text-sm.text-gray-600.hover:bg-cyan-100.hover:text-gray-900 + =link_to current_member.email , main_app.member_path(current_member) + .relative + %button.inline-flex.h-full.items-center.justify-center.rounded-r-md.border-l.border-gray-100.px-2.text-gray-600.hover:bg-cyan-400{:type => "button" , onclick: "dropdown();" } + %span.sr-only Menu + %svg.h-4.w-4{:fill => "currentColor", :viewbox => "0 0 20 20", :xmlns => "http://www.w3.org/2000/svg"} + %path{"clip-rule" => "evenodd", :d => "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z", "fill-rule" => "evenodd"} + #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 => "#", :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 => "#", :role => "menuitem"} + Profile + %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 + .lg:hidden.flex.items-center.justify-between .mr-20 = link_to "https://www.facebook.com/hubfeenix" , :target => "_blank" do @@ -44,6 +62,7 @@ %li %a.font-medium.tracking-wide.text-xl{ :href => "/#{link}" , :title => link.capitalize}= link.capitalize :javascript + var drop_hidden = true; function menu_on() { var x = document.getElementById("mobile-menu"); x.style.display = "block"; @@ -52,3 +71,14 @@ var x = document.getElementById("mobile-menu"); x.style.display = "none"; } + function dropdown(){ + var x = document.getElementById("menu-dropdown"); + if( drop_hidden == true){ + x.style.display = "block"; + drop_hidden = false ; + } else { + x.style.display = "none"; + drop_hidden = true ; + } + + } diff --git a/app/views/members/_form.html.haml b/app/views/members/_form.html.haml index ac9e0e2..38dc344 100644 --- a/app/views/members/_form.html.haml +++ b/app/views/members/_form.html.haml @@ -1,16 +1,17 @@ -= form_for @member do |f| - - if @member.errors.any? - #error_explanation - %h2= "#{pluralize(@member.errors.count, "error")} prohibited this member from being saved:" - %ul - - @member.errors.full_messages.each do |message| - %li= message +.flex.flex-col + = form_for @member do |f| + - if @member.errors.any? + #error_explanation + %h2= "#{pluralize(@member.errors.count, "error")} prohibited this member from being saved:" + %ul + - @member.errors.full_messages.each do |message| + %li= message - .field - = f.label :name - = f.text_field :name - .field - = f.label :public - = f.check_box :public - .actions - = f.submit 'Save' + .field + = f.label :name + = f.text_field :name + .field + = f.label :public + = f.check_box :public + .actions + = f.submit 'Save' diff --git a/app/views/members/edit.html.haml b/app/views/members/edit.html.haml index 3a227b0..8c55180 100644 --- a/app/views/members/edit.html.haml +++ b/app/views/members/edit.html.haml @@ -1,7 +1,8 @@ -%h1 Editing member +.flex.justify-center + .flex.flex-col + %h1 Editing member -= render 'form' + = render 'form' -= link_to 'Show', @member -\| -= link_to 'Back', members_path + = link_to 'Show', @member + = link_to 'Back', members_path diff --git a/app/views/members/index.html.haml b/app/views/members/index.html.haml index 9f0463a..ea556b4 100644 --- a/app/views/members/index.html.haml +++ b/app/views/members/index.html.haml @@ -1,23 +1,25 @@ -%h1 Listing members +.flex.justify-center -%table - %thead - %tr - %th Name - %th Public - %th - %th - %th + %h1 Listing members - %tbody - - @members.each do |member| + %table + %thead %tr - %td= member.name - %td= member.public - %td= link_to 'Show', member - %td= link_to 'Edit', edit_member_path(member) - %td= link_to 'Destroy', member, method: :delete, data: { confirm: 'Are you sure?' } + %th Name + %th Public + %th + %th + %th -%br + %tbody + - @members.each do |member| + %tr + %td= member.name + %td= member.public + %td= link_to 'Show', member + %td= link_to 'Edit', edit_member_path(member) + %td= link_to 'Destroy', member, method: :delete, data: { confirm: 'Are you sure?' } -= link_to 'New Member', new_member_path + %br + + = link_to 'New Member', new_member_path diff --git a/app/views/members/show.html.haml b/app/views/members/show.html.haml index dedbd58..74e0c0d 100644 --- a/app/views/members/show.html.haml +++ b/app/views/members/show.html.haml @@ -1,16 +1,14 @@ -%p#notice= notice +.flex.justify-center + .flex.flex-col + %p + %b Name: + = @member.name + %p + %b Public: + = @member.public -%p - %b Name: - = @member.name -%p - %b Public: - = @member.public - -= link_to 'Edit', edit_member_path(@member) -\| -= link_to 'Back', members_path -\| -= form_tag( destroy_member_session_path , {method: :delete } ) do - %button.bg-cyan-200.mr-3.inline-block.rounded-lg.px-4.py-3.text-md.font-medium.border.border-gray-400{type: :submit} - Sign out + = link_to 'Edit', edit_member_path(@member) + = link_to 'Back', members_path + = form_tag( destroy_member_session_path , {method: :delete } ) do + %button.bg-cyan-200.mr-3.inline-block.rounded-lg.px-4.py-3.text-md.font-medium.border.border-gray-400{type: :submit} + Sign out