1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-24 17:10:29 +00:00

Extend modal message handler to cope with missing subtitle or footer fields

This commit is contained in:
Jeremy Ruston 2012-07-16 14:04:29 +01:00
parent a2da94e657
commit 8b61259973

View File

@ -44,7 +44,13 @@ Modal.prototype.display = function(title) {
modalFooter.appendChild(modalFooterButtons); modalFooter.appendChild(modalFooterButtons);
modalWrapper.appendChild(modalFooter); modalWrapper.appendChild(modalFooter);
// Render the title of the message // Render the title of the message
var headerRenderer = this.wiki.parseText("text/x-tiddlywiki-run","<<view subtitle wikified>>"); var titleText;
if(tiddler && tiddler.fields && tiddler.fields.subtitle) {
titleText = tiddler.fields.subtitle;
} else {
titleText = title;
}
var headerRenderer = this.wiki.parseText("text/x-tiddlywiki-run",titleText);
headerRenderer.execute([],title); headerRenderer.execute([],title);
headerRenderer.renderInDom(headerTitle); headerRenderer.renderInDom(headerTitle);
this.wiki.addEventListener("",function(changes) { this.wiki.addEventListener("",function(changes) {
@ -66,7 +72,13 @@ Modal.prototype.display = function(title) {
modalFooterHelp.appendChild(link); modalFooterHelp.appendChild(link);
modalFooterHelp.style.float = "left"; modalFooterHelp.style.float = "left";
} }
var footerRenderer = this.wiki.parseText("text/x-tiddlywiki-run","<<view footer wikified>>"); var footerText;
if(tiddler && tiddler.fields && tiddler.fields.footer) {
footerText = tiddler.fields.footer;
} else {
footerText = "<<button close class:'btn btn-primary'><Close>>";
}
var footerRenderer = this.wiki.parseText("text/x-tiddlywiki-run",footerText);
footerRenderer.execute([],title); footerRenderer.execute([],title);
footerRenderer.renderInDom(modalFooterButtons); footerRenderer.renderInDom(modalFooterButtons);
this.wiki.addEventListener("",function(changes) { this.wiki.addEventListener("",function(changes) {