Skip to content

Commit

Permalink
Extend button widget to set text references
Browse files Browse the repository at this point in the history
Previously the `set` attribute could only be used to identify a
tiddler, not a full text reference.
  • Loading branch information
Jermolene committed Mar 15, 2014
1 parent afa677b commit f649b5b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions core/modules/widgets/button.js
Expand Up @@ -118,8 +118,7 @@ ButtonWidget.prototype.triggerPopup = function(event) {
};

ButtonWidget.prototype.setTiddler = function() {
var tiddler = this.wiki.getTiddler(this.set);
this.wiki.addTiddler(new $tw.Tiddler(tiddler,{title: this.set, text: this.setTo}));
this.wiki.setTextReference(this.set,this.setTo,this.getVariable("currentTiddler"));
};

/*
Expand Down
6 changes: 3 additions & 3 deletions editions/tw5.com/tiddlers/widgets/ButtonWidget.tid
@@ -1,6 +1,6 @@
title: ButtonWidget
created: 201310241419
modified: 201402220837
modified: 201403150837
tags: widget

! Introduction
Expand All @@ -20,8 +20,8 @@ The content of the `<$button>` widget is displayed within the button.
|to |The title of the tiddler to navigate to |
|message |The name of the [[widget message|WidgetMessages]] to send when the button is clicked |
|param |The optional parameter to the message |
|set |The title of a tiddler to which a new value will be assigned |
|setTo |The new value to assign to the tiddler identified in the `set` attribute |
|set |A TextReference to which a new value will be assigned |
|setTo |The new value to assign to the TextReference identified in the `set` attribute |
|popup |Title of a state tiddler for a popup that is toggled when the button is clicked |
|class |An optional CSS class name to be assigned to the HTML element |
|style |An optional CSS style attribute to be assigned to the HTML element |
Expand Down

2 comments on commit f649b5b

@danielo515
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What the new set definition does mean? IT can be used to set a tiddler to an specific value and.... maybe fields of certain tiddlers?

@Jermolene
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @danielo515 there was a problem whereby the set field could only be set to the title of a tiddler. Now it can be a full TextReference, including a !!fieldname.

Please sign in to comment.