Sha256: edb29e940e4ba875e1bc097b853cfca5266224d1d6f6f2c8380f9546f05ca684

Contents?: true

Size: 643 Bytes

Versions: 102

Compression:

Stored size: 643 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

Version data entries

102 entries across 102 versions & 2 rubygems

Version Path
thecore_ui_rails_admin-2.1.5 lib/concerns/thecore_rails_admin_bulk_delete_concern.rb
thecore_backend_commons-2.2.4 lib/patches/thecore_rails_admin_bulk_delete_concern.rb