Module: ImportsHelper

Defined in:
app/helpers/imports_helper.rb

Instance Method Summary collapse

Instance Method Details

#describe_import_status(import) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
# File 'app/helpers/imports_helper.rb', line 26

def describe_import_status(import)
  descriptions = {
    "caching" => "Your file is being processed.",
    "pending" => "This import is pending your approval.",
    "approved" => "You have approved this import and it will be procesed soon.",
    "importing" => "Artful.ly is currently importing this file.",
    "imported" => "This import is complete.",
    "failed" => "This import has failed."
  }
  descriptions[import.status]
end

#import_page_controller(import, offset, length) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/helpers/imports_helper.rb', line 3

def import_page_controller import, offset, length
  if offset > 0
    left_path = import_path import, :offset => [ 0, offset - length ].max, :length => length
    left_classes = "previous btn"
  else
    left_path = "#"
    left_classes = "previous btn disabled"
  end

  if offset + length < import.rows.count
    right_path = import_path import, :offset => offset + length, :length => length
    right_classes = "next btn pull-right"
  else
    right_path = "#"
    right_classes = "next btn pull-right disabled"
  end

  left = link_to "Previous Page", left_path, :class => left_classes
  right = link_to "Next Page", right_path, :class => right_classes

  left + right
end