xhiveframework.provide("xhiveframework.model");
xhiveframework.provide("xhiveframework.utils");

/**
 * Opens the Website Meta Tag form if it exists for {route}
 * or creates a new doc and opens the form
 */
xhiveframework.utils.set_meta_tag = function (route) {
	xhiveframework.db.exists("Website Route Meta", route).then((exists) => {
		if (exists) {
			xhiveframework.set_route("Form", "Website Route Meta", route);
		} else {
			// new doc
			const doc = xhiveframework.model.get_new_doc("Website Route Meta");
			doc.__newname = route;
			xhiveframework.set_route("Form", doc.doctype, doc.name);
		}
	});
};
