2024-02-25 12:15:55 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2010-03-10 18:21:43 -05:00
|
|
|
class PoolVersionsController < ApplicationController
|
2019-11-26 17:03:43 -05:00
|
|
|
respond_to :html, :json
|
2019-05-10 21:19:23 -04:00
|
|
|
before_action :member_only
|
2013-03-29 15:37:28 -04:00
|
|
|
|
2010-03-10 18:21:43 -05:00
|
|
|
def index
|
2023-07-31 13:40:25 -04:00
|
|
|
if (pool_id = params.dig(:search, :pool_id)).present?
|
|
|
|
@pool = Pool.find_by(id: pool_id)
|
2013-03-17 22:36:14 -04:00
|
|
|
end
|
2013-03-19 08:10:10 -04:00
|
|
|
|
2022-08-06 12:58:24 -04:00
|
|
|
@pool_versions = PoolVersion.search(search_params).paginate(params[:page], limit: params[:limit], search_count: params[:search])
|
2019-11-26 17:16:06 -05:00
|
|
|
respond_with(@pool_versions)
|
2010-03-10 18:21:43 -05:00
|
|
|
end
|
2016-12-14 21:09:45 -05:00
|
|
|
|
2017-02-14 19:03:19 -05:00
|
|
|
def diff
|
2022-08-06 12:58:24 -04:00
|
|
|
@pool_version = PoolVersion.find(params[:id])
|
2017-02-14 19:03:19 -05:00
|
|
|
end
|
2021-10-30 13:46:55 -04:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def search_params
|
|
|
|
permitted_params = %i[updater_id updater_name pool_id]
|
2022-11-28 10:21:40 -05:00
|
|
|
permitted_params += %i[ip_addr] if CurrentUser.is_admin?
|
2022-02-06 09:19:08 -05:00
|
|
|
permit_search_params permitted_params
|
2021-10-30 13:46:55 -04:00
|
|
|
end
|
2010-03-10 18:21:43 -05:00
|
|
|
end
|