Skip to content

Commit 3e97a79

Browse files
committed
Add examples for methods. Partial fix for #64
1 parent cec5d5f commit 3e97a79

File tree

11 files changed

+41
-39
lines changed

11 files changed

+41
-39
lines changed

entries/autocomplete.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
<xi:include href="../includes/widget-method-disable.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
148148
<xi:include href="../includes/widget-method-enable.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
149149
<xi:include href="../includes/widget-method-option.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
150-
<method name="search">
150+
<method name="search" example-params='""'>
151151
<desc>Triggers a <a href="#event-search"><code>search</code></a> event and invokes the data source if the event is not canceled. Can be used by a selectbox-like button to open the suggestions when clicked. When invoked with no parameters, the current input's value is used. Can be called with an empty string and <code>minLength: 0</code> to display all items.</desc>
152152
<argument name="value" type="String" optional="true">
153153
<desc></desc>

entries/datepicker.xml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@
253253
</options>
254254
<methods>
255255
<xi:include href="../includes/widget-method-destroy.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
256-
<method name="dialog">
256+
<method name="dialog" example-params='"10/12/2012"'>
257257
<desc>Opens the datepicker in a dialog box.</desc>
258258
<argument name="date">
259259
<desc>The initial date.</desc>
@@ -270,7 +270,7 @@
270270
<desc>The position of the top/left of the dialog as <code>[x, y]</code> or a <code>MouseEvent</code> that contains the coordinates. If not specified the dialog is centered on the screen.</desc>
271271
</argument>
272272
</method>
273-
<method name="isDisabled" return="Boolean">
273+
<method name="isDisabled" return="Boolean" example-return-var="isDisabled">
274274
<desc>Determine whether a date picker has been disabled.</desc>
275275
</method>
276276
<method name="hide">
@@ -282,13 +282,15 @@
282282
<method name="refresh">
283283
<desc>Redraw the date picker, after having made some external modifications.</desc>
284284
</method>
285-
<method name="getDate" return="Date">
285+
<method name="getDate" return="Date" example-return-var="currentDate">
286286
<desc>Returns the current date for the datepicker or <code>null</code> if no date has been selected.</desc>
287287
</method>
288-
<method name="setDate">
288+
<method name="setDate" example-params='"10/12/2012"'>
289289
<desc>Sets the date for the datepicker. The new date may be a <code>Date</code> object or a string in the current <a href="#option-dateFormat">date format</a> (e.g., <code>"01/26/2009"</code>), a number of days from today (e.g., <code>+7</code>) or a string of values and periods (<code>"y"</code> for years, <code>"m"</code> for months, <code>"w"</code> for weeks, <code>"d"</code> for days, e.g., <code>"+1m +7d"</code>), or <code>null</code> to clear the selected date.</desc>
290-
<argument name="date" type="Date">
290+
<argument name="date">
291291
<desc>The new date.</desc>
292+
<type name="String"/>
293+
<type name="Date"/>
292294
</argument>
293295
</method>
294296
<xi:include href="../includes/widget-method-option.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>

entries/dialog.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@
256256
<xi:include href="../includes/widget-method-destroy.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
257257
<xi:include href="../includes/widget-method-disable.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
258258
<xi:include href="../includes/widget-method-enable.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
259-
<method name="isOpen" return="Boolean">
259+
<method name="isOpen" return="Boolean" example-return-var="isOpen">
260260
<desc>Whether the dialog is currently open.</desc>
261261
</method>
262262
<method name="moveToTop">

entries/menu.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
<desc>What triggered the menu to collapse.</desc>
9393
</argument>
9494
</method>
95-
<method name="collapseAll">
95+
<method name="collapseAll" example-params='null, true'>
9696
<desc>
9797
Closes all open sub-menus.
9898
</desc>
@@ -110,27 +110,27 @@
110110
<desc>
111111
Opens the sub-menu below the currently active item, if one exists.
112112
</desc>
113-
<argument name="event" type="Event" optional="false">
113+
<argument name="event" type="Event" optional="true">
114114
<desc>What triggered the menu to expand.</desc>
115115
</argument>
116116
</method>
117-
<method name="focus">
117+
<method name="focus" example-params='null, menu.find( ".ui-menu-item:last" )'>
118118
<desc>
119119
Activates a particular menu item, begins opening any sub-menu if present and triggers the menu's <a href="#event-focus"><code>focus</code></a> event.
120120
</desc>
121-
<argument name="event" type="Event" optional="false">
121+
<argument name="event" type="Event" optional="true">
122122
<desc>What triggered the menu item to gain focus.</desc>
123123
</argument>
124-
<argument name="item" type="jQuery" optional="false">
124+
<argument name="item" type="jQuery">
125125
<desc>The menu item to focus/activate.</desc>
126126
</argument>
127127
</method>
128-
<method name="isFirstItem">
128+
<method name="isFirstItem" example-return-var="firstItem">
129129
<desc>
130130
Returns a boolean value stating whether or not the currently active item is the first item in the menu.
131131
</desc>
132132
</method>
133-
<method name="isLastItem">
133+
<method name="isLastItem" example-return-var="lastItem">
134134
<desc>
135135
Returns a boolean value stating whether or not the currently active item is the last item in the menu.
136136
</desc>

