Update admin flashes

This commit is contained in:
Matt-Yorkley
2023-05-19 18:41:18 +01:00
parent 048df6230b
commit 73b41154cc
5 changed files with 16 additions and 15 deletions

View File

@@ -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

View File

@@ -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

View 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

View File

@@ -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"

View File

@@ -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