Add execution hook to controller

This commit is contained in:
Alex Sherman 2020-12-10 14:43:15 +05:00
parent 40b22cd433
commit b0b5cea585
2 changed files with 8 additions and 1 deletions

View file

@ -11,8 +11,10 @@ class Registrar
def bulk_renew
authorize! :manage, :repp
@expire_date = params[:expire_date].to_date
# binding.pry
@domains = domains_by_date(@expire_date)
if domain_ids_for_bulk_renew.present?
flash[:notice] = t(:bulk_renew_enqueued)
end
render file: 'registrar/bulk_change/new', locals: { active_tab: :bulk_renew }
end
@ -33,5 +35,9 @@ class Registrar
def domains_by_date(date)
domains_scope.where('valid_to <= ?', date)
end
def domain_ids_for_bulk_renew
params.dig('domain_ids').reject{ |id| id.blank? }
end
end
end

View file

@ -662,3 +662,4 @@ en:
iban: IBAN
sign_in: "Sign in"
signed_in_successfully: "Signed in successfully"
bulk_renew_enqueued: "Bulk renew for domains was enqueued"