local m = {}

function m.page(template, title, ext_data)
	if not title then
		local title = "Admin"
	else
		local title = "Admin: "..title
	end

	local data = table.merge({
			title   = title,
			version = "v1.0.0",
			build   = "Moonlight"
		}, ext_data or {})

	data.html = render(fs_read("templates/admin/"..template), data)

	if ctx.headers["X-DK-AJAX"] then return data end

	return send_html(render(fs_read("templates/admin/layout.html"), data))
end

return m
