flash messages, formhandler (not sending yet)

This commit is contained in:
Torsten 2022-12-09 17:19:57 +02:00
parent 4c4b660d58
commit 007698d5c4
5 changed files with 45 additions and 3 deletions

View File

@ -1,5 +1,5 @@
%header.bg-white{"aria-label" => "Site Header"}
.mx-auto.max-w-screen-xl.px-4.sm:px-6.lg:px-8
.mx-auto.max-w-screen-xl.px-8.mb-6.mt-6.sm:px-6.lg:px-10
.flex.h-16.items-center.justify-between
.flex-1.md:flex.md:items-center.md:gap-6
%a.block.text-teal-600{:href => "/"}

View File

@ -0,0 +1,29 @@
-if flash.alert
#flash
.m-20.rounded.border-l-4.border-red-500.bg-red-50.p-4{:role => "alert"}
%strong.block.font-medium.text-red-700 Oops
%p.mt-2.text-sm.text-red-700
=flash.alert
-if flash.notice
#flash
.m-20.rounded-xl.border.border-gray-100.p-4.shadow-xl{:role => "alert"}
.flex.items-start.gap-4
%span.text-green-600
%svg.h-6.w-6{:fill => "none", :stroke => "currentColor", "stroke-width" => "1.5", :viewbox => "0 0 24 24", :xmlns => "http://www.w3.org/2000/svg"}
%path{:d => "M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z", "stroke-linecap" => "round", "stroke-linejoin" => "round"}
.flex-1
%strong.block.font-medium.text-gray-900 Ok
%p.mt-1.text-sm.text-gray-700
= flash.notice
:javascript
function hideNotice() {
const notification = document.querySelector('#flash')
if (notification) {
setInterval(function() {
notification.classList.add('collapse');
}, 5000);
}
}
hideNotice();

View File

@ -11,6 +11,7 @@
= javascript_importmap_tags
%body
=render "layouts/header"
= render "layouts/header"
= render "layouts/merged_messages"
= yield
=render "layouts/footer"
= render "layouts/footer"

View File

@ -30,5 +30,7 @@ module HubfeenixFi
#
# config.time_zone = "Central Time (US & Canada)"
# config.eager_load_paths << Rails.root.join("extras")
config.autoload_paths << Rails.root.join('lib')
end
end

10
lib/form_handler.rb Normal file
View File

@ -0,0 +1,10 @@
class FormHandler
def handle_form(section , data )
puts "Section on page : #{section.page.name}"
data.each do |name , value|
puts "#{name}: #{value}"
end
end
end