Sha256: 63b7c4b302ef03d653878e11f507a1c753bcea488aa094be4007f8e9dc26e0e1

Contents?: true

Size: 945 Bytes

Versions: 6

Compression:

Stored size: 945 Bytes

Contents

module ScopesPatch

  protected

  def build_scope(scope, options)
    aa_data[:scopes] ||= []
    li class: classes_for_scope(scope) do
      scope_name = I18n.t "active_admin.scopes.#{scope.id}", default: scope.name
      params     = request.query_parameters.except :page, :scope, :commit, :format
      count      = nil
      url        = url_for(scope: scope.id, params: params)
      if options[:scope_count] && scope.show_count
        count = get_scope_count(scope)
      end

      a href: url, class: 'table_tools_button' do
        text_node scope_name
        span class: 'count' do
          "(#{count})"
        end if options[:scope_count] && scope.show_count
      end

      aa_data[:scopes].push({
        name: scope_name,
        url: url,
        count: count,
        current: current_scope?(scope)
      })
    end
  end

end

module ActiveAdmin
  module Views
    class Scopes
      prepend ScopesPatch
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
activeadmin_custom_layout-0.1.9 lib/activeadmin_custom_layout/layout/components/scopes.rb
activeadmin_custom_layout-0.1.8 lib/activeadmin_custom_layout/layout/components/scopes.rb
activeadmin_custom_layout-0.1.7 lib/activeadmin_custom_layout/layout/components/scopes.rb
activeadmin_custom_layout-0.1.6 lib/activeadmin_custom_layout/layout/components/scopes.rb
activeadmin_custom_layout-0.1.5 lib/activeadmin_custom_layout/layout/components/scopes.rb
activeadmin_custom_layout-0.1.4 lib/activeadmin_custom_layout/layout/components/scopes.rb