Sha256: 613dcd8e19a042b09dc6ff5d167893730161c08b1e6f433046c0a24652402869

Contents?: true

Size: 864 Bytes

Versions: 126

Compression:

Stored size: 864 Bytes

Contents

module Avo
  module Concerns
    module HasEditableControls
      extend ActiveSupport::Concern

      included do
        class_attribute :show_controls
        class_attribute :show_controls_holder
        class_attribute :show_controls_holder_called, default: false
      end

      def has_show_controls?
        return false if ::Avo::App.license.lacks_with_trial(:resource_show_controls)

        self.class.show_controls.present?
      end

      def render_show_controls
        return [] if ::Avo::App.license.lacks_with_trial(:resource_show_controls)

        if show_controls.present?
          Avo::Resources::Controls::ExecutionContext.new(
            block: show_controls,
            resource: self,
            record: model,
            view: view
          ).handle&.items || []
        else
          []
        end
      end
    end
  end
end

Version data entries

126 entries across 126 versions & 1 rubygems

Version Path
avo-2.53.0 lib/avo/concerns/has_editable_controls.rb
avo-2.52.0 lib/avo/concerns/has_editable_controls.rb
avo-2.49.0 lib/avo/concerns/has_editable_controls.rb
avo-2.48.0 lib/avo/concerns/has_editable_controls.rb
avo-2.47.0 lib/avo/concerns/has_editable_controls.rb
avo-2.46.0 lib/avo/concerns/has_editable_controls.rb
avo-2.45.0 lib/avo/concerns/has_editable_controls.rb
avo-2.44.0 lib/avo/concerns/has_editable_controls.rb
avo-2.43.0 lib/avo/concerns/has_editable_controls.rb
avo-2.42.2 lib/avo/concerns/has_editable_controls.rb
avo-2.42.1 lib/avo/concerns/has_editable_controls.rb
avo-2.42.0 lib/avo/concerns/has_editable_controls.rb
avo-2.41.0 lib/avo/concerns/has_editable_controls.rb
avo-2.40.0 lib/avo/concerns/has_editable_controls.rb
avo-2.39.0 lib/avo/concerns/has_editable_controls.rb
avo-2.38.0 lib/avo/concerns/has_editable_controls.rb
avo-2.37.2 lib/avo/concerns/has_editable_controls.rb
avo-2.37.1 lib/avo/concerns/has_editable_controls.rb
avo-2.37.0 lib/avo/concerns/has_editable_controls.rb
avo-2.36.3 lib/avo/concerns/has_editable_controls.rb