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

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