Module: PdfjsViewer::ApplicationHelper

Defined in:
app/helpers/pdfjs_viewer/application_helper.rb

Overview

PdfjsViewer Application Helper

Constant Summary collapse

BUTTON_CONFIG_MAPPING =
{
  'editorHighlightButton' => :show_highlight_button,
  'editorFreeTextButton' => :show_text_button,
  'editorInkButton' => :show_draw_button,
  'editorStampButton' => :show_add_edit_image_button,
  'printButton' => :show_print_button,
  'downloadButton' => :show_save_button,
  'secondaryOpenFile' => :show_open_file_button
}.freeze

Instance Method Summary collapse

Instance Method Details

#button_visibility(button_id) ⇒ Object



31
32
33
34
35
# File 'app/helpers/pdfjs_viewer/application_helper.rb', line 31

def button_visibility(button_id)
  return default_button_visibility(button_id) if @show_buttons.blank?

  @show_buttons.include?(button_id.to_s) ? '' : 'hide'
end

#pdfjs_viewer_path ⇒ Object



27
28
29
# File 'app/helpers/pdfjs_viewer/application_helper.rb', line 27

def pdfjs_viewer_path
  PdfjsViewer::Engine.routes.url_helpers.root_path
end

#stylesheet_path ⇒ Object



23
24
25
# File 'app/helpers/pdfjs_viewer/application_helper.rb', line 23

def stylesheet_path
  PdfjsViewer.configuration.stylesheet_path
end

#toggle_action(key = nil) ⇒ Object



17
18
19
20
21
# File 'app/helpers/pdfjs_viewer/application_helper.rb', line 17

def toggle_action(key = nil)
  return if PdfjsViewer.configuration.send(key)

  'hide'
end