Class: Dradis::Plugins::HtmlExport::TemplatePresenter

Inherits:
BasePresenter
  • Object
show all
Defined in:
app/presenters/dradis/plugins/html_export/template_presenter.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.each_template(&block) ⇒ Object



7
8
9
# File 'app/presenters/dradis/plugins/html_export/template_presenter.rb', line 7

def self.each_template(&block)
  templates.each(&block)
end

.templatesObject



11
12
13
14
15
16
17
# File 'app/presenters/dradis/plugins/html_export/template_presenter.rb', line 11

def self.templates
  if defined?(Dradis::Pro)
    ReportTemplateProperties.all.where(plugin_name: :html_export).order(:title)
  else
    Dir["%s/*" % templates_dir].map { |t| File.basename(t) }.sort
  end
end

.templates_dirObject



19
20
21
# File 'app/presenters/dradis/plugins/html_export/template_presenter.rb', line 19

def self.templates_dir
  File.join(::Configuration::paths_templates_reports, 'html_export')
end

Instance Method Details

#filenameObject



30
31
32
33
34
# File 'app/presenters/dradis/plugins/html_export/template_presenter.rb', line 30

def filename
  return template if template.is_a?(String)

  template.template_file
end

#titleObject



23
24
25
26
27
28
# File 'app/presenters/dradis/plugins/html_export/template_presenter.rb', line 23

def title
  return template if template.is_a?(String)

  (:span, "#{template.title} - ") +
    (:small, template.template_file)
end