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.


264
265
266
267
# File 'app/helpers/issues_helper.rb', line 264

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

Instance Method Details

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


289
290
291
292
293
294
295
296
# File 'app/helpers/issues_helper.rb', line 289

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


269
270
271
# File 'app/helpers/issues_helper.rb', line 269

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

#right(*args) ⇒ Object


273
274
275
# File 'app/helpers/issues_helper.rb', line 273

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

#sizeObject


277
278
279
# File 'app/helpers/issues_helper.rb', line 277

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

#to_htmlObject


281
282
283
284
285
286
287
# File 'app/helpers/issues_helper.rb', line 281

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

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