Sha256: d40bcc604e4883128171b6d1c15501774edf38784dc01146ef4905fbe6197310

Contents?: true

Size: 588 Bytes

Versions: 3

Compression:

Stored size: 588 Bytes

Contents

# frozen_string_literal: true
require_relative "../helpers/optional_display"

module ActiveAdmin

  class Resource
    module Sidebars

      def sidebar_sections
        @sidebar_sections ||= []
      end

      def clear_sidebar_sections!
        @sidebar_sections = []
      end

      def sidebar_sections_for(action, render_context = nil)
        sidebar_sections.select { |section| section.display_on?(action, render_context) }
          .sort_by(&:priority)
      end

      def sidebar_sections?
        !!@sidebar_sections && @sidebar_sections.any?
      end

    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activeadmin-4.0.0.beta15 lib/active_admin/resource/sidebars.rb
activeadmin-4.0.0.beta14 lib/active_admin/resource/sidebars.rb
activeadmin-4.0.0.beta13 lib/active_admin/resource/sidebars.rb