Sha256: f4b43763e4c3973f58d19d9af7173ca64f280360cfeb9b9b7b1ec05b728fddce

Contents?: true

Size: 1.05 KB

Versions: 17

Compression:

Stored size: 1.05 KB

Contents

module Naf
  class ApplicationController < Naf.controller_class
    layout Naf.layout

    require 'will_paginate/array'

    protect_from_forgery

    protected

    # Sets current rows_per_page direction from cookies or params.
    def set_rows_per_page
      if params[:iDisplayLength].present?
        @rows_per_page = (params[:iDisplayLength] or "20").to_i
      elsif cookies[:iDisplayLength].present?
        @rows_per_page = cookies[:iDisplayLength].to_i
      else
        @rows_per_page = 20
      end
      cookies[:iDisplayLength] = @rows_per_page
    end

    # Sets current page
    def set_page
      @page = (params[:iDisplayStart] ? ( params[:iDisplayStart].to_i / @rows_per_page ) + 1 : 1)
    end

    def set_search_status
      @search_status = cookies[:search_status]
    end

    # Sets current search status
    def set_status
      status = params[:search][:status]
      if status.present?
        @search_status = status.to_sym
      else
        @search_status = :all
      end
      cookies[:search_status] = @search_status
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
naf-2.1.6 app/controllers/naf/application_controller.rb
naf-2.1.5 app/controllers/naf/application_controller.rb
naf-2.1.4 app/controllers/naf/application_controller.rb
naf-2.1.3 app/controllers/naf/application_controller.rb
naf-2.1.2 app/controllers/naf/application_controller.rb
naf-2.1.1 app/controllers/naf/application_controller.rb
naf-2.1.0 app/controllers/naf/application_controller.rb
naf-2.0.4 app/controllers/naf/application_controller.rb
naf-2.0.3 app/controllers/naf/application_controller.rb
naf-2.0.2 app/controllers/naf/application_controller.rb
naf-2.0.1 app/controllers/naf/application_controller.rb
naf-2.0.0 app/controllers/naf/application_controller.rb
naf-1.1.4 app/controllers/naf/application_controller.rb
naf-1.1.3 app/controllers/naf/application_controller.rb
naf-1.1.2 app/controllers/naf/application_controller.rb
naf-1.1.1 app/controllers/naf/application_controller.rb
naf-1.1.0 app/controllers/naf/application_controller.rb