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



203
204
205
206
# File 'app/helpers/issues_helper.rb', line 203

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

Instance Method Details

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



228
229
230
231
232
233
# File 'app/helpers/issues_helper.rb', line 228

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



208
209
210
# File 'app/helpers/issues_helper.rb', line 208

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

#right(*args) ⇒ Object



212
213
214
# File 'app/helpers/issues_helper.rb', line 212

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

#sizeObject



216
217
218
# File 'app/helpers/issues_helper.rb', line 216

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

#to_htmlObject



220
221
222
223
224
225
226
# File 'app/helpers/issues_helper.rb', line 220

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

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