Sha256: 6f71c3e70e0e93025fe3a60ef09a617bd4c771ecfb9cdd39d490f49765aa3d65

Contents?: true

Size: 1.14 KB

Versions: 4

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

module PagesCore
  module Admin
    module DeprecatedAdminHelper
      def link_separator
        ActiveSupport::Deprecation.warn("link_separator is deprecated")

        safe_join [" ", tag.span("|", class: "separator"), " "]
      end

      def page_description=(description)
        ActiveSupport::Deprecation.warn(content_helper_deprecation)
        content_for(:page_description, description.html_safe)
      end
      alias page_description page_description=

      def page_description_links=(links)
        ActiveSupport::Deprecation.warn(content_helper_deprecation)
        content_for(:page_description_links, links.html_safe)
      end
      alias page_description_links page_description_links=

      def page_title=(title)
        ActiveSupport::Deprecation.warn(content_helper_deprecation)
        content_for(:page_title, title)
      end
      alias page_title page_title=

      private

      def content_helper_deprecation
        name = caller_locations(1, 1)[0].label
        replacement = name.gsub(/=$/, "")

        "The #{name} helper is deprecated, use content_for(:#{replacement})"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pages_core-3.12.4 app/helpers/pages_core/admin/deprecated_admin_helper.rb
pages_core-3.12.3 app/helpers/pages_core/admin/deprecated_admin_helper.rb
pages_core-3.12.2 app/helpers/pages_core/admin/deprecated_admin_helper.rb
pages_core-3.12.1 app/helpers/pages_core/admin/deprecated_admin_helper.rb