Class: DocTemplate::Tags::GroupTag

Inherits:
BaseTag
  • Object
show all
Includes:
Helpers
Defined in:
lib/doc_template/tags/group_tag.rb

Constant Summary collapse

TAG_NAME =
'group'
TEMPLATES =
{
  default: 'group-ela.html.erb',
  gdoc: 'gdoc/group-ela.html.erb'
}.freeze

Constants included from Helpers

Helpers::ICON_PATH

Constants inherited from BaseTag

BaseTag::SOFT_RETURN_RE, BaseTag::UNICODE_SPACES_RE

Instance Attribute Summary

Attributes inherited from BaseTag

#anchor, #content

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

#parse(node, opts = {}) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/doc_template/tags/group_tag.rb', line 14

def parse(node, opts = {})
  group = opts[:agenda].level1_by_title(opts[:value].parameterize)
  @anchor = group.anchor
  @materials = group.material_ids

  before_materials = ''
  if (with_materials = group.material_ids.any?)
    before_materials = content_until_materials node
    before_materials = parse_nested before_materials.to_s, opts
  end

  content = content_until_break node
  content = parse_nested content.to_s, opts
  params = {
    before_materials: before_materials,
    content: content,
    group: group,
    placeholder: placeholder_id,
    react_props: {
      activity: {
        title: group.title
      },
      group: true,
      material_ids: group.material_ids
    },
    with_materials: with_materials
  }
  @content = parse_template params, template_name(opts)
  replace_tag node
  self
end