Sha256: b7843d126edfe2a051620af3bd70cdb885a51da9fef21ad3f8daab02b9cbf282

Contents?: true

Size: 742 Bytes

Versions: 46

Compression:

Stored size: 742 Bytes

Contents

require 'active_support/concern'

module BulkDeleteConcern
  extend ActiveSupport::Concern
  included do
    # Should the action be visible
    # Edit By taris, it shows the button only if there are records displayed
    register_instance_option :visible? do
      # If not in index, then return true,
      # otherwise it wont' be added to the list
      # of all Actions during rails initialization
      # In index, instead, I show it only if there are records in the current view
      bindings[:controller].action_name == "index" ? (authorized? && !bindings[:controller].instance_variable_get("@objects").blank?) : true
    end
  end
end

# include the extension
RailsAdmin::Config::Actions::BulkDelete.send(:include, BulkDeleteConcern)

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
thecore-1.7.7 lib/thecore_rails_admin_bulk_delete_concern.rb
thecore-1.7.5 lib/thecore_rails_admin_bulk_delete_concern.rb
thecore-1.7.3 lib/thecore_rails_admin_bulk_delete_concern.rb
thecore-1.7.2 lib/thecore_rails_admin_bulk_delete_concern.rb
thecore-1.7.1 lib/thecore_rails_admin_bulk_delete_concern.rb
thecore-1.7.0 lib/thecore_rails_admin_bulk_delete_concern.rb
thecore-1.6.13 lib/thecore_rails_admin_bulk_delete_concern.rb
thecore-1.6.10 lib/thecore_rails_admin_bulk_delete_concern.rb
thecore-1.6.9 lib/thecore_rails_admin_bulk_delete_concern.rb
thecore-1.6.8 lib/thecore_rails_admin_bulk_delete_concern.rb
thecore-1.6.7 lib/thecore_rails_admin_bulk_delete_concern.rb
thecore-1.6.5 lib/thecore_rails_admin_bulk_delete_concern.rb
thecore-1.6.4 lib/thecore_rails_admin_bulk_delete_concern.rb
thecore-1.6.3 lib/thecore_rails_admin_bulk_delete_concern.rb
thecore-1.6.2 lib/thecore_rails_admin_bulk_delete_concern.rb
thecore-1.6.1 lib/thecore_rails_admin_bulk_delete_concern.rb
thecore-1.6.0 lib/thecore_rails_admin_bulk_delete_concern.rb
thecore-1.5.14 lib/thecore_rails_admin_bulk_delete_concern.rb
thecore-1.5.13 lib/thecore_rails_admin_bulk_delete_concern.rb
thecore-1.5.12 lib/thecore_rails_admin_bulk_delete_concern.rb