Sha256: 9f5d1538cbf84bc42653a499a7b87809d21dfc6817e38cbbafb12e04b9d077b8

Contents?: true

Size: 1.35 KB

Versions: 50

Compression:

Stored size: 1.35 KB

Contents

module Plutonium
  module Core
    class Action
      RouteOptions = Data.define :action, :method, :options do
        def initialize(action: nil, method: :get, options: {})
          super
        end
      end

      attr_reader :name, :label, :icon, :route_options, :confirmation, :turbo_frame, :color, :category, :position

      def initialize(
        name, label: nil, icon: nil, color: nil, confirmation: nil, route_options: nil, turbo_frame: nil,
        collection_action: false, collection_record_action: false, record_action: false, bulk_action: false,
        category: nil, position: 50
      )
        @name = name
        @icon = icon
        @label = label || name.to_s.humanize
        @route_options = route_options || RouteOptions.new
        @turbo_frame = turbo_frame
        @color = color
        @confirmation = confirmation
        @collection_action = collection_action
        @collection_record_action = collection_record_action
        @record_action = record_action
        @bulk_action = bulk_action
        @category = category
        @position = position
      end

      def collection_action?
        @collection_action
      end

      def collection_record_action?
        @collection_record_action
      end

      def record_action?
        @record_action
      end

      def bulk_action?
        @bulk_action
      end
    end
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
plutonium-0.15.22 lib/plutonium/core/action.rb
plutonium-0.15.21 lib/plutonium/core/action.rb
plutonium-0.15.20 lib/plutonium/core/action.rb
plutonium-0.15.19 lib/plutonium/core/action.rb
plutonium-0.15.18 lib/plutonium/core/action.rb
plutonium-0.15.17 lib/plutonium/core/action.rb
plutonium-0.15.16 lib/plutonium/core/action.rb
plutonium-0.15.15 lib/plutonium/core/action.rb
plutonium-0.15.14 lib/plutonium/core/action.rb
plutonium-0.15.13 lib/plutonium/core/action.rb
plutonium-0.15.12 lib/plutonium/core/action.rb
plutonium-0.15.11 lib/plutonium/core/action.rb
plutonium-0.15.10 lib/plutonium/core/action.rb
plutonium-0.15.9 lib/plutonium/core/action.rb
plutonium-0.15.8 lib/plutonium/core/action.rb
plutonium-0.15.7 lib/plutonium/core/action.rb
plutonium-0.15.6 lib/plutonium/core/action.rb
plutonium-0.15.5 lib/plutonium/core/action.rb
plutonium-0.15.4 lib/plutonium/core/action.rb
plutonium-0.15.3 lib/plutonium/core/action.rb