Fixing bug on collection deletion
Extending Admin Interface Adding cleanup procedure, that clears undeleted collection data
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import getTemplate from "./hb";
|
||||
import { getTemplate } from "./hb";
|
||||
import { Context } from "vm";
|
||||
|
||||
interface IFormConfigField {
|
||||
|
@ -37,8 +37,22 @@ Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) {
|
||||
|
||||
|
||||
const cache = new Map<string, Handlebars.TemplateDelegate>();
|
||||
const htmlCache = new Map<string, string>();
|
||||
|
||||
export default function getTemplate(name: string) {
|
||||
export function getView(name: string) {
|
||||
let tl: string;
|
||||
if (!config.dev)
|
||||
tl = htmlCache.get(name);
|
||||
|
||||
if (!tl) {
|
||||
tl = readFileSync(`./views/${name}.html`).toString();
|
||||
htmlCache.set(name, tl);
|
||||
}
|
||||
|
||||
return tl;
|
||||
}
|
||||
|
||||
export function getTemplate(name: string) {
|
||||
let tl: Handlebars.TemplateDelegate;
|
||||
if (!config.dev)
|
||||
tl = cache.get(name);
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Context } from "koa";
|
||||
import getTemplate from "./hb";
|
||||
import { getTemplate } from "./hb";
|
||||
|
||||
export default function getTable(title: string, data: any[], ctx: Context) {
|
||||
let table: string[][] = [];
|
||||
|
Reference in New Issue
Block a user