Files
docuseal/lib/templates.rb
T
2023-06-21 01:55:50 +03:00

21 lines
382 B
Ruby

# frozen_string_literal: true
module Templates
module_function
def build_field_areas_index(template)
hash = {}
template.fields.each do |field|
(field['areas'] || []).each do |area|
hash[area['attachment_uuid']] ||= {}
acc = (hash[area['attachment_uuid']][area['page']] ||= [])
acc << [area, field]
end
end
hash
end
end