From 640ddc0f537f909bfcabf15d21c81c66761bebf0 Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Wed, 1 May 2024 22:16:43 +0200 Subject: [PATCH] Remove `render_flash_notice` helper Since we only used this internally we can simply remove this, instead of deprecating it. If you used this helper anyway, please render Alchemy::Admin::Message.new(message, type: flash_type, dismissable: true) instead. --- app/helpers/alchemy/base_helper.rb | 9 -------- .../admin/partials/_flash_notices.html.erb | 2 +- spec/helpers/alchemy/base_helper_spec.rb | 22 ------------------- 3 files changed, 1 insertion(+), 32 deletions(-) diff --git a/app/helpers/alchemy/base_helper.rb b/app/helpers/alchemy/base_helper.rb index 7def0540a4..f2abf1123d 100644 --- a/app/helpers/alchemy/base_helper.rb +++ b/app/helpers/alchemy/base_helper.rb @@ -46,15 +46,6 @@ def render_message(type = :info, msg = nil, &blk) render Alchemy::Admin::Message.new(msg || capture(&blk), type: type) end - # Renders a dismissable growl message. - # - # @param [String] notice - The notice you want to display - # @param [Symbol] type - The type of this flash. Valid values are +:notice+ (default), +:warn+, +:info+ and +:error+ - # - def render_flash_notice(notice, type = :notice) - render Alchemy::Admin::Message.new(notice, type: type, dismissable: true) - end - # Checks if the given argument is a String or a Page object. # If a String is given, it tries to find the page via page_layout # Logs a warning if no page is given. diff --git a/app/views/alchemy/admin/partials/_flash_notices.html.erb b/app/views/alchemy/admin/partials/_flash_notices.html.erb index 3ff6440cf4..7db4e73f54 100644 --- a/app/views/alchemy/admin/partials/_flash_notices.html.erb +++ b/app/views/alchemy/admin/partials/_flash_notices.html.erb @@ -1,7 +1,7 @@
<% flash.keys.each do |flash_type| %> <% if flash[flash_type.to_sym].present? %> - <%= render_flash_notice(flash[flash_type.to_sym], flash_type) %> + <%= render Alchemy::Admin::Message.new(flash[flash_type.to_sym], type: flash_type, dismissable: true) %> <% end %> <% end %>
diff --git a/spec/helpers/alchemy/base_helper_spec.rb b/spec/helpers/alchemy/base_helper_spec.rb index c08e751aa7..551a35214a 100644 --- a/spec/helpers/alchemy/base_helper_spec.rb +++ b/spec/helpers/alchemy/base_helper_spec.rb @@ -44,28 +44,6 @@ module Alchemy end end - describe "#render_flash_notice" do - context "if no argument is passed" do - it "should render an alchemy-message with an check icon and the given content" do - expect(helper.render_flash_notice("my notice")).to eq <<~HTML - - my notice - - HTML - end - end - - context "if an argument is passed" do - it "should render the passed argument as the type for the message" do - expect(helper.render_flash_notice("A error", :error)).to eq <<~HTML - - A error - - HTML - end - end - end - describe "#page_or_find" do let(:page) { create(:alchemy_page, :public) }