Sha256: a3a190ff868fbc1c1ac5d7dfdbc8e76e52f2ca909e3afcce39e79bafe7caa0be

Contents?: true

Size: 965 Bytes

Versions: 5

Compression:

Stored size: 965 Bytes

Contents

module Netzke
  module Grid
    module Actions
      extend ActiveSupport::Concern

      included do
        action :add do |a|
          a.icon = :add
        end

        action :edit do |a|
          a.disabled = true # initial
          a.icon = :table_edit
        end

        action :delete do |a|
          a.disabled = true # initial
          a.icon = :table_row_delete
        end

        action :apply do |a|
          a.icon = :tick
        end

        action :search do |a|
          a.enable_toggle = true
          a.icon = :magnifier
        end
      end

      def has_add_action?
        allowed_to?(:create)
      end

      def has_edit_action?
        allowed_to?(:update)
      end

      def has_apply_action?
        config.edit_inline && (allowed_to?(:create) || allowed_to?(:update))
      end

      def has_delete_action?
        allowed_to?(:delete)
      end

      def has_search_action?
        true
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
netzke-basepack-1.0.0.1 lib/netzke/grid/actions.rb
netzke-basepack-1.0.0.0 lib/netzke/grid/actions.rb
netzke-basepack-1.0.0.0.pre3 lib/netzke/grid/actions.rb
netzke-basepack-1.0.0.0.pre2 lib/netzke/grid/actions.rb
netzke-basepack-1.0.0.0.pre lib/netzke/grid/actions.rb