mirror of
https://github.com/internetee/registry.git
synced 2025-07-29 05:56:20 +02:00
fixed sorting and message
This commit is contained in:
parent
120a221896
commit
a52119daf0
2 changed files with 14 additions and 6 deletions
|
@ -43,8 +43,9 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
if auction.save
|
if auction.save
|
||||||
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 : ' '}"
|
||||||
else
|
else
|
||||||
flash[:alert] = 'Something goes wrong'
|
flash[:alert] = 'Something goes wrong'
|
||||||
end
|
end
|
||||||
|
@ -62,6 +63,7 @@ module Admin
|
||||||
table = CSV.parse(File.read(filename), headers: true)
|
table = CSV.parse(File.read(filename), headers: true)
|
||||||
|
|
||||||
failed_names = []
|
failed_names = []
|
||||||
|
reserved_domains = []
|
||||||
|
|
||||||
if validate_table(table)
|
if validate_table(table)
|
||||||
table.each do |row|
|
table.each do |row|
|
||||||
|
@ -81,11 +83,17 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
auction = Auction.new(domain: record['name'], status: Auction.statuses[:started], platform: 'manual')
|
auction = Auction.new(domain: record['name'], status: Auction.statuses[:started], platform: 'manual')
|
||||||
remove_from_reserved(auction) if auction.save!
|
flag = remove_from_reserved(auction) if auction.save!
|
||||||
|
reserved_domains << auction.domain if flag
|
||||||
end
|
end
|
||||||
|
|
||||||
flash[:notice] = 'Domains added!'
|
message_template = "Domains added!
|
||||||
flash[:notice] = "Domains added! But these domains were ignored: #{failed_names.join(' ')}" if failed_names.present?
|
#{reserved_domains.present? ?
|
||||||
|
'These domains will be removed from reserved list: ' + reserved_domains.join(' ') + '! '
|
||||||
|
: '! '}
|
||||||
|
#{failed_names.present? ? 'These domains were ignored: ' + failed_names.join(' ') : '!'}"
|
||||||
|
|
||||||
|
flash[:notice] = message_template
|
||||||
else
|
else
|
||||||
flash[:alert] = "Invalid CSV format. Should be column with 'name' where is the list of name of domains!"
|
flash[:alert] = "Invalid CSV format. Should be column with 'name' where is the list of name of domains!"
|
||||||
end
|
end
|
||||||
|
|
|
@ -115,7 +115,7 @@
|
||||||
<%= sort_link(@q, 'registration_deadline') %>
|
<%= sort_link(@q, 'registration_deadline') %>
|
||||||
</th>
|
</th>
|
||||||
<th class="col-xs-1">
|
<th class="col-xs-1">
|
||||||
<%= sort_link(@q, 'type') %>
|
<%= sort_link(@q, 'platform', 'Type') %>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue