Module: BatchLoad::BatchLoadHelper

Defined in:
app/helpers/batch_load/batch_load_helper.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) batch_all_objects_count_td(rp)



52
53
54
# File 'app/helpers/batch_load/batch_load_helper.rb', line 52

def batch_all_objects_count_td(rp)
  (:td, rp.total_objects)
end

- (Object) batch_data_created_td(rp)



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/helpers/batch_load/batch_load_helper.rb', line 12

def batch_data_created_td(rp)
   :td do
     :table do
      rp.objects.collect { |klass, objs|
        (:tr, (:td, klass), class: 'underlined_elements') +
          objs.collect { |o| (:tr,
                                         (:td,
                                                     o.persisted? ? object_link(o) : (:span, object_tag(o), class: 'warning')
                                         )
          )
          }.join.html_safe
      }.join.html_safe
    end
  end
end

- (Object) batch_data_errors_td(rp)



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/helpers/batch_load/batch_load_helper.rb', line 28

def batch_data_errors_td(rp)
  (:td) do
    (:table, border: true) do
      rp.objects.collect { |klass, objs|
        (:tr, (:td, "-") +
                         objs.collect { |o|
                           (:tr,
                                       (:td, (o.valid? ? (:span, 'None.', class: 'subtle') : "#{o.errors.full_messages.join('; ')}"))
                           )
                         }.join.html_safe
        )
      }.join.html_safe
    end
  end
end


56
57
58
# File 'app/helpers/batch_load/batch_load_helper.rb', line 56

def batch_line_link_td(line)
  (:td, link_to(line, "#line_#{line}", id: "parse_#{line}").html_safe)
end

- (Object) batch_parse_errors_td(rp)



44
45
46
# File 'app/helpers/batch_load/batch_load_helper.rb', line 44

def batch_parse_errors_td(rp)
  (:td, rp.parse_errors.join('; ').html_safe)
end

- (Object) batch_valid_objects_td(rp)



48
49
50
# File 'app/helpers/batch_load/batch_load_helper.rb', line 48

def batch_valid_objects_td(rp)
  (:td, rp.has_valid_objects? ? rp.valid_objects.length : 0)
end

- (Object) warn_level_input(result)



3
4
5
6
7
8
9
10
# File 'app/helpers/batch_load/batch_load_helper.rb', line 3

def warn_level_input(result)
  str     = "Import level:<br>&nbsp;"
  options = [radio_button_tag(:import_level, :warn, selected: true) + ' warn']
  options << radio_button_tag(:import_level, :line_strict) + ' line strict' if result.line_strict_level_ok?
  options << radio_button_tag(:import_level, :strict) + ' strict' if result.strict_level_ok?
  str += options.join('<br>&nbsp;').html_safe
  (:div, str.html_safe)
end