mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 13:44:47 +02:00
Add nonverified email color to registrar show
This commit is contained in:
parent
e95996fa12
commit
62acd8892a
7 changed files with 33 additions and 24 deletions
|
@ -14,11 +14,9 @@ module Admin
|
|||
end
|
||||
|
||||
contacts = Contact.includes(:registrar).joins(:registrar)
|
||||
.includes(:email_address_verification)
|
||||
.select('contacts.*, registrars.name')
|
||||
contacts = contacts.filter_by_states(params[:statuses_contains].join(',')) if params[:statuses_contains]
|
||||
contacts = contacts.where("ident_country_code is null or ident_country_code=''") if params[:only_no_country_code].eql?('1')
|
||||
contacts = contacts.email_not_verified if params[:email_not_verified].eql?('1')
|
||||
contacts = filter_by_flags(contacts)
|
||||
|
||||
normalize_search_parameters do
|
||||
@q = contacts.search(search_params)
|
||||
|
@ -28,6 +26,14 @@ module Admin
|
|||
@contacts = @contacts.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
|
||||
end
|
||||
|
||||
def filter_by_flags(contacts)
|
||||
if params[:only_no_country_code].eql?('1')
|
||||
contacts = contacts.where("ident_country_code is null or ident_country_code=''")
|
||||
end
|
||||
contacts = contacts.email_not_verified if params[:email_not_verified].eql?('1')
|
||||
contacts
|
||||
end
|
||||
|
||||
def search
|
||||
render json: Contact.search_by_query(params[:q])
|
||||
end
|
||||
|
|
|
@ -16,10 +16,6 @@ class Contact < ApplicationRecord
|
|||
has_many :legal_documents, as: :documentable
|
||||
has_many :registrant_domains, class_name: 'Domain', foreign_key: 'registrant_id'
|
||||
has_many :actions, dependent: :destroy
|
||||
belongs_to :email_address_verification, class_name: 'EmailAddressVerification',
|
||||
primary_key: 'email',
|
||||
foreign_key: 'email',
|
||||
optional: true
|
||||
|
||||
attr_accessor :legal_document_id
|
||||
alias_attribute :kind, :ident_type
|
||||
|
@ -28,8 +24,9 @@ class Contact < ApplicationRecord
|
|||
accepts_nested_attributes_for :legal_documents
|
||||
|
||||
scope :email_not_verified, lambda {
|
||||
joins(:email_address_verification)
|
||||
.where('verified_at IS NULL OR verified_at <= ?', EmailAddressVerification.verification_period)
|
||||
joins('LEFT JOIN :email_address_verifications emv ON contacts.email = emv.email')
|
||||
.where('verified_at IS NULL OR verified_at <= ?',
|
||||
EmailAddressVerification.verification_period)
|
||||
}
|
||||
|
||||
validates :name, :email, presence: true
|
||||
|
|
|
@ -13,14 +13,16 @@ class Registrar < ApplicationRecord
|
|||
has_many :nameservers, through: :domains
|
||||
has_many :whois_records
|
||||
has_many :white_ips, dependent: :destroy
|
||||
belongs_to :email_address_verification, class_name: 'EmailAddressVerification',
|
||||
primary_key: 'email',
|
||||
foreign_key: 'email',
|
||||
optional: true
|
||||
belongs_to :billing_email_address_verification, class_name: 'EmailAddressVerification',
|
||||
primary_key: 'email',
|
||||
foreign_key: 'billing_email',
|
||||
optional: true
|
||||
# belongs_to :email_address_verification, class_name: 'EmailAddressVerification',
|
||||
# primary_key: 'email',
|
||||
# foreign_key: 'email',
|
||||
# optional: true,
|
||||
# inverse_of: :registrar
|
||||
# belongs_to :billing_email_address_verification, class_name: 'EmailAddressVerification',
|
||||
# primary_key: 'email',
|
||||
# foreign_key: 'billing_email',
|
||||
# optional: true,
|
||||
# inverse_of: :billing_registrar
|
||||
|
||||
delegate :balance, to: :cash_account, allow_nil: true
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
%dd= ident_for(@contact)
|
||||
|
||||
%dt= t(:email)
|
||||
%dd{class: ('text-danger' unless @contact.email_verification.success)}
|
||||
%dd{class: ('text-danger' unless @contact.email_verification&.success)}
|
||||
= @contact.email
|
||||
|
||||
%dt= t(:phone)
|
||||
|
|
|
@ -49,11 +49,11 @@
|
|||
<%= "#{x.test_registrar}" %>
|
||||
</td>
|
||||
<td>
|
||||
<span class=<%= 'text-danger' unless x.email_address_verification.success %>>
|
||||
<span class=<%= 'text-danger' unless x.email_verification&.success %>>
|
||||
<%= "#{x.email}" %>
|
||||
</span>
|
||||
<% if x[:billing_email].present? %>
|
||||
<span class=<%= 'text-danger' unless x.billing_email_address_verification.success %>>
|
||||
<span class=<%= 'text-danger' unless x.billing_email_verification&.success %>>
|
||||
<%= "#{x[:billing_email]}" %>
|
||||
</span>
|
||||
<% end %>
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
<dd><%= registrar.accounting_customer_code %></dd>
|
||||
|
||||
<dt><%= Registrar.human_attribute_name :billing_email %></dt>
|
||||
<dd><%= registrar.billing_email %></dd>
|
||||
<dd class=<%= 'text-danger' unless @registrar.billing_email_verification&.success%>>
|
||||
<%= registrar.billing_email %>
|
||||
</dd>
|
||||
|
||||
<dt><%= Registrar.human_attribute_name :reference_no %></dt>
|
||||
<dd><%= registrar.reference_no %></dd>
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
<dd><%= @registrar.phone %></dd>
|
||||
|
||||
<dt><%= Registrar.human_attribute_name :email %></dt>
|
||||
<dd><%= @registrar.email %></dd>
|
||||
<dd class=<%= 'text-danger' unless @registrar.email_verification&.success %>>
|
||||
<%= @registrar.email %>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue