diff --git a/app/helpers/injection_helper.rb b/app/helpers/injection_helper.rb index 2422ff7e0e..b33049d308 100644 --- a/app/helpers/injection_helper.rb +++ b/app/helpers/injection_helper.rb @@ -115,6 +115,10 @@ module InjectionHelper inject_json_ams "user", spree_current_user, Api::UserSerializer end + def inject_rails_flash + inject_json_ams "railsFlash", OpenStruct.new(flash.to_hash), Api::RailsFlashSerializer + end + def inject_json(name, partial, opts = {}) render partial: "json/injection", locals: { name: name, partial: partial }.merge(opts) end diff --git a/app/serializers/api/rails_flash_serializer.rb b/app/serializers/api/rails_flash_serializer.rb new file mode 100644 index 0000000000..9af00b35e0 --- /dev/null +++ b/app/serializers/api/rails_flash_serializer.rb @@ -0,0 +1,3 @@ +class Api::RailsFlashSerializer < ActiveModel::Serializer + attributes :info, :success, :error, :notice +end diff --git a/app/views/json/_flash.rabl b/app/views/json/_flash.rabl deleted file mode 100644 index 5a90e00f02..0000000000 --- a/app/views/json/_flash.rabl +++ /dev/null @@ -1,2 +0,0 @@ -object OpenStruct.new(flash.to_hash) -attributes :info, :success, :error, :notice diff --git a/app/views/layouts/darkswarm.html.haml b/app/views/layouts/darkswarm.html.haml index b95f87085e..d8489d0668 100644 --- a/app/views/layouts/darkswarm.html.haml +++ b/app/views/layouts/darkswarm.html.haml @@ -44,7 +44,7 @@ = inject_current_hub = inject_current_user - = inject_json "railsFlash", "flash" + = inject_rails_flash = inject_taxons = inject_properties = inject_current_order