Class: IssueTrackerFieldDecorator

Inherits:
Draper::Decorator
  • Object
show all
Defined in:
app/decorators/issue_tracker_field_decorator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field, field_info) ⇒ IssueTrackerFieldDecorator


3
4
5
6
# File 'app/decorators/issue_tracker_field_decorator.rb', line 3

def initialize(field, field_info)
  @object = field
  @field_info = field_info
end

Instance Attribute Details

#field_infoObject (readonly)

Returns the value of attribute field_info


7
8
9
# File 'app/decorators/issue_tracker_field_decorator.rb', line 7

def field_info
  @field_info
end

#objectObject (readonly) Also known as: key

Returns the value of attribute object


7
8
9
# File 'app/decorators/issue_tracker_field_decorator.rb', line 7

def object
  @object
end

Instance Method Details

#input(form, issue_tracker) ⇒ Object


16
17
18
19
20
# File 'app/decorators/issue_tracker_field_decorator.rb', line 16

def input(form, issue_tracker)
  form.send(input_field, key.to_s,
            :placeholder => field_info[:placeholder],
            :value => issue_tracker.options[key.to_s])
end

#labelObject


11
12
13
# File 'app/decorators/issue_tracker_field_decorator.rb', line 11

def label
  field_info[:label] || object.to_s.titleize
end