Pagination for domains

This commit is contained in:
Martin Lensment 2014-09-05 12:50:46 +03:00
parent 8531e50474
commit 11319b6f36
6 changed files with 29 additions and 2 deletions

View file

@ -42,8 +42,12 @@ gem 'isikukood'
gem 'bootstrap-sass', '~> 3.2.0.1' gem 'bootstrap-sass', '~> 3.2.0.1'
# for visual loader
gem 'nprogress-rails', '~> 0.1.3.1' gem 'nprogress-rails', '~> 0.1.3.1'
# for pagination
gem 'kaminari', '~> 0.16.1'
group :assets do group :assets do
# See https://github.com/sstephenson/execjs#readme for more supported runtimes # See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby gem 'therubyracer', platforms: :ruby

View file

@ -96,6 +96,9 @@ GEM
railties (>= 3.0, < 5.0) railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0) thor (>= 0.14, < 2.0)
json (1.8.1) json (1.8.1)
kaminari (0.16.1)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
kgio (2.9.2) kgio (2.9.2)
libv8 (3.16.14.3) libv8 (3.16.14.3)
libxml-ruby (2.7.0) libxml-ruby (2.7.0)
@ -254,6 +257,7 @@ DEPENDENCIES
isikukood isikukood
jbuilder (~> 2.0) jbuilder (~> 2.0)
jquery-rails jquery-rails
kaminari (~> 0.16.1)
nokogiri (~> 1.6.2.1) nokogiri (~> 1.6.2.1)
nprogress-rails (~> 0.1.3.1) nprogress-rails (~> 0.1.3.1)
pg pg

View file

@ -1,5 +1,5 @@
class Admin::DomainsController < ApplicationController class Admin::DomainsController < ApplicationController
def index def index
@domains = Domain.all @domains = Domain.order(:name).page(params[:page])
end end
end end

View file

@ -3,7 +3,6 @@ class Domain < ActiveRecord::Base
# TODO most inputs should be trimmed before validatation, probably some global logic? # TODO most inputs should be trimmed before validatation, probably some global logic?
include EppErrors include EppErrors
EPP_ATTR_MAP = { EPP_ATTR_MAP = {
owner_contact: 'registrant', owner_contact: 'registrant',
name_dirty: 'name', name_dirty: 'name',

View file

@ -22,3 +22,6 @@
%td= link_to(x.owner_contact, root_path) %td= link_to(x.owner_contact, root_path)
%td= l(x.valid_to, format: :short) %td= l(x.valid_to, format: :short)
%td= link_to(t('shared.edit'), edit_admin_domain_path(x), class: 'btn btn-primary btn-xs') %td= link_to(t('shared.edit'), edit_admin_domain_path(x), class: 'btn btn-primary btn-xs')
.row
.col-md-12
= paginate @domains

View file

@ -20,6 +20,23 @@
# available at http://guides.rubyonrails.org/i18n.html. # available at http://guides.rubyonrails.org/i18n.html.
en: en:
views:
pagination:
first: "&laquo; First"
last: "Last &raquo;"
previous: "&lsaquo; Prev"
next: "Next &rsaquo;"
truncate: "&hellip;"
helpers:
page_entries_info:
one_page:
display_entries:
zero: "No %{entry_name} found"
one: "Displaying <b>1</b> %{entry_name}"
other: "Displaying <b>all %{count}</b> %{entry_name}"
more_pages:
display_entries: "Displaying %{entry_name} <b>%{first}&nbsp;-&nbsp;%{last}</b> of <b>%{total}</b> in total"
time: time:
formats: formats:
default: "%d. %B %Y, %H:%M" default: "%d. %B %Y, %H:%M"