Add Renew button to make renewal a separate action

This commit is contained in:
Alex Sherman 2020-12-15 13:36:17 +05:00
parent 3edf8a500a
commit a1b3398e0e
4 changed files with 14 additions and 10 deletions

View file

@ -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)

View file

@ -48,11 +48,10 @@
</div>
<% end %>
<div class="form-group">
<div class="col-md-4 col-md-offset-2 text-right">
<button class="btn btn-warning">
<%= t '.filter_btn' %>
</button>
</div>
<div class="form-group pull-left">
<%= 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 %>
</div>
<% end %>