Sha256: 50e887fbb8c730efaf757e8a07fd28694442ddf5f98ea4997f5561129865dd57

Contents?: true

Size: 969 Bytes

Versions: 16

Compression:

Stored size: 969 Bytes

Contents

require 'snaptable/constructor/sortable'
require 'snaptable/constructor/collection'
require 'snaptable/constructor/renderer'

module Snaptable
  module Constructor

      class BaseTable < SimpleDelegator
        include Sortable
        include Collection
        include Renderer

        def initialize(parent, collection = nil, options = {})
          super(parent)
          @options = options
          @collection = collection || model
          @token = stored_token if Snaptable.use_permission
        end

        def options
          @options
        end

        def url
          :id
        end

        def table_name
          self.class.name.underscore
        end

        def paginate_key
          "#{table_name}_page"
        end

        private

        def stored_token
          session[:token] = params[:token] if params[:token]
          return session[:token]
        end
      end

  end
end

BaseTable = Snaptable::Constructor::BaseTable

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
snaptable-4.0.2 lib/snaptable/constructor/base_table.rb
snaptable-4.0.1 lib/snaptable/constructor/base_table.rb
snaptable-4.0.0 lib/snaptable/constructor/base_table.rb
snaptable-3.0.0 lib/snaptable/constructor/base_table.rb
snaptable-2.2.4 lib/snaptable/constructor/base_table.rb
snaptable-2.2.3 lib/snaptable/constructor/base_table.rb
snaptable-2.2.2 lib/snaptable/constructor/base_table.rb
snaptable-2.2.1 lib/snaptable/constructor/base_table.rb
snaptable-2.2.0 lib/snaptable/constructor/base_table.rb
snaptable-2.1.0 lib/snaptable/constructor/base_table.rb
snaptable-2.0.5 lib/snaptable/constructor/base_table.rb
snaptable-2.0.4 lib/snaptable/constructor/base_table.rb
snaptable-2.0.2 lib/snaptable/constructor/base_table.rb
snaptable-2.0.1 lib/snaptable/constructor/base_table.rb
snaptable-2.0 lib/snaptable/constructor/base_table.rb
snaptable-1.2.0 lib/snaptable/constructor/base_table.rb