implements /admin/proposals
This commit is contained in:
26
app/controllers/admin/proposals_controller.rb
Normal file
26
app/controllers/admin/proposals_controller.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
class Admin::ProposalsController < Admin::BaseController
|
||||
has_filters %w{without_confirmed_hide all with_confirmed_hide}, only: :index
|
||||
|
||||
before_action :load_proposal, only: [:confirm_hide, :restore]
|
||||
|
||||
def index
|
||||
@proposals = Proposal.only_hidden.send(@current_filter).order(hidden_at: :desc).page(params[:page])
|
||||
end
|
||||
|
||||
def confirm_hide
|
||||
@proposal.confirm_hide
|
||||
redirect_to request.query_parameters.merge(action: :index)
|
||||
end
|
||||
|
||||
def restore
|
||||
@proposal.restore
|
||||
redirect_to request.query_parameters.merge(action: :index)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def load_proposal
|
||||
@proposal = Proposal.with_hidden.find(params[:id])
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user