Add registrars index

This commit is contained in:
Martin Lensment 2014-09-22 20:19:35 +03:00
parent f860a8937f
commit 18c7c2f374
4 changed files with 35 additions and 1 deletions

View file

@ -2,4 +2,9 @@ class Admin::RegistrarsController < ApplicationController
def search def search
render json: Registrar.search_by_query(params[:q]) render json: Registrar.search_by_query(params[:q])
end end
def index
@q = Registrar.search(params[:q])
@registrars = @q.result.page(params[:page])
end
end end

View file

@ -0,0 +1,28 @@
.row
.col-sm-6
%h2.text-center-xs= t('shared.registrars')
.col-sm-6
%h2.text-right.text-center-xs
= link_to(t('shared.add'), '#', 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-5'}
= sort_link(@q, 'name')
%th{class: 'col-xs-5'}
= sort_link(@q, 'reg_no', t('shared.reg_no'))
%th{class: 'col-xs-2'}
= t('shared.action')
%tbody
- @registrars.each do |x|
%tr
%td= link_to(x, '#')
%td= x.reg_no
%td= link_to(t('shared.edit'), '#', class: 'btn btn-primary btn-xs')
.row
.col-md-12
= paginate @registrars

View file

@ -26,7 +26,7 @@
%li %li
= link_to t('shared.dashboard'), root_path = link_to t('shared.dashboard'), root_path
%li %li
= link_to t('shared.registrars'), root_path = link_to t('shared.registrars'), admin_registrars_path
%li %li
= link_to t('shared.domains'), admin_domains_path = link_to t('shared.domains'), admin_domains_path
%li %li

View file

@ -272,3 +272,4 @@ en:
failed_to_update_contact: 'Failed to update contact' failed_to_update_contact: 'Failed to update contact'
contact_updated: 'Contact updated' contact_updated: 'Contact updated'
search: 'Search' search: 'Search'
reg_no: 'Reg no.'