mirror of
https://github.com/internetee/registry.git
synced 2025-08-11 20:19:34 +02:00
fixed filter and serching bugs
This commit is contained in:
parent
af1d5b1736
commit
851656c02e
4 changed files with 8 additions and 22 deletions
|
@ -5,7 +5,8 @@ module Admin
|
||||||
def index
|
def index
|
||||||
params[:q] ||= {}
|
params[:q] ||= {}
|
||||||
|
|
||||||
@auctions = Auction.with_status(params[:statuses_contains])
|
@auctions = Auction.with_domain_name(params[:domain_matches])
|
||||||
|
.with_status(params[:statuses_contains])
|
||||||
.with_start_created_at_date(params[:created_at_start])
|
.with_start_created_at_date(params[:created_at_start])
|
||||||
.with_end_created_at_date(params[:created_at_end])
|
.with_end_created_at_date(params[:created_at_end])
|
||||||
|
|
||||||
|
@ -16,7 +17,7 @@ module Admin
|
||||||
@auctions = @q.result.page(params[:page])
|
@auctions = @q.result.page(params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
@auctions = @auctions.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
|
@auctions = @auctions.per(params[:results_per_page_auction]) if params[:results_per_page_auction].to_i.positive?
|
||||||
|
|
||||||
domains = ReservedDomain.all.order(:name)
|
domains = ReservedDomain.all.order(:name)
|
||||||
q = domains.ransack(PartialSearchFormatter.format(params[:q]))
|
q = domains.ransack(PartialSearchFormatter.format(params[:q]))
|
||||||
|
@ -57,14 +58,6 @@ module Admin
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_to_auction
|
|
||||||
auction = Auction.find(params[:id])
|
|
||||||
|
|
||||||
p ">>>>>.."
|
|
||||||
p auction
|
|
||||||
p ">>>>>>"
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def validate_table(table)
|
def validate_table(table)
|
||||||
|
|
|
@ -29,6 +29,10 @@ class Auction < ApplicationRecord
|
||||||
where("created_at <= ?", end_created_at) if end_created_at.present?
|
where("created_at <= ?", end_created_at) if end_created_at.present?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scope :with_domain_name, -> (domain_name) {
|
||||||
|
where('domain ilike ?', "%#{domain_name.strip}%") if domain_name.present?
|
||||||
|
}
|
||||||
|
|
||||||
def self.pending(domain_name)
|
def self.pending(domain_name)
|
||||||
find_by(domain: domain_name.to_s, status: PENDING_STATUSES)
|
find_by(domain: domain_name.to_s, status: PENDING_STATUSES)
|
||||||
end
|
end
|
||||||
|
|
|
@ -117,9 +117,6 @@
|
||||||
<th class="col-xs-1">
|
<th class="col-xs-1">
|
||||||
<%= sort_link(@q, 'type') %>
|
<%= sort_link(@q, 'type') %>
|
||||||
</th>
|
</th>
|
||||||
<th class="col-xs-3">
|
|
||||||
Action
|
|
||||||
</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
|
@ -131,12 +128,7 @@
|
||||||
<td><%= auction.created_at %></td>
|
<td><%= auction.created_at %></td>
|
||||||
<td><%= auction.registration_code %></td>
|
<td><%= auction.registration_code %></td>
|
||||||
<td><%= auction.registration_deadline %></td>
|
<td><%= auction.registration_deadline %></td>
|
||||||
<td><%= auction.platform %></td>
|
<td><%= auction.platform.nil? ? 'automatically' : auction.platform %></td>
|
||||||
<td>
|
|
||||||
<%= button_tag type: 'button', data: { confirm: "Are you sure?" }, class: 'btn btn-primary' do %>
|
|
||||||
<% link_to 'Send to auction', send_to_auction_admin_auction_path(auction), method: :post, style: "color: white;" %>
|
|
||||||
<% end %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -267,9 +267,6 @@ Rails.application.routes.draw do
|
||||||
resources :accounts
|
resources :accounts
|
||||||
resources :account_activities
|
resources :account_activities
|
||||||
resources :auctions, only: [ :index, :create ] do
|
resources :auctions, only: [ :index, :create ] do
|
||||||
member do
|
|
||||||
post 'send_to_auction', to: 'auctions#send_to_auction', as: :send_to_auction
|
|
||||||
end
|
|
||||||
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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue