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-3.0.13 config/initializers/concern_bulk_delete.rb
thecore_ui_rails_admin-3.0.12 config/initializers/concern_bulk_delete.rb
thecore_ui_rails_admin-3.0.11 config/initializers/thecore_rails_admin_bulk_delete_concern.rb
thecore_ui_rails_admin-3.0.10 config/initializers/thecore_rails_admin_bulk_delete_concern.rb
thecore_ui_rails_admin-3.0.9 config/initializers/thecore_rails_admin_bulk_delete_concern.rb
thecore_ui_rails_admin-3.0.8 config/initializers/thecore_rails_admin_bulk_delete_concern.rb
thecore_ui_rails_admin-3.0.7 config/initializers/thecore_rails_admin_bulk_delete_concern.rb
thecore_ui_rails_admin-3.0.6 config/initializers/thecore_rails_admin_bulk_delete_concern.rb
thecore_ui_rails_admin-3.0.5 config/initializers/thecore_rails_admin_bulk_delete_concern.rb
thecore_ui_rails_admin-3.0.4 config/initializers/thecore_rails_admin_bulk_delete_concern.rb
thecore_ui_rails_admin-3.0.3 config/initializers/thecore_rails_admin_bulk_delete_concern.rb
thecore_ui_rails_admin-3.0.0 config/initializers/thecore_rails_admin_bulk_delete_concern.rb
thecore_ui_rails_admin-2.7.7 lib/concerns/thecore_rails_admin_bulk_delete_concern.rb
thecore_ui_rails_admin-2.7.5 lib/concerns/thecore_rails_admin_bulk_delete_concern.rb
thecore_ui_rails_admin-2.7.4 lib/concerns/thecore_rails_admin_bulk_delete_concern.rb
thecore_ui_rails_admin-2.7.3 lib/concerns/thecore_rails_admin_bulk_delete_concern.rb
thecore_ui_rails_admin-2.7.2.pre.test lib/concerns/thecore_rails_admin_bulk_delete_concern.rb
thecore_ui_rails_admin-2.7.1 lib/concerns/thecore_rails_admin_bulk_delete_concern.rb
thecore_ui_rails_admin-2.7.0 lib/concerns/thecore_rails_admin_bulk_delete_concern.rb
thecore_ui_rails_admin-2.6.3 lib/concerns/thecore_rails_admin_bulk_delete_concern.rb