mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-24 00:50:28 +00:00
Rename checkbox "invert" attribute to "invertTag"
And update docs
This commit is contained in:
parent
22d35bf989
commit
63f802efda
@ -58,7 +58,7 @@ CheckboxWidget.prototype.getValue = function() {
|
||||
var tiddler = this.wiki.getTiddler(this.checkboxTitle);
|
||||
if(tiddler) {
|
||||
if(this.checkboxTag) {
|
||||
if(this.checkboxInvert) {
|
||||
if(this.checkboxInvertTag) {
|
||||
return !tiddler.hasTag(this.checkboxTag);
|
||||
} else {
|
||||
return tiddler.hasTag(this.checkboxTag);
|
||||
@ -96,7 +96,7 @@ CheckboxWidget.prototype.handleChangeEvent = function(event) {
|
||||
newFields = {title: this.checkboxTitle},
|
||||
hasChanged = false,
|
||||
tagCheck = false;
|
||||
if(this.checkboxTag && this.checkboxInvert === "yes") {
|
||||
if(this.checkboxTag && this.checkboxInvertTag === "yes") {
|
||||
tagCheck = tiddler.hasTag(this.checkboxTag) === checked;
|
||||
} else {
|
||||
tagCheck = tiddler.hasTag(this.checkboxTag) !== checked;
|
||||
@ -108,9 +108,9 @@ CheckboxWidget.prototype.handleChangeEvent = function(event) {
|
||||
if(pos !== -1) {
|
||||
newFields.tags.splice(pos,1);
|
||||
}
|
||||
if(this.checkboxInvert === "yes" && !checked) {
|
||||
if(this.checkboxInvertTag === "yes" && !checked) {
|
||||
newFields.tags.push(this.checkboxTag);
|
||||
} else if(this.checkboxInvert !== "yes" && checked) {
|
||||
} else if(this.checkboxInvertTag !== "yes" && checked) {
|
||||
newFields.tags.push(this.checkboxTag);
|
||||
}
|
||||
hasChanged = true;
|
||||
@ -140,7 +140,7 @@ CheckboxWidget.prototype.execute = function() {
|
||||
this.checkboxUnchecked = this.getAttribute("unchecked");
|
||||
this.checkboxDefault = this.getAttribute("default");
|
||||
this.checkboxClass = this.getAttribute("class","");
|
||||
this.checkboxInvert = this.getAttribute("invert","");
|
||||
this.checkboxInvertTag = this.getAttribute("invertTag","");
|
||||
// Make the child widgets
|
||||
this.makeChildWidgets();
|
||||
};
|
||||
@ -150,7 +150,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
||||
*/
|
||||
CheckboxWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
if(changedAttributes.tiddler || changedAttributes.tag || changedAttributes.field || changedAttributes.checked || changedAttributes.unchecked || changedAttributes["default"] || changedAttributes["class"]) {
|
||||
if(changedAttributes.tiddler || changedAttributes.tag || changedAttributes.invertTag || changedAttributes.field || changedAttributes.checked || changedAttributes.unchecked || changedAttributes["default"] || changedAttributes["class"]) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else {
|
||||
|
@ -1,8 +1,9 @@
|
||||
title: CheckboxWidget
|
||||
created: 201310241419
|
||||
modified: 20150220161154000
|
||||
tags: Widgets
|
||||
caption: checkbox
|
||||
created: 20131024141900000
|
||||
modified: 20150626091305445
|
||||
tags: Widgets
|
||||
title: CheckboxWidget
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
! Introduction
|
||||
|
||||
@ -18,6 +19,7 @@ The content of the `<$checkbox>` widget is displayed within an HTML `<label>` el
|
||||
|!Attribute |!Description |
|
||||
|tiddler |Title of the tiddler to manipulate (defaults to the [[current tiddler|Current Tiddler]]) |
|
||||
|tag |The name of the tag to which the checkbox should be bound |
|
||||
|invertTag |When set to ''yes'', flips the tag binding logic so that the absence of the tag causes the checkbox to be checked |
|
||||
|field |The name of the field to which the checkbox should be bound |
|
||||
|checked |The value of the field corresponding to the checkbox being checked |
|
||||
|unchecked |The value of the field corresponding to the checkbox being unchecked |
|
||||
|
Loading…
Reference in New Issue
Block a user