lib/brief/model/serializers.rb in brief-1.8.12 vs lib/brief/model/serializers.rb in brief-1.9.0
- old
+ new
@@ -21,21 +21,22 @@
updated_at: File.mtime(path).to_i,
id: Digest::MD5.hexdigest(path.to_s),
hash: file_hash,
sections: {},
section_headings: [],
- urls: {
+ }.tap do |h|
+ h[:content] = document.combined_data_and_content if options[:content]
+ h[:rendered] = document.to_html if options[:rendered]
+
+ h[:urls] = {
view_content_url: "/view/content/#{ doc_path }",
view_rendered_url: "/view/rendered/#{ doc_path }",
view_details_url: "/view/details/#{ doc_path }",
update_url: "/update/#{ doc_path }",
remove_url: "/remove/#{ doc_path }",
schema_url: "/schema/#{ type }",
actions_url: "/actions/:action/#{ doc_path }"
- }
- }.tap do |h|
- h[:content] = document.combined_data_and_content if options[:content]
- h[:rendered] = document.to_html if options[:rendered]
+ } if options[:urls]
end.tap do |h|
if document.has_sections?
h[:section_headings] = document.section_headings
h[:sections] = document.sections_data
end