Contacts index view

This commit is contained in:
Martin Lensment 2014-09-18 17:15:54 +03:00
parent b4602e701c
commit 1777a0e572
4 changed files with 43 additions and 0 deletions

View file

@ -1,4 +1,10 @@
class Admin::ContactsController < ApplicationController
def index
@q = Contact.search(params[:q])
@contacts = @q.result.page(params[:page])
end
def search
render json: Contact.search_by_query(params[:q])
end

View file

@ -0,0 +1,34 @@
.row
.col-sm-6
%h2.text-center-xs= t('shared.contacts')
.col-sm-6
%h2.text-right.text-center-xs
= link_to(t('shared.add'), new_admin_contact_path, class: 'btn btn-primary')
%hr
.row
.col-md-12
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-2'}
= sort_link(@q, 'international_address_name', t('shared.name'))
%th{class: 'col-xs-2'}
= sort_link(@q, 'code', t('shared.code'))
%th{class: 'col-xs-2'}
= sort_link(@q, 'ident', t('shared.identity_code'))
%th{class: 'col-xs-1'}
= sort_link(@q, 'email', t('shared.email'))
%th{class: 'col-xs-1'}
= t('shared.action')
%tbody
- @contacts.each do |x|
%tr
%td= link_to(x, admin_contact_path(x))
%td= x.code
%td= x.ident
%td= x.email
%td= link_to(t('shared.edit'), edit_admin_contact_path(x), class: 'btn btn-primary btn-xs')
.row
.col-md-12
= paginate @contacts

View file

@ -29,6 +29,8 @@
= link_to t('shared.registrars'), root_path
%li
= link_to t('shared.domains'), admin_domains_path
%li
= link_to t('shared.contacts'), admin_contacts_path
%li.dropdown
%a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"}
= t('shared.settings')

View file

@ -243,3 +243,4 @@ en:
domain_status_prohibits_deleting: 'Domain status prohibits deleting'
domain_deleted: 'Domain deleted!'
failed_to_delete_domain: 'Failed to delete domain!'
email: 'Email'