Module: NetherHelper

Defined in:
app/helpers/nether_helper.rb

Instance Method Summary collapse

Instance Method Details

#nether(total_pages, url = nil, identifier = nil, container = nil) ⇒ Object

Replaces manual pagination links with endless page.

Signatures

nether(total_pages, url, identifier)

nether(total_pages, url, identifier, container)


10
11
12
13
14
15
16
17
18
19
20
# File 'app/helpers/nether_helper.rb', line 10

def nether(total_pages, url=nil, identifier=nil, container=nil)
  opts = {
    :totalPages => total_pages,
    :url        => escape_javascript(url),
    :loaderMsg  => 'Loading more results'
  }

  container && opts[:container] ||= container

  javascript_tag("$('#{identifier}').pageless(#{opts.to_json});")
end

#nether_sticky_content(content_options = {}, &block) ⇒ Object

Creates a content area that can be paired with nether_sticky_footer

Signatures

nether_sticky_content() do
  # ...
end

nether_sticky_content(content_options = {}) do
  # ...
end


56
57
58
59
60
61
62
63
64
65
66
# File 'app/helpers/nether_helper.rb', line 56

def nether_sticky_content(content_options={}, &block)
  if block_given?
    
    content_options[:class] ||= "nether_content"
     = tag_options(content_options)

    "<div#{}>#{capture(&block)}</div>".html_safe
  else
    raise ArgumentError, "Missing block"
  end
end

Creates a sticky footer that is paired with nether_sticky_body

Signatures

nether_sticky_footer() do
  # ...
end

nether_sticky_footer(footer_options = {}) do
  # ...
end


79
80
81
82
83
84
85
86
87
88
89
# File 'app/helpers/nether_helper.rb', line 79

def nether_sticky_footer(footer_options={}, &block)
  if block_given?
    footer_options[:class] ||= "nether_footer"

    footer_tag_options = tag_options(footer_options)

    "<div#{footer_tag_options}>#{capture(&block)}</div>".html_safe
  else
    raise ArgumentError, "Missing block"
  end
end

#nether_sticky_wrap(wrap_options = {}, content_options = {}, &block) ⇒ Object

Creates a wrapper that sticks nether sticky content in place.

Signatures

nether_sticky_wrap() do
  # ...
end

nether_sticky_wrap(wrap_options = {}) do
  # ...
end


33
34
35
36
37
38
39
40
41
42
43
# File 'app/helpers/nether_helper.rb', line 33

def nether_sticky_wrap(wrap_options={}, content_options={}, &block)
  if block_given?
    
    wrap_options[:class] ||= "nether_wrap"
    wrap_tag_options = tag_options(wrap_options)

    "<div#{wrap_tag_options}>#{capture(&block)}</div>".html_safe
  else
    raise ArgumentError, "Missing block"
  end
end