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

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