summaryrefslogtreecommitdiff
path: root/app/services/notes/render_service.rb
blob: a77e98c2b07717f28dbc21d3eecb561cfdf63945 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module Notes
  class RenderService < BaseRenderer
    # Renders a collection of Note instances.
    #
    # notes - The notes to render.
    # project - The project to use for redacting.
    # user - The user viewing the notes.

    # Possible options:
    # requested_path - The request path.
    # project_wiki - The project's wiki.
    # ref - The current Git reference.
    # only_path - flag to turn relative paths into absolute ones.
    # xhtml - flag to save the html in XHTML
    def execute(notes, project, **opts)
      renderer = Banzai::ObjectRenderer.new(project, current_user, **opts)

      renderer.render(notes, :note)
    end
  end
end