diff --git a/app/controllers/registrar/bulk_change_controller.rb b/app/controllers/registrar/bulk_change_controller.rb index a87589890..1dc5282a7 100644 --- a/app/controllers/registrar/bulk_change_controller.rb +++ b/app/controllers/registrar/bulk_change_controller.rb @@ -12,16 +12,22 @@ class Registrar authorize! :manage, :repp set_form_data - if domain_ids_for_bulk_renew.present? + if ready_to_renew? domains = Epp::Domain.where(id: domain_ids_for_bulk_renew).to_a task = renew_task(domains) flash[:notice] = flash_message(task) + else + flash[:notice] = nil end render file: 'registrar/bulk_change/new', locals: { active_tab: :bulk_renew } end private + def ready_to_renew? + domain_ids_for_bulk_renew.present? && params[:renew].present? + end + def set_form_data @expire_date = params[:expire_date].to_date @domains = domains_by_date(@expire_date) diff --git a/app/views/registrar/bulk_change/_bulk_renew_form.html.erb b/app/views/registrar/bulk_change/_bulk_renew_form.html.erb index 162376070..239a36815 100644 --- a/app/views/registrar/bulk_change/_bulk_renew_form.html.erb +++ b/app/views/registrar/bulk_change/_bulk_renew_form.html.erb @@ -48,11 +48,10 @@ <% end %> -
-
- -
+
+ <%= f.submit "#{t '.filter_btn'}", name: 'filter', class: 'btn btn-warning' %> + <% if @domains.present? %> + <%= f.submit "#{t '.renew_btn'}", name: 'renew', class: 'btn btn-primary' %> + <% end %>
<% end %> diff --git a/config/locales/registrar/bulk_change.en.yml b/config/locales/registrar/bulk_change.en.yml index 5043a3f94..75becfada 100644 --- a/config/locales/registrar/bulk_change.en.yml +++ b/config/locales/registrar/bulk_change.en.yml @@ -33,6 +33,7 @@ en: bulk_renew_form: filter_btn: Filter + renew_btn: Renew expire_date: Expire date until domain_ids: Domains for bulk renewal current_balance: Current balance diff --git a/test/system/registrar_area/bulk_change/bulk_renew_test.rb b/test/system/registrar_area/bulk_change/bulk_renew_test.rb index c99750e6c..bcb6c3d66 100644 --- a/test/system/registrar_area/bulk_change/bulk_renew_test.rb +++ b/test/system/registrar_area/bulk_change/bulk_renew_test.rb @@ -30,11 +30,9 @@ class BulkRenewTest < ApplicationSystemTestCase visit new_registrar_bulk_change_url click_link('Bulk renew') - select '1 year', from: 'Period' click_button 'Filter' - - click_button 'Filter' + click_button 'Renew' assert_text 'invalid.test' assert_no_text 'shop.test'