module InfoHelpers
helpers for info fields in documents
Public Instance Methods
page_info(**options)
click to toggle source
# File lib/paperwork/tasks/middleman_template/lib/info_helpers.rb, line 15 def page_info(**options) content_for :page_infos do options.keys.map do |name| partial("layouts/info", locals: { name: name, value: options[name] }) end.join end end
paperwork?()
click to toggle source
# File lib/paperwork/tasks/middleman_template/lib/info_helpers.rb, line 38 def paperwork? data.respond_to?(:paperwork) end
relative_link(stringifyable, current_path = current_page.path)
click to toggle source
# File lib/paperwork/tasks/middleman_template/lib/info_helpers.rb, line 23 def relative_link(stringifyable, current_path = current_page.path) relative = String.new dots = current_path.split(/[\/\\]/).size - 1 dots.times{ relative += "../" } # This has been some nasty part to debug... # keep these comments for debugging session yet to come # puts "##################################" # puts "current_page.path: #{current_page.path}" # puts "stringifyable: #{stringifyable.to_s}" # puts "dots: #{dots}" # puts "relative link: #{relative + stringifyable.to_s}" # puts "##################################" relative + stringifyable.to_s end
text_for(**options)
click to toggle source
# File lib/paperwork/tasks/middleman_template/lib/info_helpers.rb, line 7 def text_for(**options) options.keys.map do |key| content_for key do options[key].to_s end end end