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.


315
316
317
318
# File 'app/helpers/issues_helper.rb', line 315

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

Instance Method Details

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


340
341
342
343
344
345
346
347
# File 'app/helpers/issues_helper.rb', line 340

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


320
321
322
# File 'app/helpers/issues_helper.rb', line 320

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

#right(*args) ⇒ Object


324
325
326
# File 'app/helpers/issues_helper.rb', line 324

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

#sizeObject


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

def size
  @left.size > @right.size ? @left.size : @right.size
end

#to_htmlObject


332
333
334
335
336
337
338
# File 'app/helpers/issues_helper.rb', line 332

def to_html
  content =
    ('div', @left.reduce(&:+), :class => 'splitcontentleft') +
    ('div', @right.reduce(&:+), :class => 'splitcontentleft')

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