mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Update admin flashes
This commit is contained in:
@@ -20,6 +20,8 @@ class ApplicationReflex < StimulusReflex::Reflex
|
||||
|
||||
delegate :current_user, to: :connection
|
||||
|
||||
private
|
||||
|
||||
def current_ability
|
||||
Spree::Ability.new(current_user)
|
||||
end
|
||||
@@ -27,4 +29,8 @@ class ApplicationReflex < StimulusReflex::Reflex
|
||||
def with_locale(&block)
|
||||
I18n.with_locale(current_user.locale, &block)
|
||||
end
|
||||
|
||||
def morph_admin_flashes
|
||||
morph "#flashes", render(partial: "admin/shared/flashes", locals: { flashes: flash })
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,6 +21,6 @@ class WhiteLabelReflex < ApplicationReflex
|
||||
I18n.t("admin.enterprises.form.white_label.remove_logo_success")
|
||||
}
|
||||
cable_ready.dispatch_event(name: "modal:close")
|
||||
morph "#flashes", render(partial: "shared/flashes", locals: { flashes: flash })
|
||||
morph_admin_flashes
|
||||
end
|
||||
end
|
||||
|
||||
6
app/views/admin/shared/_flashes.html.haml
Normal file
6
app/views/admin/shared/_flashes.html.haml
Normal file
@@ -0,0 +1,6 @@
|
||||
#flashes
|
||||
- if defined? flashes
|
||||
- flashes.each do |type, msg|
|
||||
.animate-show{"data-controller": "flash"}
|
||||
.flash{type: "#{type}", class: "#{type}"}
|
||||
%span= msg
|
||||
@@ -4,14 +4,7 @@
|
||||
|
||||
#wrapper
|
||||
.flash-container
|
||||
- if flash[:error]
|
||||
.flash.error= flash[:error]
|
||||
- if notice
|
||||
.flash.notice= notice
|
||||
- if flash[:success]
|
||||
.flash.success= flash[:success]
|
||||
|
||||
= render partial: "shared/flashes"
|
||||
= render partial: "admin/shared/flashes", locals: { flashes: flash }
|
||||
|
||||
= render partial: "spree/layouts/admin/progress_spinner"
|
||||
|
||||
|
||||
@@ -2,12 +2,8 @@
|
||||
%head= render :partial => 'spree/admin/shared/head'
|
||||
%body.admin{"data-turbo": "false", "data-ajax-root-path": main_app.root_path}
|
||||
#wrapper
|
||||
- if flash[:error]
|
||||
.flash.error= flash[:error]
|
||||
- if notice
|
||||
.flash.notice= notice
|
||||
- if flash[:success]
|
||||
.flash.success= flash[:success]
|
||||
= render partial: "admin/shared/flashes", locals: { flashes: flash }
|
||||
|
||||
= render partial: "spree/layouts/admin/progress_spinner"
|
||||
|
||||
%header#header
|
||||
|
||||
Reference in New Issue
Block a user