Class: IssuesHelper::IssueFieldsRows

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::TagHelper
Defined in:
app/helpers/issues_helper.rb

Instance Method Summary collapse

Constructor Details

#initializeIssueFieldsRows

Returns a new instance of IssueFieldsRows.



328
329
330
331
# File 'app/helpers/issues_helper.rb', line 328

def initialize
  @left = []
  @right = []
end

Instance Method Details

#cells(label, text, options = {}) ⇒ Object



355
356
357
358
359
360
361
362
# File 'app/helpers/issues_helper.rb', line 355

def cells(label, text, options={})
  options[:class] = [options[:class] || "", 'attribute'].join(' ')
  (
    'div',
    ('div', label + ":", :class => 'label') +
      ('div', text, :class => 'value'),
    options)
end

#left(*args) ⇒ Object



333
334
335
# File 'app/helpers/issues_helper.rb', line 333

def left(*args)
  args.any? ? @left << cells(*args) : @left
end

#right(*args) ⇒ Object



337
338
339
# File 'app/helpers/issues_helper.rb', line 337

def right(*args)
  args.any? ? @right << cells(*args) : @right
end

#sizeObject



341
342
343
# File 'app/helpers/issues_helper.rb', line 341

def size
  [@left.size, @right.size].max
end

#to_htmlObject



345
346
347
348
349
350
351
352
353
# File 'app/helpers/issues_helper.rb', line 345

def to_html
  # rubocop:disable Performance/Sum
  content =
    ('div', @left.reduce(&:+), :class => 'splitcontentleft') +
    ('div', @right.reduce(&:+), :class => 'splitcontentleft')
  # rubocop:enable Performance/Sum

  ('div', content, :class => 'splitcontent')
end