Module: DocumentationHelper

Defined in:
app/helpers/documentation_helper.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) document_toggle_tag(object)



42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'app/helpers/documentation_helper.rb', line 42

def document_toggle_tag(object)
  (:div, class: 'document_toggle_tag') do
    viewer_documents.each do |document_id|
      (:span, 
                  link_to(
                    (
                      Document.find(document_id), 
                      '/view/pdf/link/or/onclick' 
                    )
      )
                 )
    end
  end
end

- (Object) document_viewer_target(object)



18
19
20
# File 'app/helpers/documentation_helper.rb', line 18

def document_viewer_target(object)
  viewer_documents(object).first
end


9
10
11
12
# File 'app/helpers/documentation_helper.rb', line 9

def documentation_link(documentation)
  return nil if documentation.nil?
  link_to(documentation_tag(documentation).html_safe, documentation)
end

- (Object) documentation_search_form



14
15
16
# File 'app/helpers/documentation_helper.rb', line 14

def documentation_search_form
  render('/documentation/quick_search_form')
end

- (Object) documentation_tag(documentation)



3
4
5
6
7
# File 'app/helpers/documentation_helper.rb', line 3

def documentation_tag(documentation)
  return nil if documentation.nil?
  string = [ documentation.documentation_object_type, ': ', object_tag(documentation.documentation_object)].join.html_safe
  string
end

- (Object) viewer_documents(object)



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/helpers/documentation_helper.rb', line 22

def viewer_documents(object)
  document_ids = []

  sessions_current_user.pinboard
  #  pinboard - top document
  #  pinboard - 

  #    So- behaviour.
  #    We need to allow the user to choose a document to show.
  #    That document should be, in order of priority:
  #    1) the pinned Doucment that is_inserted = true
  #  2) the pinned Document
  #  3) the pinned Source that is_inserted (if it has a PDF)
  #  4) the pinned Source (if it has a PDF)
  #  If there is none of 1-4 you get help message saying what to do OR we just don’t display the slide out. I could write a boolean returning method to dtermine if any of 1-4 are available.
  #    Just thought of another thing on way in - If a record has a citation, then the source for that Citation should be pre-loaded (assuming source has PDF)


end