Module: NdrError::ApplicationHelper

Defined in:
app/helpers/ndr_error/application_helper.rb

Overview

Application-wide helpers. TODO: await ndr_ui gem!

Instance Method Summary collapse

Instance Method Details

#glyphicon_tag(type) ⇒ Object

Bootstrap icon tag.



6
7
8
# File 'app/helpers/ndr_error/application_helper.rb', line 6

def glyphicon_tag(type)
  (:span, '', class: "glyphicon glyphicon-#{type}")
end

#pagination_summary_for(collection) ⇒ Object

Pagination helper for will_paginate:



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/helpers/ndr_error/application_helper.rb', line 11

def pagination_summary_for(collection)
  page    = collection.current_page
  showing = collection.per_page
  total   = collection.total_entries

  from = (page - 1) * showing + 1
  to   = from + collection.length - 1

  from = [from, total].min
  to   = [to, total].min

  format('Showing %d - %d of %d', from, to, total)
end