Class: IssuesHelper::IssueFieldsRows

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

Overview

Since:

  • 2.1.0

Instance Method Summary collapse

Constructor Details

#initializeIssueFieldsRows

Returns a new instance of IssueFieldsRows



191
192
193
194
# File 'app/helpers/issues_helper.rb', line 191

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

Instance Method Details

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



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

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



196
197
198
# File 'app/helpers/issues_helper.rb', line 196

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

#right(*args) ⇒ Object



200
201
202
# File 'app/helpers/issues_helper.rb', line 200

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

#sizeObject



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

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

#to_htmlObject



208
209
210
211
212
213
214
# File 'app/helpers/issues_helper.rb', line 208

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

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