Class: IssueTrackerTypeDecorator

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

Overview

Decorates an IssueTracker class

Instance Method Summary collapse

Instance Method Details

#fieldsObject


25
26
27
28
29
# File 'app/decorators/issue_tracker_type_decorator.rb', line 25

def fields
  object.fields.each do |field, field_info|
    yield IssueTrackerFieldDecorator.new(field, field_info)
  end
end

#iconsObject

return hash of icons as data URIs


6
7
8
9
10
11
12
# File 'app/decorators/issue_tracker_type_decorator.rb', line 6

def icons
  return unless object.icons

  object.icons.reduce({}) do |c, (k,v)|
    c[k] = "data:#{v[0]};base64,#{Base64.encode64(v[1])}"; c
  end
end

#noteObject


21
22
23
# File 'app/decorators/issue_tracker_type_decorator.rb', line 21

def note
  object.note.html_safe
end

#params_class(tracker) ⇒ Object

class name for tracker type form fields

'chosen github' or 'bitbucket' for example


17
18
19
# File 'app/decorators/issue_tracker_type_decorator.rb', line 17

def params_class(tracker)
  [object.label == tracker.type_tracker ? 'chosen' : '', label].join(" ").strip
end