Class: DocTemplate::Tags::ActivityMetadataTypeTag
- Includes:
- Helpers, ERB::Util
- Defined in:
- lib/doc_template/tags/activity_metadata_type_tag.rb
Constant Summary collapse
- TAG_NAME =
'activity-metadata-type'
- TASK_RE =
/(\[task:\s(#)\])/i.freeze
- TEMPLATES =
{ default: 'activity.html.erb', gdoc: 'gdoc/activity.html.erb' }.freeze
Constants included from Helpers
Constants inherited from BaseTag
BaseTag::SOFT_RETURN_RE, BaseTag::UNICODE_SPACES_RE
Instance Attribute Summary
Attributes inherited from BaseTag
Instance Method Summary collapse
Methods included from Helpers
#materials_container, #priority_description, #priority_icon
Methods inherited from BaseTag
#before_tag, #check_tag_soft_return, #content_until_break, #content_until_materials, #ela2?, #ela6?, #gdoc?, #include_break?, #include_break_for?, #materials, parse, #parse_nested, #parse_template, #placeholder, #placeholder_id, #render, #replace_tag, #tag_data, tag_with_html_regexp, #template_name, #template_path, template_path_for
Instance Method Details
#optional? ⇒ Boolean
16 17 18 |
# File 'lib/doc_template/tags/activity_metadata_type_tag.rb', line 16 def optional? !!@activity.try(:optional) end |
#parse(node, opts = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/doc_template/tags/activity_metadata_type_tag.rb', line 20 def parse(node, opts = {}) @opts = opts @metadata = opts[:activity] @activity = @metadata.find_by_anchor(opts[:value]) @anchor = @activity.anchor content = DocTemplate.sanitizer.strip_html(content_until_break(node)) content = parse_nested content.to_s, opts params = { activity: @activity, content: DocTemplate.sanitizer.strip_html_element(content), placeholder: placeholder_id } # Extend basic params set with additional which can be customized params.merge! extended_parse_params @content = parse_template params, template_name(opts) @materials = @activity.try(:material_ids) || [] replace_tag node self end |