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
|
||||
|
||||
if auction.save
|
||||
remove_from_reserved(auction)
|
||||
flash[:notice] = "Auction #{params[:domain]} created"
|
||||
reserved_domain = auction.domain if remove_from_reserved(auction)
|
||||
flash[:notice] = "Auction #{params[:domain]} created.
|
||||
#{reserved_domain.present? ? 'These domain will be removed from reserved list: ' + reserved_domain : ' '}"
|
||||
else
|
||||
flash[:alert] = 'Something goes wrong'
|
||||
end
|
||||
|
@ -62,6 +63,7 @@ module Admin
|
|||
table = CSV.parse(File.read(filename), headers: true)
|
||||
|
||||
failed_names = []
|
||||
reserved_domains = []
|
||||
|
||||
if validate_table(table)
|
||||
table.each do |row|
|
||||
|
@ -81,11 +83,17 @@ module Admin
|
|||
end
|
||||
|
||||
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
|
||||
|
||||
flash[:notice] = 'Domains added!'
|
||||
flash[:notice] = "Domains added! But these domains were ignored: #{failed_names.join(' ')}" if failed_names.present?
|
||||
message_template = "Domains added!
|
||||
#{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
|
||||
flash[:alert] = "Invalid CSV format. Should be column with 'name' where is the list of name of domains!"
|
||||
end
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
<%= sort_link(@q, 'registration_deadline') %>
|
||||
</th>
|
||||
<th class="col-xs-1">
|
||||
<%= sort_link(@q, 'type') %>
|
||||
<%= sort_link(@q, 'platform', 'Type') %>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue