From a18af9b76043bde29c13f5abb6018c27fbd05fc8 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Thu, 6 Nov 2014 17:45:03 +0000 Subject: [PATCH] Rename the action-setfield widget to action-setfields MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It makes more sense, and allows us to add a widget: `<$action-setfield $tiddler=“title” $name=“fieldname” $value=“fieldvalue”/>` --- ...action-setfield.js => action-setfields.js} | 18 ++++++++--------- ...ldWidget.tid => ActionSetFieldsWidget.tid} | 20 +++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) rename core/modules/widgets/{action-setfield.js => action-setfields.js} (67%) rename editions/prerelease/tiddlers/{ActionSetFieldWidget.tid => ActionSetFieldsWidget.tid} (61%) diff --git a/core/modules/widgets/action-setfield.js b/core/modules/widgets/action-setfields.js similarity index 67% rename from core/modules/widgets/action-setfield.js rename to core/modules/widgets/action-setfields.js index ce875bad4..23abb2a08 100644 --- a/core/modules/widgets/action-setfield.js +++ b/core/modules/widgets/action-setfields.js @@ -1,9 +1,9 @@ /*\ -title: $:/core/modules/widgets/action-setfield.js +title: $:/core/modules/widgets/action-setfields.js type: application/javascript module-type: widget -Action widget to set fields on a tiddler. +Action widget to set multiple fields on a tiddler. \*/ (function(){ @@ -14,19 +14,19 @@ Action widget to set fields on a tiddler. var Widget = require("$:/core/modules/widgets/widget.js").widget; -var SetFieldWidget = function(parseTreeNode,options) { +var SetFieldsWidget = function(parseTreeNode,options) { this.initialise(parseTreeNode,options); }; /* Inherit from the base widget class */ -SetFieldWidget.prototype = new Widget(); +SetFieldsWidget.prototype = new Widget(); /* Render this widget into the DOM */ -SetFieldWidget.prototype.render = function(parent,nextSibling) { +SetFieldsWidget.prototype.render = function(parent,nextSibling) { this.computeAttributes(); this.execute(); }; @@ -34,14 +34,14 @@ SetFieldWidget.prototype.render = function(parent,nextSibling) { /* Compute the internal state of the widget */ -SetFieldWidget.prototype.execute = function() { +SetFieldsWidget.prototype.execute = function() { this.actionTiddler = this.getAttribute("$tiddler",this.getVariable("currentTiddler")); }; /* Refresh the widget by ensuring our attributes are up to date */ -SetFieldWidget.prototype.refresh = function(changedTiddlers) { +SetFieldsWidget.prototype.refresh = function(changedTiddlers) { var changedAttributes = this.computeAttributes(); if(changedAttributes["$tiddler"]) { this.refreshSelf(); @@ -53,7 +53,7 @@ SetFieldWidget.prototype.refresh = function(changedTiddlers) { /* Invoke the action associated with this widget */ -SetFieldWidget.prototype.invokeAction = function(triggeringWidget,event) { +SetFieldsWidget.prototype.invokeAction = function(triggeringWidget,event) { var self = this; $tw.utils.each(this.attributes,function(attribute,name) { if(name.charAt(0) !== "$") { @@ -63,6 +63,6 @@ SetFieldWidget.prototype.invokeAction = function(triggeringWidget,event) { return true; // Action was invoked }; -exports["action-setfield"] = SetFieldWidget; +exports["action-setfields"] = SetFieldsWidget; })(); diff --git a/editions/prerelease/tiddlers/ActionSetFieldWidget.tid b/editions/prerelease/tiddlers/ActionSetFieldsWidget.tid similarity index 61% rename from editions/prerelease/tiddlers/ActionSetFieldWidget.tid rename to editions/prerelease/tiddlers/ActionSetFieldsWidget.tid index 6d0117085..449a3e029 100644 --- a/editions/prerelease/tiddlers/ActionSetFieldWidget.tid +++ b/editions/prerelease/tiddlers/ActionSetFieldsWidget.tid @@ -2,16 +2,16 @@ caption: action-setfield created: 20141025120850184 modified: 20141025120850184 tags: Widgets ActionWidgets -title: ActionSetFieldWidget +title: ActionSetFieldsWidget type: text/vnd.tiddlywiki ! Introduction -The ''action-setfield'' widget is an [[action widget|ActionWidgets]] that assigns values to the fields of a tiddler. ActionWidgets are used within triggering widgets such as the ButtonWidget. +The ''action-setfields'' widget is an [[action widget|ActionWidgets]] that assigns values to the fields of a tiddler. ActionWidgets are used within triggering widgets such as the ButtonWidget. ! Content and Attributes -The ''action-setfield'' widget is invisible. Any content within it is ignored. +The ''action-setfields'' widget is invisible. Any content within it is ignored. |!Attribute |!Description | |$tiddler |The title of the tiddler whose fields are to be modified (if not provided defaults to the [[WidgetVariable: currentTiddler]] | @@ -19,17 +19,17 @@ The ''action-setfield'' widget is invisible. Any content within it is ignored. ! Examples -Here is an example of a pair of buttons that open the control panel directly to specified tabs. They work by using ''action-setfield'' to set the state tiddler for the control panel tabs. +Here is an example of a pair of buttons that open the control panel directly to specified tabs. They work by using ''action-setfields'' to set the state tiddler for the control panel tabs. <$macrocall $name='wikitext-example-without-html' src='<$button> -<$action-setfield $tiddler="$:/state/tab-1749438307" text="$:/core/ui/ControlPanel/Appearance"/> +<$action-setfields $tiddler="$:/state/tab-1749438307" text="$:/core/ui/ControlPanel/Appearance"/> <$action-navigate $to="$:/ControlPanel"/> Go to Control Panel "Appearance" tab <$button> -<$action-setfield $tiddler="$:/state/tab-1749438307" text="$:/core/ui/ControlPanel/Settings"/> +<$action-setfields $tiddler="$:/state/tab-1749438307" text="$:/core/ui/ControlPanel/Settings"/> <$action-navigate $to="$:/ControlPanel"/> Go to Control Panel "Settings" tab '/> @@ -38,9 +38,9 @@ Here is an example of a button that assigns tags and fields to the tiddler Hello <$macrocall $name='wikitext-example-without-html' src='<$button> -<$action-setfield $tiddler="HelloThere" tags="NewTag [[Another New Tag]]" color="red"/> -<$action-setfield $tiddler="$:/state/popup/tiddler-info--1779055697" text="(568,1443,33,39)"/> -<$action-setfield $tiddler="$:/state/tab--1890574033" text="$:/core/ui/TiddlerInfo/Fields"/> +<$action-setfields $tiddler="HelloThere" tags="NewTag [[Another New Tag]]" color="red"/> +<$action-setfields $tiddler="$:/state/popup/tiddler-info--1779055697" text="(568,1443,33,39)"/> +<$action-setfields $tiddler="$:/state/tab--1890574033" text="$:/core/ui/TiddlerInfo/Fields"/> <$action-navigate $to="HelloThere"/> Modify ~HelloThere '/> @@ -49,7 +49,7 @@ Here is an example of a button that assigns tags and fields to the tiddler Hello <$macrocall $name='wikitext-example-without-html' src='<$button> -<$action-setfield $tiddler="HelloThere" tags="MoreTag [[Further More Tags]]" color="green"/> +<$action-setfields $tiddler="HelloThere" tags="MoreTag [[Further More Tags]]" color="green"/> <$action-sendmessage $message="tm-edit-tiddler" $param="HelloThere"/> Edit ~HelloThere '/>