Class: MultipartNoteRenderer

Inherits:
NoteRenderer show all
Defined in:
public/app/models/note_renderer.rb

Instance Method Summary collapse

Methods inherited from NoteRenderer

#build_label, for, inherited, #render_partial

Methods included from ManipulateNode

#inheritance, #process_mixed_content, #strip_mixed_content

Instance Method Details

#render(type, note, result) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'public/app/models/note_renderer.rb', line 57

def render(type, note, result)
  result['label'] = build_label(type, note)

  notes = []
  ASUtils.wrap(note['subnotes']).each do |sub|
    unless sub['publish'] == false
      rendered_subnote = {}
      NoteRenderer.for(sub['jsonmodel_type']).render(sub['jsonmodel_type'], sub, rendered_subnote)

      notes << rendered_subnote['note_text']
      result['subnotes'] ||= []
      result['subnotes'] << sub.merge({
                                        '_text' => rendered_subnote['note_text'],
                                        '_title' => sub['title']
                                      })
    end
  end

  result['note_text'] = notes.join('<br/>')
  result
end