Module: Interchange::ImportsHelper

Defined in:
app/helpers/interchange/imports_helper.rb

Instance Method Summary collapse

Instance Method Details

#import_submit_button_tagObject

Public: Creates a submit tag for the Import button, handling all styling.

Returns String contains HTML for a submit tag.



6
7
8
# File 'app/helpers/interchange/imports_helper.rb', line 6

def import_submit_button_tag
  submit_tag 'Import', name: nil, class: 'btn btn-primary'
end

#section_summary_title(number, singular_title) ⇒ Object

Public: Creates an HTML string you must raw escape, that formats the number and the title provided such that stacked section summary titles will have numbers and titles line up vertically, because we provide a fixed spacing for the number portion.

number          - The value to display as well as inform pluralization to use for the title
singular_title  - The singular variant of the title, which we may pluralize based on the number provided

Returns String contains HTML with styling that must be escaped, that provides effectively, two columns of text.



19
20
21
22
23
24
25
26
27
# File 'app/helpers/interchange/imports_helper.rb', line 19

def section_summary_title(number, singular_title)
  title =
      if number == 1
        singular_title
      else
        singular_title.pluralize
      end
  "<strong><span style='width:30px;float: left; text-align: right;'>#{number}&nbsp;&nbsp;</span>#{title}</strong>"
end