From 8cbb98d44d77965efb8e400e17da59640ab6c816 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Wed, 21 Aug 2013 20:50:08 +0100 Subject: [PATCH] Hack the list widget Usually the list transcludes each tiddler through the sample template. This hack makes it work differently, where each tiddler is used as a template to render the same current tiddler. The attribute that switches modes is called "hackTemplate" because this is a temporary implementation of this capability for experimental purposes --- core/modules/widgets/list/list.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/core/modules/widgets/list/list.js b/core/modules/widgets/list/list.js index 27cccc251..4649173e9 100644 --- a/core/modules/widgets/list/list.js +++ b/core/modules/widgets/list/list.js @@ -198,16 +198,22 @@ ListWidget.prototype.createListElementTransclusion = function(title) { } } // Create the transclude widget - return { + var widget = { type: "element", tag: "$transclude", isBlock: this.renderer.parseTreeNode.isBlock, - attributes: { - target: {type: "string", value: title}, - template: {type: "string", value: template} - }, + attributes: {}, children: templateTree }; + // Set the target if needed + if(!this.renderer.hasAttribute("hackTemplate")) { + widget.attributes.target = {type: "string", value: title}; + widget.attributes.template = {type: "string", value: template}; + } else { + widget.attributes.template = {type: "string", value: title}; + widget.children = undefined; + } + return widget; }; /*