Class: ActiveAdmin::Filters::ActiveSidebar
- Inherits:
-
SidebarSection
- Object
- SidebarSection
- ActiveAdmin::Filters::ActiveSidebar
- Defined in:
- lib/active_admin/filters/active_sidebar.rb
Instance Attribute Summary
Attributes inherited from SidebarSection
Instance Method Summary collapse
- #block ⇒ Object
-
#initialize ⇒ ActiveSidebar
constructor
A new instance of ActiveSidebar.
- #sidebar_options ⇒ Object protected
Methods inherited from SidebarSection
#custom_class, #id, #partial_name, #priority, #title
Methods included from OptionalDisplay
Constructor Details
#initialize ⇒ ActiveSidebar
Returns a new instance of ActiveSidebar.
7 8 9 |
# File 'lib/active_admin/filters/active_sidebar.rb', line 7 def initialize super I18n.t("active_admin.search_status.headline"), end |
Instance Method Details
#block ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/active_admin/filters/active_sidebar.rb', line 11 def block -> do active_filters = ActiveAdmin::Filters::Active.new(active_admin_config, assigns[:search]) span do if current_scope h4 I18n.t("active_admin.search_status.current_scope"), style: 'display: inline' b scope_name(current_scope), class: 'current_scope_name', style: "display: inline" end div style: "margin-top: 10px" do h4 I18n.t("active_admin.search_status.current_filters"), style: 'margin-bottom: 10px' ul do if active_filters.filters.blank? li I18n.t("active_admin.search_status.no_current_filters") else active_filters.filters.each do |filter| li filter. do span do text_node filter.label end b do text_node to_sentence(filter.values.map { |v| pretty_format(v) }) end end end end end end end end end |
#sidebar_options ⇒ Object (protected)
44 45 46 |
# File 'lib/active_admin/filters/active_sidebar.rb', line 44 def { only: :index, if: -> { active_admin_config.current_filters_enabled? && (params[:q] || params[:scope]) } } end |