Display warning banner when plugins are modified

Fixes #1455

@aelocson have I got the docs right for the new filter?
This commit is contained in:
Jermolene 2015-02-08 19:40:15 +00:00
parent e18825e897
commit aae56f20af
5 changed files with 89 additions and 0 deletions

View File

@ -14,6 +14,7 @@ Encryption/ConfirmClearPassword: Do you wish to clear the password? This will re
Encryption/PromptSetPassword: Set a new password for this TiddlyWiki
InvalidFieldName: Illegal characters in field name "<$text text=<<fieldName>>/>". Fields can only contain lowercase letters, digits and the characters underscore (`_`), hyphen (`-`) and period (`.`)
MissingTiddler/Hint: Missing tiddler "<$text text=<<currentTiddler>>/>" - click {{$:/core/images/edit-button}} to create
PluginReloadWarning: Please save {{$:/core/ui/Buttons/save-wiki}} and reload {{$:/core/ui/Buttons/refresh}} to allow changes to plugins to take effect
RecentChanges/DateFormat: DDth MMM YYYY
SystemTiddler/Tooltip: This is a system tiddler
TagManager/Colour/Heading: Colour

View File

@ -0,0 +1,36 @@
/*\
title: $:/core/modules/filters/haschanged.js
type: application/javascript
module-type: filteroperator
Filter operator returns tiddlers from the list that have a non-zero changecount.
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Export our filter function
*/
exports.haschanged = function(source,operator,options) {
var results = [];
if(operator.prefix === "!") {
source(function(tiddler,title) {
if(options.wiki.getChangeCount(title) === 0) {
results.push(title);
}
});
} else {
source(function(tiddler,title) {
if(options.wiki.getChangeCount(title) > 0) {
results.push(title);
}
});
}
return results;
};
})();

View File

@ -0,0 +1,22 @@
title: $:/core/ui/PageTemplate/pluginreloadwarning
tags: $:/tags/PageTemplate
\define lingo-base() $:/language/
<$list filter="[has[plugin-type]haschanged[]limit[1]]">
<$reveal type="nomatch" state="$:/temp/HidePluginWarning" text="yes">
<div class="tc-plugin-reload-warning">
<$set name="tv-config-toolbar-class" value="">
<<lingo PluginReloadWarning>> <$button set="$:/temp/HidePluginWarning" setTo="yes" class="tc-btn-invisible">{{$:/core/images/close-button}}</$button>
</$set>
</div>
</$reveal>
</$list>

View File

@ -0,0 +1,15 @@
created: 20150208191821000
modified: 20150208191821000
tags: [[Filter Operators]] [[Negatable Operators]]
title: haschanged Operator
type: text/vnd.tiddlywiki
caption: haschanged
op-purpose: returns input titles where the corresponding tiddlers have changed since startup
op-input: a [[selection of titles|Title Selection]]
op-parameter: none
op-output: those input tiddlers that have not changed since startup
op-neg-output: those input tiddlers that have changed since startup
Each input title is processed in turn, and is returned if any of its fields have changed since startup (or, with negation, if it has not changed).
<<.operator-examples "haschanged">>

View File

@ -241,6 +241,21 @@ a.tc-tiddlylink-external:hover {
content: "<<lingo DropMessage>>";
}
/*
** Plugin reload warning
*/
.tc-plugin-reload-warning {
z-index: 1000;
display: block;
position: fixed;
top: 0;
left: 0;
right: 0;
background: <<colour alert-background>>;
text-align: center;
}
/*
** Buttons
*/