mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-07 16:00:28 +00:00
Update entity state tiddlers on startup to read bag and recipe info
This commit is contained in:
parent
4133e7d6d6
commit
9767e7d3b7
@ -42,6 +42,7 @@ exports.startup = function() {
|
|||||||
databasePath: databasePath
|
databasePath: databasePath
|
||||||
});
|
});
|
||||||
$tw.sqlTiddlerStore.createTables();
|
$tw.sqlTiddlerStore.createTables();
|
||||||
|
$tw.sqlTiddlerStore.updateAdminWiki();
|
||||||
// Create bags and recipes
|
// Create bags and recipes
|
||||||
$tw.sqlTiddlerStore.createBag("bag-alpha");
|
$tw.sqlTiddlerStore.createBag("bag-alpha");
|
||||||
$tw.sqlTiddlerStore.createBag("bag-beta");
|
$tw.sqlTiddlerStore.createBag("bag-beta");
|
||||||
|
@ -57,6 +57,26 @@ SqlTiddlerStore.prototype.saveEntityStateTiddler = function(tiddler) {
|
|||||||
this.adminWiki.addTiddler(new $tw.Tiddler(tiddler,{title: this.entityStateTiddlerPrefix + tiddler.title}));
|
this.adminWiki.addTiddler(new $tw.Tiddler(tiddler,{title: this.entityStateTiddlerPrefix + tiddler.title}));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
SqlTiddlerStore.prototype.updateAdminWiki = function() {
|
||||||
|
// Update bags
|
||||||
|
for(const bagInfo of this.listBags()) {
|
||||||
|
this.saveEntityStateTiddler({
|
||||||
|
title: "bags/" + bagInfo.bag_name,
|
||||||
|
"bag-name": bagInfo.bag_name,
|
||||||
|
text: ""
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// Update recipes
|
||||||
|
for(const recipeInfo of this.listRecipes()) {
|
||||||
|
this.saveEntityStateTiddler({
|
||||||
|
title: "recipes/" + recipeInfo.recipe_name,
|
||||||
|
"recipe-name": recipeInfo.recipe_name,
|
||||||
|
text: "",
|
||||||
|
list: $tw.utils.stringifyList(this.getRecipeBags(recipeInfo.recipe_name))
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
SqlTiddlerStore.prototype.createTables = function() {
|
SqlTiddlerStore.prototype.createTables = function() {
|
||||||
this.runStatements([`
|
this.runStatements([`
|
||||||
-- Bags have names and access control settings
|
-- Bags have names and access control settings
|
||||||
|
Loading…
Reference in New Issue
Block a user