From 9b567a6710e4ed508f272d9a36faae9f6e2e362d Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Sun, 21 Jul 2019 22:58:06 +0100 Subject: [PATCH] Remove injection_json that renders json partials, we only use ams serializers now, not rabl partials --- app/helpers/injection_helper.rb | 4 ---- app/serializers/api/rails_flash_serializer.rb | 16 ++++++++++++++++ app/views/json/_injection.html.haml | 2 -- 3 files changed, 16 insertions(+), 6 deletions(-) delete mode 100644 app/views/json/_injection.html.haml diff --git a/app/helpers/injection_helper.rb b/app/helpers/injection_helper.rb index b33049d308..4eeab21f0c 100644 --- a/app/helpers/injection_helper.rb +++ b/app/helpers/injection_helper.rb @@ -119,10 +119,6 @@ module InjectionHelper 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 - def inject_json_ams(name, data, serializer, opts = {}) if data.is_a?(Array) opts = { each_serializer: serializer }.merge(opts) diff --git a/app/serializers/api/rails_flash_serializer.rb b/app/serializers/api/rails_flash_serializer.rb index 9af00b35e0..9082ca886d 100644 --- a/app/serializers/api/rails_flash_serializer.rb +++ b/app/serializers/api/rails_flash_serializer.rb @@ -1,3 +1,19 @@ class Api::RailsFlashSerializer < ActiveModel::Serializer attributes :info, :success, :error, :notice + + def info + object.info + end + + def success + object.success + end + + def error + object.error + end + + def notice + object.notice + end end diff --git a/app/views/json/_injection.html.haml b/app/views/json/_injection.html.haml deleted file mode 100644 index ca58b4a943..0000000000 --- a/app/views/json/_injection.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -:javascript - angular.module('Darkswarm').value("#{name.to_s}", #{render partial: "json/#{partial.to_s}"})