mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-06-24 22:33:16 +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);
|
var tiddler = this.wiki.getTiddler(this.checkboxTitle);
|
||||||
if(tiddler) {
|
if(tiddler) {
|
||||||
if(this.checkboxTag) {
|
if(this.checkboxTag) {
|
||||||
if(this.checkboxInvert) {
|
if(this.checkboxInvertTag) {
|
||||||
return !tiddler.hasTag(this.checkboxTag);
|
return !tiddler.hasTag(this.checkboxTag);
|
||||||
} else {
|
} else {
|
||||||
return tiddler.hasTag(this.checkboxTag);
|
return tiddler.hasTag(this.checkboxTag);
|
||||||
|
@ -96,7 +96,7 @@ CheckboxWidget.prototype.handleChangeEvent = function(event) {
|
||||||
newFields = {title: this.checkboxTitle},
|
newFields = {title: this.checkboxTitle},
|
||||||
hasChanged = false,
|
hasChanged = false,
|
||||||
tagCheck = false;
|
tagCheck = false;
|
||||||
if(this.checkboxTag && this.checkboxInvert === "yes") {
|
if(this.checkboxTag && this.checkboxInvertTag === "yes") {
|
||||||
tagCheck = tiddler.hasTag(this.checkboxTag) === checked;
|
tagCheck = tiddler.hasTag(this.checkboxTag) === checked;
|
||||||
} else {
|
} else {
|
||||||
tagCheck = tiddler.hasTag(this.checkboxTag) !== checked;
|
tagCheck = tiddler.hasTag(this.checkboxTag) !== checked;
|
||||||
|
@ -108,9 +108,9 @@ CheckboxWidget.prototype.handleChangeEvent = function(event) {
|
||||||
if(pos !== -1) {
|
if(pos !== -1) {
|
||||||
newFields.tags.splice(pos,1);
|
newFields.tags.splice(pos,1);
|
||||||
}
|
}
|
||||||
if(this.checkboxInvert === "yes" && !checked) {
|
if(this.checkboxInvertTag === "yes" && !checked) {
|
||||||
newFields.tags.push(this.checkboxTag);
|
newFields.tags.push(this.checkboxTag);
|
||||||
} else if(this.checkboxInvert !== "yes" && checked) {
|
} else if(this.checkboxInvertTag !== "yes" && checked) {
|
||||||
newFields.tags.push(this.checkboxTag);
|
newFields.tags.push(this.checkboxTag);
|
||||||
}
|
}
|
||||||
hasChanged = true;
|
hasChanged = true;
|
||||||
|
@ -140,7 +140,7 @@ CheckboxWidget.prototype.execute = function() {
|
||||||
this.checkboxUnchecked = this.getAttribute("unchecked");
|
this.checkboxUnchecked = this.getAttribute("unchecked");
|
||||||
this.checkboxDefault = this.getAttribute("default");
|
this.checkboxDefault = this.getAttribute("default");
|
||||||
this.checkboxClass = this.getAttribute("class","");
|
this.checkboxClass = this.getAttribute("class","");
|
||||||
this.checkboxInvert = this.getAttribute("invert","");
|
this.checkboxInvertTag = this.getAttribute("invertTag","");
|
||||||
// Make the child widgets
|
// Make the child widgets
|
||||||
this.makeChildWidgets();
|
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) {
|
CheckboxWidget.prototype.refresh = function(changedTiddlers) {
|
||||||
var changedAttributes = this.computeAttributes();
|
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();
|
this.refreshSelf();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
title: CheckboxWidget
|
|
||||||
created: 201310241419
|
|
||||||
modified: 20150220161154000
|
|
||||||
tags: Widgets
|
|
||||||
caption: checkbox
|
caption: checkbox
|
||||||
|
created: 20131024141900000
|
||||||
|
modified: 20150626091305445
|
||||||
|
tags: Widgets
|
||||||
|
title: CheckboxWidget
|
||||||
|
type: text/vnd.tiddlywiki
|
||||||
|
|
||||||
! Introduction
|
! Introduction
|
||||||
|
|
||||||
|
@ -18,6 +19,7 @@ The content of the `<$checkbox>` widget is displayed within an HTML `<label>` el
|
||||||
|!Attribute |!Description |
|
|!Attribute |!Description |
|
||||||
|tiddler |Title of the tiddler to manipulate (defaults to the [[current tiddler|Current Tiddler]]) |
|
|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 |
|
|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 |
|
|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 |
|
|checked |The value of the field corresponding to the checkbox being checked |
|
||||||
|unchecked |The value of the field corresponding to the checkbox being unchecked |
|
|unchecked |The value of the field corresponding to the checkbox being unchecked |
|
||||||
|
|
Loading…
Reference in New Issue
Block a user