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
|
end
|
||||||
|
|
||||||
contacts = Contact.includes(:registrar).joins(:registrar)
|
contacts = Contact.includes(:registrar).joins(:registrar)
|
||||||
.includes(:email_address_verification)
|
|
||||||
.select('contacts.*, registrars.name')
|
.select('contacts.*, registrars.name')
|
||||||
contacts = contacts.filter_by_states(params[:statuses_contains].join(',')) if params[:statuses_contains]
|
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 = filter_by_flags(contacts)
|
||||||
contacts = contacts.email_not_verified if params[:email_not_verified].eql?('1')
|
|
||||||
|
|
||||||
normalize_search_parameters do
|
normalize_search_parameters do
|
||||||
@q = contacts.search(search_params)
|
@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?
|
@contacts = @contacts.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
|
||||||
end
|
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
|
def search
|
||||||
render json: Contact.search_by_query(params[:q])
|
render json: Contact.search_by_query(params[:q])
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,10 +16,6 @@ class Contact < ApplicationRecord
|
||||||
has_many :legal_documents, as: :documentable
|
has_many :legal_documents, as: :documentable
|
||||||
has_many :registrant_domains, class_name: 'Domain', foreign_key: 'registrant_id'
|
has_many :registrant_domains, class_name: 'Domain', foreign_key: 'registrant_id'
|
||||||
has_many :actions, dependent: :destroy
|
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
|
attr_accessor :legal_document_id
|
||||||
alias_attribute :kind, :ident_type
|
alias_attribute :kind, :ident_type
|
||||||
|
@ -28,8 +24,9 @@ class Contact < ApplicationRecord
|
||||||
accepts_nested_attributes_for :legal_documents
|
accepts_nested_attributes_for :legal_documents
|
||||||
|
|
||||||
scope :email_not_verified, lambda {
|
scope :email_not_verified, lambda {
|
||||||
joins(:email_address_verification)
|
joins('LEFT JOIN :email_address_verifications emv ON contacts.email = emv.email')
|
||||||
.where('verified_at IS NULL OR verified_at <= ?', EmailAddressVerification.verification_period)
|
.where('verified_at IS NULL OR verified_at <= ?',
|
||||||
|
EmailAddressVerification.verification_period)
|
||||||
}
|
}
|
||||||
|
|
||||||
validates :name, :email, presence: true
|
validates :name, :email, presence: true
|
||||||
|
|
|
@ -13,14 +13,16 @@ class Registrar < ApplicationRecord
|
||||||
has_many :nameservers, through: :domains
|
has_many :nameservers, through: :domains
|
||||||
has_many :whois_records
|
has_many :whois_records
|
||||||
has_many :white_ips, dependent: :destroy
|
has_many :white_ips, dependent: :destroy
|
||||||
belongs_to :email_address_verification, class_name: 'EmailAddressVerification',
|
# belongs_to :email_address_verification, class_name: 'EmailAddressVerification',
|
||||||
primary_key: 'email',
|
# primary_key: 'email',
|
||||||
foreign_key: 'email',
|
# foreign_key: 'email',
|
||||||
optional: true
|
# optional: true,
|
||||||
belongs_to :billing_email_address_verification, class_name: 'EmailAddressVerification',
|
# inverse_of: :registrar
|
||||||
primary_key: 'email',
|
# belongs_to :billing_email_address_verification, class_name: 'EmailAddressVerification',
|
||||||
foreign_key: 'billing_email',
|
# primary_key: 'email',
|
||||||
optional: true
|
# foreign_key: 'billing_email',
|
||||||
|
# optional: true,
|
||||||
|
# inverse_of: :billing_registrar
|
||||||
|
|
||||||
delegate :balance, to: :cash_account, allow_nil: true
|
delegate :balance, to: :cash_account, allow_nil: true
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
%dd= ident_for(@contact)
|
%dd= ident_for(@contact)
|
||||||
|
|
||||||
%dt= t(:email)
|
%dt= t(:email)
|
||||||
%dd{class: ('text-danger' unless @contact.email_verification.success)}
|
%dd{class: ('text-danger' unless @contact.email_verification&.success)}
|
||||||
= @contact.email
|
= @contact.email
|
||||||
|
|
||||||
%dt= t(:phone)
|
%dt= t(:phone)
|
||||||
|
|
|
@ -49,11 +49,11 @@
|
||||||
<%= "#{x.test_registrar}" %>
|
<%= "#{x.test_registrar}" %>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class=<%= 'text-danger' unless x.email_address_verification.success %>>
|
<span class=<%= 'text-danger' unless x.email_verification&.success %>>
|
||||||
<%= "#{x.email}" %>
|
<%= "#{x.email}" %>
|
||||||
</span>
|
</span>
|
||||||
<% if x[:billing_email].present? %>
|
<% 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]}" %>
|
<%= "#{x[:billing_email]}" %>
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -15,7 +15,9 @@
|
||||||
<dd><%= registrar.accounting_customer_code %></dd>
|
<dd><%= registrar.accounting_customer_code %></dd>
|
||||||
|
|
||||||
<dt><%= Registrar.human_attribute_name :billing_email %></dt>
|
<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>
|
<dt><%= Registrar.human_attribute_name :reference_no %></dt>
|
||||||
<dd><%= registrar.reference_no %></dd>
|
<dd><%= registrar.reference_no %></dd>
|
||||||
|
@ -24,4 +26,4 @@
|
||||||
<dd><%= registrar.iban %></dd>
|
<dd><%= registrar.iban %></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -15,7 +15,9 @@
|
||||||
<dd><%= @registrar.phone %></dd>
|
<dd><%= @registrar.phone %></dd>
|
||||||
|
|
||||||
<dt><%= Registrar.human_attribute_name :email %></dt>
|
<dt><%= Registrar.human_attribute_name :email %></dt>
|
||||||
<dd><%= @registrar.email %></dd>
|
<dd class=<%= 'text-danger' unless @registrar.email_verification&.success %>>
|
||||||
|
<%= @registrar.email %>
|
||||||
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue