Sha256: eb53dde5421d5df22a24a20a57c8b37327aa1559961264330e5f8bddc10d3a2b

Contents?: true

Size: 650 Bytes

Versions: 15

Compression:

Stored size: 650 Bytes

Contents

module NdrError
  # Application-wide helpers.
  # TODO: await ndr_ui gem!
  module ApplicationHelper
    # Bootstrap icon tag.
    def glyphicon_tag(type)
      content_tag(:span, '', class: "glyphicon glyphicon-#{type}")
    end

    # Pagination helper for will_paginate:
    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
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ndr_error-2.3.2 app/helpers/ndr_error/application_helper.rb
ndr_error-2.3.1 app/helpers/ndr_error/application_helper.rb
ndr_error-2.3.0 app/helpers/ndr_error/application_helper.rb
ndr_error-2.2.0 app/helpers/ndr_error/application_helper.rb
ndr_error-2.1.0 app/helpers/ndr_error/application_helper.rb
ndr_error-2.0.3 app/helpers/ndr_error/application_helper.rb
ndr_error-2.0.2 app/helpers/ndr_error/application_helper.rb
ndr_error-2.0.1 app/helpers/ndr_error/application_helper.rb
ndr_error-2.0.0 app/helpers/ndr_error/application_helper.rb
ndr_error-1.1.4 app/helpers/ndr_error/application_helper.rb
ndr_error-1.1.3 app/helpers/ndr_error/application_helper.rb
ndr_error-1.1.2 app/helpers/ndr_error/application_helper.rb
ndr_error-1.1.1 app/helpers/ndr_error/application_helper.rb
ndr_error-1.0.1 app/helpers/ndr_error/application_helper.rb
ndr_error-1.0.0 app/helpers/ndr_error/application_helper.rb