1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-09-29 23:40:45 +00:00

Use the transclude macro instead of list tagging in the tag popup

This commit is contained in:
Jeremy Ruston 2012-06-19 10:40:30 +01:00
parent ec3f16f50f
commit cabc11d517
4 changed files with 24 additions and 14 deletions

View File

@ -29,9 +29,6 @@ var handlers = {
// Server syncing isn't implemented yet // Server syncing isn't implemented yet
return []; return [];
}, },
tagging: function(wiki,tiddlerTitle) {
return wiki.getTiddlersWithTag(tiddlerTitle);
},
filter: function(wiki) { filter: function(wiki) {
// Filters aren't implemented yet // Filters aren't implemented yet
return []; return [];

View File

@ -18,7 +18,8 @@ exports.info = {
filter: {byPos: 0, type: "filter"}, filter: {byPos: 0, type: "filter"},
title: {byPos: 1, type: "tiddler"}, title: {byPos: 1, type: "tiddler"},
templateTitle: {byName: true, type: "text"}, templateTitle: {byName: true, type: "text"},
templateText: {byName: true, type: "text"} templateText: {byName: true, type: "text"},
emptyMessage: {byName: true, type: "text"}
} }
}; };
@ -51,6 +52,13 @@ exports.executeMacro = function() {
templateParseTree = this.wiki.parseText("text/x-tiddlywiki","<<view text wikified>>"); templateParseTree = this.wiki.parseText("text/x-tiddlywiki","<<view text wikified>>");
} }
} }
// Use the empty message if the list is empty
if(titles.length === 0 && this.hasParameter("emptyMessage")) {
nodes = this.wiki.parseText("text/x-tiddlywiki",this.params.emptyMessage).tree;
for(c=0; c<nodes.length; c++) {
nodes[c].execute(this.parents,this.tiddlerTitle);
}
} else {
// Render the tiddlers through the template // Render the tiddlers through the template
nodes = []; nodes = [];
for(t=0; t<titles.length; t++) { for(t=0; t<titles.length; t++) {
@ -61,6 +69,7 @@ exports.executeMacro = function() {
nodes.push(node); nodes.push(node);
} }
} }
}
// Return // Return
var attributes = {"class": ["tw-transclusion"]}; var attributes = {"class": ["tw-transclusion"]};
if(this.classes) { if(this.classes) {

View File

@ -12,7 +12,11 @@ title: $:/templates/TagTemplate
<<reveal state:TagDropDownLocation type:popup qualifyTiddlerTitles:yes>< <<reveal state:TagDropDownLocation type:popup qualifyTiddlerTitles:yes><
<div class="open"> <div class="open">
{{dropdown-menu{ {{dropdown-menu{
<<list tagging>> (((
[is[current]tagging[]]
)) <<view title link>> )
}}} }}}
</div> </div>
>> >>

File diff suppressed because one or more lines are too long