mirror of
https://github.com/internetee/registry.git
synced 2025-07-29 22:16:19 +02:00
add option to delete auction record
This commit is contained in:
parent
487cbb1774
commit
75df2212da
5 changed files with 30 additions and 3 deletions
|
@ -44,7 +44,7 @@ module Admin
|
||||||
|
|
||||||
if auction.save
|
if auction.save
|
||||||
reserved_domain = auction.domain if remove_from_reserved(auction)
|
reserved_domain = auction.domain if remove_from_reserved(auction)
|
||||||
flash[:notice] = "Auction #{params[:domain]} created.
|
flash[:notice] = "Auction #{params[:domain]} created.
|
||||||
#{reserved_domain.present? ? 'These domain will be removed from reserved list: ' + reserved_domain : ' '}"
|
#{reserved_domain.present? ? 'These domain will be removed from reserved list: ' + reserved_domain : ' '}"
|
||||||
else
|
else
|
||||||
flash[:alert] = 'Something goes wrong'
|
flash[:alert] = 'Something goes wrong'
|
||||||
|
@ -53,6 +53,18 @@ module Admin
|
||||||
redirect_to admin_auctions_path
|
redirect_to admin_auctions_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
auction = Auction.find(params[:id])
|
||||||
|
|
||||||
|
if auction.destroy
|
||||||
|
flash[:notice] = I18n.t('record_deleted')
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t('failed_to_delete_record')
|
||||||
|
end
|
||||||
|
|
||||||
|
redirect_to admin_auctions_path
|
||||||
|
end
|
||||||
|
|
||||||
def upload_spreadsheet
|
def upload_spreadsheet
|
||||||
if params[:q].nil?
|
if params[:q].nil?
|
||||||
flash[:alert] = 'No file upload! Look at the left of upload button!'
|
flash[:alert] = 'No file upload! Look at the left of upload button!'
|
||||||
|
|
|
@ -129,6 +129,7 @@
|
||||||
<td style="width: 100px !important; word-break: break-all;"><%= auction.registration_code %></td>
|
<td style="width: 100px !important; word-break: break-all;"><%= auction.registration_code %></td>
|
||||||
<td><%= auction.registration_deadline %></td>
|
<td><%= auction.registration_deadline %></td>
|
||||||
<td><%= auction.platform.nil? ? 'auto' : auction.platform %></td>
|
<td><%= auction.platform.nil? ? 'auto' : auction.platform %></td>
|
||||||
|
<td><%= link_to(t(:delete), admin_auction_path(auction), method: :delete, data: { confirm: t(:are_you_sure_you_want_to_delete_auction) }, class: 'btn btn-danger') %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -152,4 +153,4 @@
|
||||||
$('#user-form-edit').on("show.bs.modal", function(e) {
|
$('#user-form-edit').on("show.bs.modal", function(e) {
|
||||||
$(this).find('.modal-body').load(e.relatedTarget.dataset.url);
|
$(this).find('.modal-body').load(e.relatedTarget.dataset.url);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -440,6 +440,7 @@ en:
|
||||||
exDate: 'Valid to'
|
exDate: 'Valid to'
|
||||||
dequeue: 'Dequeue'
|
dequeue: 'Dequeue'
|
||||||
are_you_sure_you_want_to_delete_domain: 'Are you sure you want to delete domain %{domain}?'
|
are_you_sure_you_want_to_delete_domain: 'Are you sure you want to delete domain %{domain}?'
|
||||||
|
are_you_sure_you_want_to_delete_auction: 'Warning: Are you sure you want to delete this record? Be advised that doing so will remove the record only from registry database and will make the domain available for anyone to register. This will not affect auction system if the auction record is already created there. You will need to delete the record in auction system first to remove the domain from auction.?'
|
||||||
upload_key: 'Upload key'
|
upload_key: 'Upload key'
|
||||||
legal_document: 'Legal document'
|
legal_document: 'Legal document'
|
||||||
legal_document_max_size: '(max. 8MB)'
|
legal_document_max_size: '(max. 8MB)'
|
||||||
|
|
|
@ -303,7 +303,7 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
resources :accounts
|
resources :accounts
|
||||||
resources :account_activities
|
resources :account_activities
|
||||||
resources :auctions, only: [ :index, :create ] do
|
resources :auctions, only: %i[index create destroy] do
|
||||||
collection do
|
collection do
|
||||||
post 'upload_spreadsheet', to: 'auctions#upload_spreadsheet', as: :upload_spreadsheet
|
post 'upload_spreadsheet', to: 'auctions#upload_spreadsheet', as: :upload_spreadsheet
|
||||||
end
|
end
|
||||||
|
|
|
@ -170,4 +170,17 @@ class AdminAreaAuctionIntegrationTest < ApplicationSystemTestCase
|
||||||
find(:id, "reserved-modal", match: :first).click
|
find(:id, "reserved-modal", match: :first).click
|
||||||
assert_text 'Reserved domains'
|
assert_text 'Reserved domains'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_delete_auction
|
||||||
|
visit admin_auctions_path
|
||||||
|
domain = reserved_domains(:one)
|
||||||
|
|
||||||
|
fill_in 'domain', with: domain.name
|
||||||
|
find(:id, 'new-auction-btn', match: :first).click
|
||||||
|
click_link_or_button 'Delete'
|
||||||
|
|
||||||
|
assert_raises ActiveRecord::RecordNotFound do
|
||||||
|
domain.reload
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue