Skip to content

Commit

Permalink
Add tiddler info "advanced" panel
Browse files Browse the repository at this point in the history
  • Loading branch information
Jermolene committed Mar 14, 2014
1 parent b714c67 commit 42c67cf
Show file tree
Hide file tree
Showing 7 changed files with 161 additions and 0 deletions.
9 changes: 9 additions & 0 deletions core/language/en-GB/TiddlerInfo.multids
@@ -1,5 +1,14 @@
title: $:/language/TiddlerInfo/

Advanced/Caption: Advanced
Advanced/PluginInfo/Empty/Hint: none
Advanced/PluginInfo/Heading: Plugin Details
Advanced/PluginInfo/Hint: This plugin contains the following shadow tiddlers:
Advanced/ShadowInfo/Heading: Shadow Status
Advanced/ShadowInfo/NotShadow/Hint: The tiddler <$link to=<<infoTiddler>>><$text text=<<infoTiddler>>/></$link> is not a shadow tiddler
Advanced/ShadowInfo/Shadow/Hint: The tiddler <$link to=<<infoTiddler>>><$text text=<<infoTiddler>>/></$link> is a shadow tiddler
Advanced/ShadowInfo/Shadow/Source: It is defined in the plugin <$link to=<<pluginTiddler>>><$text text=<<pluginTiddler>>/></$link>
Advanced/ShadowInfo/OverriddenShadow/Hint: It is overridden by an ordinary tiddler
Fields/Caption: Fields
List/Caption: List
List/Empty: This tiddler does not have a list
Expand Down
47 changes: 47 additions & 0 deletions core/modules/filters/plugintiddlers.js
@@ -0,0 +1,47 @@
/*\
title: $:/core/modules/filters/plugintiddlers.js
type: application/javascript
module-type: filteroperator
Filter operator for returning the titles of the shadow tiddlers within a plugin
\*/
(function(){

/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";

/*
Export our filter function
*/
exports.plugintiddlers = function(source,operator,options) {
var results = [],
pushShadows;
switch(operator.operand) {
default:
pushShadows = function(title) {
var pluginInfo = options.wiki.pluginInfo[title];
if(pluginInfo) {
$tw.utils.each(pluginInfo.tiddlers,function(fields,title) {
results.push(title);
});
}
};
break;
}
// Iterate through the source tiddlers
if($tw.utils.isArray(source)) {
$tw.utils.each(source,function(title) {
pushShadows(title);
});
} else {
$tw.utils.each(source,function(element,title) {
pushShadows(title);
});
}
results.sort();
return results;
};

})();
40 changes: 40 additions & 0 deletions core/modules/filters/shadowsource.js
@@ -0,0 +1,40 @@
/*\
title: $:/core/modules/filters/shadowsource.js
type: application/javascript
module-type: filteroperator
Filter operator for returning the source plugins for shadow tiddlers
\*/
(function(){

/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";

/*
Export our filter function
*/
exports.shadowsource = function(source,operator,options) {
var results = [],
pushShadowSource = function(title) {
var shadowInfo = options.wiki.shadowTiddlers[title];
if(shadowInfo) {
$tw.utils.pushTop(results,shadowInfo.source);
}
};
// Iterate through the source tiddlers
if($tw.utils.isArray(source)) {
$tw.utils.each(source,function(title) {
pushShadowSource(title);
});
} else {
$tw.utils.each(source,function(element,title) {
pushShadowSource(title);
});
}
results.sort();
return results;
};

})();
8 changes: 8 additions & 0 deletions core/ui/TiddlerInfo/Advanced.tid
@@ -0,0 +1,8 @@
title: $:/core/ui/TiddlerInfo/Advanced
tags: $:/tags/TiddlerInfo
caption: {{$:/language/TiddlerInfo/Advanced/Caption}}

<$list filter="[is[shadow]!has[draft.of]tag[$:/tags/TiddlerInfo/Advanced]] [!is[shadow]!has[draft.of]tag[$:/tags/TiddlerInfo/Advanced]] +[tag[$:/tags/TiddlerInfo/Advanced]]" variable="listItem">
<$transclude tiddler=<<listItem>>/>

</$list>
20 changes: 20 additions & 0 deletions core/ui/TiddlerInfo/Advanced/PluginInfo.tid
@@ -0,0 +1,20 @@
title: $:/core/ui/TiddlerInfo/Advanced/PluginInfo
tags: $:/tags/TiddlerInfo/Advanced

\define lingo-base() $:/language/TiddlerInfo/Advanced/PluginInfo/
<$list filter="[is[current]has[plugin-type]]">

! <<lingo Heading>>

<<lingo Hint>>
<ul>
<$list filter="[is[current]plugintiddlers[]sort[title]]" emptyMessage=<<lingo Empty/Hint>>>
<li>
<$link to={{!!title}}>
<$view field="title"/>
</$link>
</li>
</$list>
</ul>

</$list>
35 changes: 35 additions & 0 deletions core/ui/TiddlerInfo/Advanced/ShadowInfo.tid
@@ -0,0 +1,35 @@
title: $:/core/ui/TiddlerInfo/Advanced/ShadowInfo
tags: $:/tags/TiddlerInfo/Advanced

\define lingo-base() $:/language/TiddlerInfo/Advanced/ShadowInfo/
<$set name="infoTiddler" value=<<currentTiddler>>>

! <<lingo Heading>>

<$list filter="[is[current]!is[shadow]]">

<<lingo NotShadow/Hint>>

</$list>

<$list filter="[is[current]is[shadow]]">

<<lingo Shadow/Hint>>

<$list filter="[is[current]shadowsource[]]">

<$set name="pluginTiddler" value=<<currentTiddler>>>
<<lingo Shadow/Source>>
</$set>

</$list>

<$list filter="[is[current]is[shadow]is[tiddler]]">

<<lingo OverriddenShadow/Hint>>

</$list>


</$list>
</$set>
2 changes: 2 additions & 0 deletions core/wiki/tags/TiddlerInfoAdvanced.tid
@@ -0,0 +1,2 @@
title: $:/tags/TiddlerInfo/Advanced
list: [[$:/core/ui/TiddlerInfo/Advanced/ShadowInfo]] [[$:/core/ui/TiddlerInfo/Advanced/PluginInfo]]

0 comments on commit 42c67cf

Please sign in to comment.