Module: DocTemplate::Tags::Helpers

Includes:
ActionView::Helpers::TagHelper
Included in:
ActivityMetadataSectionTag, ActivityMetadataTypeTag, GroupTag, SectionTag
Defined in:
lib/doc_template/tags/helpers.rb

Constant Summary collapse

ICON_PATH =
'http://s3.amazonaws.com/ubpilot-uploads/assets'

Instance Method Summary collapse

Instance Method Details

#materials_container(props) ⇒ Object



9
10
11
12
13
# File 'lib/doc_template/tags/helpers.rb', line 9

def materials_container(props)
  return if props.nil?

   :div, nil, data: { react_class: 'MaterialsContainer', react_props: props }
end

#priority_description(activity) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/doc_template/tags/helpers.rb', line 15

def priority_description(activity)
  priority = activity.try(:activity_priority) || activity.priority
  return unless priority.present?

  config = Tags.config[self.class::TAG_NAME.downcase]
  Array.wrap(config['priority_descriptions'])[priority - 1]
end

#priority_icon(activity) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/doc_template/tags/helpers.rb', line 23

def priority_icon(activity)
  return unless activity.priority.present?

  # for some odd reason inlined images aren't working at gdoc
  # this is why we reference s3
  "#{ICON_PATH}/ld_p#{activity.priority}.png"
end