Extract method to redirect keeping query params
This commit is contained in:
@@ -15,14 +15,14 @@ class Admin::HiddenBudgetInvestmentsController < Admin::BaseController
|
|||||||
|
|
||||||
def confirm_hide
|
def confirm_hide
|
||||||
@investment.confirm_hide
|
@investment.confirm_hide
|
||||||
redirect_to request.query_parameters.merge(action: :index)
|
redirect_with_query_params_to(action: :index)
|
||||||
end
|
end
|
||||||
|
|
||||||
def restore
|
def restore
|
||||||
@investment.restore(recursive: true)
|
@investment.restore(recursive: true)
|
||||||
@investment.ignore_flag
|
@investment.ignore_flag
|
||||||
Activity.log(current_user, :restore, @investment)
|
Activity.log(current_user, :restore, @investment)
|
||||||
redirect_to request.query_parameters.merge(action: :index)
|
redirect_with_query_params_to(action: :index)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -10,14 +10,14 @@ class Admin::HiddenCommentsController < Admin::BaseController
|
|||||||
|
|
||||||
def confirm_hide
|
def confirm_hide
|
||||||
@comment.confirm_hide
|
@comment.confirm_hide
|
||||||
redirect_to request.query_parameters.merge(action: :index)
|
redirect_with_query_params_to(action: :index)
|
||||||
end
|
end
|
||||||
|
|
||||||
def restore
|
def restore
|
||||||
@comment.restore(recursive: true)
|
@comment.restore(recursive: true)
|
||||||
@comment.ignore_flag
|
@comment.ignore_flag
|
||||||
Activity.log(current_user, :restore, @comment)
|
Activity.log(current_user, :restore, @comment)
|
||||||
redirect_to request.query_parameters.merge(action: :index)
|
redirect_with_query_params_to(action: :index)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -13,14 +13,14 @@ class Admin::HiddenDebatesController < Admin::BaseController
|
|||||||
|
|
||||||
def confirm_hide
|
def confirm_hide
|
||||||
@debate.confirm_hide
|
@debate.confirm_hide
|
||||||
redirect_to request.query_parameters.merge(action: :index)
|
redirect_with_query_params_to(action: :index)
|
||||||
end
|
end
|
||||||
|
|
||||||
def restore
|
def restore
|
||||||
@debate.restore!(recursive: true)
|
@debate.restore!(recursive: true)
|
||||||
@debate.ignore_flag
|
@debate.ignore_flag
|
||||||
Activity.log(current_user, :restore, @debate)
|
Activity.log(current_user, :restore, @debate)
|
||||||
redirect_to request.query_parameters.merge(action: :index)
|
redirect_with_query_params_to(action: :index)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -14,14 +14,14 @@ class Admin::HiddenProposalsController < Admin::BaseController
|
|||||||
|
|
||||||
def confirm_hide
|
def confirm_hide
|
||||||
@proposal.confirm_hide
|
@proposal.confirm_hide
|
||||||
redirect_to request.query_parameters.merge(action: :index)
|
redirect_with_query_params_to(action: :index)
|
||||||
end
|
end
|
||||||
|
|
||||||
def restore
|
def restore
|
||||||
@proposal.restore(recursive: true)
|
@proposal.restore(recursive: true)
|
||||||
@proposal.ignore_flag
|
@proposal.ignore_flag
|
||||||
Activity.log(current_user, :restore, @proposal)
|
Activity.log(current_user, :restore, @proposal)
|
||||||
redirect_to request.query_parameters.merge(action: :index)
|
redirect_with_query_params_to(action: :index)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -15,13 +15,13 @@ class Admin::HiddenUsersController < Admin::BaseController
|
|||||||
|
|
||||||
def confirm_hide
|
def confirm_hide
|
||||||
@user.confirm_hide
|
@user.confirm_hide
|
||||||
redirect_to request.query_parameters.merge(action: :index)
|
redirect_with_query_params_to(action: :index)
|
||||||
end
|
end
|
||||||
|
|
||||||
def restore
|
def restore
|
||||||
@user.restore
|
@user.restore
|
||||||
Activity.log(current_user, :restore, @user)
|
Activity.log(current_user, :restore, @user)
|
||||||
redirect_to request.query_parameters.merge(action: :index)
|
redirect_with_query_params_to(action: :index)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ class Admin::OrganizationsController < Admin::BaseController
|
|||||||
|
|
||||||
def verify
|
def verify
|
||||||
@organization.verify
|
@organization.verify
|
||||||
redirect_to request.query_parameters.merge(action: :index)
|
redirect_with_query_params_to(action: :index)
|
||||||
end
|
end
|
||||||
|
|
||||||
def reject
|
def reject
|
||||||
@organization.reject
|
@organization.reject
|
||||||
redirect_to request.query_parameters.merge(action: :index)
|
redirect_with_query_params_to(action: :index)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -12,14 +12,14 @@ class Admin::ProposalNotificationsController < Admin::BaseController
|
|||||||
|
|
||||||
def confirm_hide
|
def confirm_hide
|
||||||
@proposal_notification.confirm_hide
|
@proposal_notification.confirm_hide
|
||||||
redirect_to request.query_parameters.merge(action: :index)
|
redirect_with_query_params_to(action: :index)
|
||||||
end
|
end
|
||||||
|
|
||||||
def restore
|
def restore
|
||||||
@proposal_notification.restore
|
@proposal_notification.restore
|
||||||
@proposal_notification.ignore_flag
|
@proposal_notification.ignore_flag
|
||||||
Activity.log(current_user, :restore, @proposal_notification)
|
Activity.log(current_user, :restore, @proposal_notification)
|
||||||
redirect_to request.query_parameters.merge(action: :index)
|
redirect_with_query_params_to(action: :index)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -120,4 +120,8 @@ class ApplicationController < ActionController::Base
|
|||||||
def current_budget
|
def current_budget
|
||||||
Budget.current
|
Budget.current
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def redirect_with_query_params_to(options, response_status = {})
|
||||||
|
redirect_to request.query_parameters.merge(options), response_status
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ module ModerateActions
|
|||||||
User.where(id: author_ids).accessible_by(current_ability, :block).each { |user| block_user user }
|
User.where(id: author_ids).accessible_by(current_ability, :block).each { |user| block_user user }
|
||||||
end
|
end
|
||||||
|
|
||||||
redirect_to request.query_parameters.merge(action: :index)
|
redirect_with_query_params_to(action: :index)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class Moderation::UsersController < Moderation::BaseController
|
|||||||
def hide_in_moderation_screen
|
def hide_in_moderation_screen
|
||||||
block_user
|
block_user
|
||||||
|
|
||||||
redirect_to request.query_parameters.merge(action: :index), notice: I18n.t("moderation.users.notice_hide")
|
redirect_with_query_params_to({ action: :index }, { notice: I18n.t("moderation.users.notice_hide") })
|
||||||
end
|
end
|
||||||
|
|
||||||
def hide
|
def hide
|
||||||
|
|||||||
Reference in New Issue
Block a user