add proper flash messages
This commit is contained in:
parent
f5d53b6d1c
commit
d10361f13d
@ -13,7 +13,9 @@ module Merged
|
|||||||
button( text , url , "bg-green-500" )
|
button( text , url , "bg-green-500" )
|
||||||
end
|
end
|
||||||
def submit_button(text , danger = false )
|
def submit_button(text , danger = false )
|
||||||
clazz = danger ? "bg-blue-500 " : "bg-blue-500 " + button_classes
|
clazz = "bg-blue-500 " #full names, no tricks for tailwind
|
||||||
|
clazz = "bg-red-500 " if danger
|
||||||
|
clazz += button_classes
|
||||||
content_tag(:button , class: clazz , type: :submit) do
|
content_tag(:button , class: clazz , type: :submit) do
|
||||||
text
|
text
|
||||||
end
|
end
|
||||||
|
28
app/views/layouts/_merged_messages.haml
Normal file
28
app/views/layouts/_merged_messages.haml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#flash
|
||||||
|
-if flash.alert
|
||||||
|
.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
|
||||||
|
.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();
|
@ -46,4 +46,5 @@
|
|||||||
%svg.h-5.w-5{:fill => "none", :stroke => "currentColor", "stroke-width" => "2", :viewbox => "0 0 24 24", :xmlns => "http://www.w3.org/2000/svg"}
|
%svg.h-5.w-5{:fill => "none", :stroke => "currentColor", "stroke-width" => "2", :viewbox => "0 0 24 24", :xmlns => "http://www.w3.org/2000/svg"}
|
||||||
%path{:d => "M4 6h16M4 12h16M4 18h16", "stroke-linecap" => "round", "stroke-linejoin" => "round"}
|
%path{:d => "M4 6h16M4 12h16M4 18h16", "stroke-linecap" => "round", "stroke-linejoin" => "round"}
|
||||||
|
|
||||||
|
= render "layouts/merged_messages"
|
||||||
= yield
|
= yield
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
%p#notice= notice
|
|
||||||
|
|
||||||
- template = find_template(@section)
|
- template = find_template(@section)
|
||||||
= render( template , section: @section)
|
= render( template , section: @section)
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
%p#notice= notice
|
|
||||||
.flex.flex-col.bg-white
|
.flex.flex-col.bg-white
|
||||||
.flex.items-center.justify-center.flex-1
|
.flex.items-center.justify-center.flex-1
|
||||||
.max-w-xl.px-4.py-8.mx-auto.text-center
|
.max-w-xl.px-4.py-8.mx-auto.text-center
|
||||||
@ -17,6 +16,7 @@
|
|||||||
= red_button( "Delete" , section_remove_path(section.id) )
|
= red_button( "Delete" , section_remove_path(section.id) )
|
||||||
.relative.block.border.border-gray-100.p-4
|
.relative.block.border.border-gray-100.p-4
|
||||||
%h3.mt-4.text-lg.font-bold Template
|
%h3.mt-4.text-lg.font-bold Template
|
||||||
|
= link_to(section_select_template_url(section.id)) do
|
||||||
%p= section.template
|
%p= section.template
|
||||||
= section_preview(section , class: "w-full object-contain")
|
= section_preview(section , class: "w-full object-contain")
|
||||||
.relative.block.border.border-gray-100.p-4
|
.relative.block.border.border-gray-100.p-4
|
||||||
@ -30,6 +30,7 @@
|
|||||||
=link_to section_cards_url(section.id) do
|
=link_to section_cards_url(section.id) do
|
||||||
=card_preview(section , class: "w-full object-contain")
|
=card_preview(section , class: "w-full object-contain")
|
||||||
- else
|
- else
|
||||||
|
= link_to(section_select_image_url(section.id)) do
|
||||||
%h3.mt-4.text-lg.font-bold Image
|
%h3.mt-4.text-lg.font-bold Image
|
||||||
-if section.image
|
-if section.image
|
||||||
= image_tag "cms/" + section.image
|
= image_tag "cms/" + section.image
|
||||||
@ -41,5 +42,9 @@
|
|||||||
%p
|
%p
|
||||||
= name
|
= name
|
||||||
= value
|
= value
|
||||||
|
.relative.block.border.border-gray-100
|
||||||
%p
|
%p
|
||||||
= green_button( "New Section" , new_page_section_url(@page.name) )
|
= green_button( "New Section" , new_page_section_url(@page.name) )
|
||||||
|
%p
|
||||||
|
= form_tag( page_url(@page.name) , {method: :delete } ) do
|
||||||
|
=submit_button( "Delete" , true)
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
%p#notice= notice
|
|
||||||
|
|
||||||
.flex.flex-col.bg-white
|
.flex.flex-col.bg-white
|
||||||
|
.flex.items-center.justify-center.flex-1
|
||||||
|
.max-w-xl.px-4.py-8.mx-auto.text-center
|
||||||
|
%h1.text-3xl.font-bold.tracking-tight.text-gray-900
|
||||||
|
Page #{link_to @section.page.name, page_sections_url(@section.page.name), class: "underline"}
|
||||||
.flex.items-center.justify-center.flex-1
|
.flex.items-center.justify-center.flex-1
|
||||||
.max-w-xl.px-4.py-8.mx-auto.text-center
|
.max-w-xl.px-4.py-8.mx-auto.text-center
|
||||||
%h1.text-3xl.font-bold.tracking-tight.text-gray-900
|
%h1.text-3xl.font-bold.tracking-tight.text-gray-900
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
%p#notice= notice
|
|
||||||
|
|
||||||
- template = find_template(@section)
|
- template = find_template(@section)
|
||||||
= render( template , section: @section)
|
= render( template , section: @section)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user