entries/progressbar.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@
3939
<xi:include href="../includes/widget-method-option.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
4040
<method name="value">
4141
<desc>Gets or sets the current value of the progressbar.</desc>
42-
<signature return="Number">
42+
<signature return="Number" example-return-var="progressSoFar">
4343
<desc>Gets the current value of the progressbar.</desc>
4444
</signature>
45-
<signature>
45+
<signature example-params='50'>
4646
<desc>Sets the current value of the progressbar.</desc>
4747
<argument name="value" type="Number">
4848
<desc>The value to set.</desc>

entries/slider.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@
112112
<xi:include href="../includes/widget-method-option.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
113113
<method name="value">
114114
<desc>Get or set the value of the slider.</desc>
115-
<signature return="Number">
115+
<signature return="Number" example-return-var="selection">
116116
<desc>Get the value of the slider.</desc>
117117
</signature>
118-
<signature>
118+
<signature example-params="55">
119119
<desc>Set the value of the slider.</desc>
120120
<argument name="value" type="Number">
121121
<desc>The value to set.</desc>
@@ -124,16 +124,16 @@
124124
</method>
125125
<method name="values">
126126
<desc>Get or set the handle value(s).</desc>
127-
<signature return="Array">
127+
<signature return="Array" example-return-var="values">
128128
<desc>Get the value for all handles.</desc>
129129
</signature>
130-
<signature return="Number">
130+
<signature return="Number" example-return-var="value" example-params="0">
131131
<desc>Get the value for the specified handle.</desc>
132132
<argument name="index" type="Integer">
133133
<desc>The zero-based index of the handle.</desc>
134134
</argument>
135135
</signature>
136-
<signature>
136+
<signature example-params="0, 55">
137137
<desc>Set the value for the specified handle.</desc>
138138
<argument name="index" type="Integer">
139139
<desc>The zero-based index of the handle.</desc>
@@ -142,7 +142,7 @@
142142
<desc>The value to set.</desc>
143143
</argument>
144144
</signature>
145-
<signature>
145+
<signature example-params="[ 55, 105 ]">
146146
<desc>Set the value for all handles.</desc>
147147
<argument name="values" type="Array">
148148
<desc>The values to set.</desc>

entries/sortable.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@
432432
<method name="refreshPositions">
433433
<desc>Refresh the cached positions of the sortable items. Calling this method refreshes the cached item positions of all sortables.</desc>
434434
</method>
435-
<method name="serialize">
435+
<method name="serialize" return="String" example-return-var="sorted" example-params='{ key: "sort" }'>
436436
<desc>
437437
<p>Serializes the sortable's item <code>id</code>s into a form/ajax submittable string. Calling this method produces a hash that can be appended to any url to easily submit a new item order back to the server.</p>
438438

@@ -442,18 +442,18 @@
442442
</desc>
443443
<argument name="options" type="Object">
444444
<desc>Options to customize the serialization.</desc>
445-
<property name="key" type="String">
445+
<property name="key" type="String" default="the part of the attribute in front of the separator">
446446
<desc>Replaces <code>part1[]</code> with the specified value.</desc>
447447
</property>
448-
<property name="attribute" type="String">
448+
<property name="attribute" type="String" default='"id"'>
449449
<desc>The name of the attribute to use for the values.</desc>
450450
</property>
451-
<property name="expression" type="RegExp">
451+
<property name="expression" type="RegExp" default="/(.+)[-=_](.+)/">
452452
<desc>A regular expression used to split the attribute value into key and value parts.</desc>
453453
</property>
454454
</argument>
455455
</method>
456-
<method name="toArray">
456+
<method name="toArray" return="Array" example-return-var="sortedIDs">
457457
<desc>Serializes the sortable's item id's into an array of string.</desc>
458458
</method>
459459
<xi:include href="../includes/widget-method-widget.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>

