Files
sx-fc/app/controllers/transactions/surveys_controller.rb
2018-05-22 11:37:08 +06:30

30 lines
590 B
Ruby

class Transactions::SurveysController < ApplicationController
def index
filter = params[:filter]
from = params[:from]
to = params[:to]
if filter.nil? && from.nil? && to.nil?
surveys = Survey.all
else
surveys = Survey.search(filter,from,to)
end
if !surveys.nil?
@surveys = Kaminari.paginate_array(surveys).page(params[:page]).per(20)
else
@surveys = []
end
@filter = filter
@from = from
@to = to
respond_to do |format|
format.html # index.html.erb
format.xls
format.json { render json: @surveys }
end
end
end