Module: Logs::NavPaginationHelper

Defined in:
app/helpers/logs/nav_pagination_helper.rb

Instance Method Summary collapse

Instance Method Details

#first_rangeObject



17
18
19
# File 'app/helpers/logs/nav_pagination_helper.rb', line 17

def first_range
  0..9
end

#last_rangeObject



13
14
15
# File 'app/helpers/logs/nav_pagination_helper.rb', line 13

def last_range
  @pages - 9..@pages
end

#pages_rangeObject



3
4
5
6
7
8
9
10
11
# File 'app/helpers/logs/nav_pagination_helper.rb', line 3

def pages_range
  if first_range.include? @page
    @pages.times.map { |i| i + 1 }[first_range]
  elsif last_range.include? @page
    (@pages + 1).times.map { |i| i }[last_range]
  else
    (@pages).times.map { |i| i }[@page - 1..@page + 8]
  end
end