Contact searching

This commit is contained in:
Andres Keskküla 2014-09-22 11:02:12 +03:00
parent 6f3d3c849a
commit f435b1bd19
4 changed files with 14 additions and 1 deletions

View file

@ -45,6 +45,9 @@ class Contact < ActiveRecord::Base
CONTACT_TYPE_ADMIN = 'admin'
CONTACT_TYPES = [CONTACT_TYPE_TECH, CONTACT_TYPE_ADMIN]
# TEMP Scope until confusion with contact name is sorted out
# scope :named, -> { joins(:international_address).uniq.all }
# TEMP METHOD for transaction to STI
def address
international_address
@ -86,7 +89,6 @@ class Contact < ActiveRecord::Base
end
# generate random id for contact
#
def generate_code
self.code = SecureRandom.hex(4)
end
@ -131,6 +133,9 @@ class Contact < ActiveRecord::Base
end
class << self
# non-EPP
# EPP
def extract_attributes(ph, type = :create)
contact_hash = {
phone: ph[:voice],

View file

@ -1,6 +1,7 @@
.row
.col-sm-6
%h2.text-center-xs= t('shared.contacts')
= render 'admin/contacts/partials/search'
.col-sm-6
%h2.text-right.text-center-xs
= link_to(t('shared.add'), new_admin_contact_path, class: 'btn btn-primary')

View file

@ -0,0 +1,6 @@
= search_form_for [:admin, @q] do |f|
= f.search_field :international_address_name_cont
= f.submit do
%span.glyphicon.glyphicon-search

View file

@ -265,3 +265,4 @@ en:
edit_contact: 'Edit contact'
failed_to_update_contact: 'Failed to update contact'
contact_updated: 'Contact updated'
search: 'Search'