entries/spinner.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
<desc>Number of pages to decrement, defaults to 1.</desc>
9191
</argument>
9292
</method>
93-
<method name="pageUp">
93+
<method name="pageUp" example-params='10'>
9494
<desc>
9595
Increments the value by the specified number of pages, as defined by the <a href="#option-page"><code>page</code></a> option. Without the parameter, a single page is incremented.
9696
</desc>
@@ -107,7 +107,7 @@
107107
<desc>Number of steps to decrement, defaults to 1.</desc>
108108
</argument>
109109
</method>
110-
<method name="stepUp">
110+
<method name="stepUp" example-params='5'>
111111
<desc>
112112
Increments the value by the specified number of steps. Without the parameter, a single step is incremented.
113113
<p>If the resulting value is above the max, below the min, or reuslts in a step mismatch, the value will be adjusted to the closest valid value.</p>
@@ -120,10 +120,10 @@
120120
<desc>
121121
Gets or sets the current value as a number.
122122
</desc>
123-
<signature return="Number">
123+
<signature return="Number" example-return-var="value">
124124
<desc>Gets the current value as a number. The value is parsed based on the <a href="#option-numberFormat"><code>numberFormat</code></a> and <a href="#option-culture"><code>culture</code></a> options.</desc>
125125
</signature>
126-
<signature>
126+
<signature example-params='50'>
127127
<argument name="value">
128128
<desc>The value to set. If passed as a string, the value is parsed based on the <a href="#option-numberFormat"><code>numberFormat</code></a> and <a href="#option-culture"><code>culture</code></a> options.</desc>
129129
<type name="Number"/>

entries/tabs.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156
<signature>
157157
<desc>Disables all tabs.</desc>
158158
</signature>
159-
<signature>
159+
<signature example-params='1'>
160160
<desc>
161161
Disables a tab. The selected tab cannot be disabled. To disable more than one tab at once, set the <a href="#option-disabled"><code>disabled</code></a> option: <code>$( "#tabs" ).tabs( "option", "disabled", [ 1, 2, 3 ] )</code>.
162162
</desc>
@@ -175,7 +175,7 @@
175175
<signature>
176176
<desc>Enables all tabs.</desc>
177177
</signature>
178-
<signature>
178+
<signature example-params='1'>
179179
<desc>Enables a tab. To enable more than one tab at once reset the disabled property like: <code>$( "#example" ).tabs( "option", "disabled", [] );</code>.</desc>
180180
<argument name="index">
181181
<desc>Which tab to enable.</desc>
@@ -188,7 +188,7 @@
188188
</argument>
189189
</signature>
190190
</method>
191-
<method name="load">
191+
<method name="load" example-params='1'>
192192
<desc>Loads the panel content of a remote tab.</desc>
193193
<argument name="index">
194194
<desc>Which tab to load.</desc>

includes/widget-method-option.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
<desc>
44
Sets one or more options for the <placeholder name="name"/>.
55
</desc>
6-
<signature return="Object">
6+
<signature return="Object" example-return-var="isDisabled" example-params='"disabled"'>
77
<desc>Gets the value currently associated with the specified <code>optionName</code>.</desc>
88
<argument name="optionName" type="String">
99
<desc>The name of the option to get.</desc>
1010
</argument>
1111
</signature>
12-
<signature return="PlainObject">
12+
<signature return="PlainObject" example-return-var="options">
1313
<desc>Gets an object containing key/value pairs representing the current <placeholder name="name"/> options hash.</desc>
1414
</signature>
15-
<signature>
15+
<signature example-params='"disabled", true'>
1616
<desc>Sets the value of the <placeholder name="name"/> option associated with the specified <code>optionName</code>.</desc>
1717
<argument name="optionName" type="String">
1818
<desc>The name of the option to set.</desc>
@@ -21,7 +21,7 @@
2121
<desc>A value to set for the option.</desc>
2222
</argument>
2323
</signature>
24-
<signature>
24+
<signature example-params="{ disabled: true }">
2525
<desc>Sets one or more options for the <placeholder name="name"/>.</desc>
2626
<argument name="options" type="Object">
2727
<desc>A map of option-value pairs to set.</desc>

includes/widget-method-widget.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
2-
<method name="widget" return="jQuery">
2+
<method name="widget" return="jQuery" example-return-var="widget">
33
<desc>
44
Returns a <code>jQuery</code> object containing the <placeholder name="widget-element"/>.
55
</desc>

0 commit comments

Comments
 (0)