Diferencia entre revisiones de «Widget:AddToTable»
De WikiEducator
(copy from en.WE) |
(added options for radio buttons, select fields, country, and flag columns) |
||
Línea 2: | Línea 2: | ||
$(function() { | $(function() { | ||
$.getScript("/skins/widgets/addToTable.js", function() { | $.getScript("/skins/widgets/addToTable.js", function() { | ||
− | window.weAddToTable('<!--{$tableid|escape:'quotes'}-->', {login: '<!--{$login|escape:'quotes'}-->', button: '<!--{$button|escape:'quotes'}-->', formtitle: '<!--{$formtitle|escape:'quotes'}-->', auto: '<!--{$auto|escape:'quotes'}-->', bottom: '<!--{$bottom|escape:'quotes'}-->'}); | + | window.weAddToTable('<!--{$tableid|escape:'quotes'}-->', {login: '<!--{$login|escape:'quotes'}-->', button: '<!--{$button|escape:'quotes'}-->', formtitle: '<!--{$formtitle|escape:'quotes'}-->', columns: '<!--{$columns|escape:'quotes'}-->', auto: '<!--{$auto|escape:'quotes'}-->', bottom: '<!--{$bottom|escape:'quotes'}-->'}); |
}); | }); | ||
}); /* ]]> */</script></includeonly><noinclude> | }); /* ]]> */</script></includeonly><noinclude> | ||
Línea 8: | Línea 8: | ||
*If not logged in, shows a link to the login page (which returns you to this page after login). | *If not logged in, shows a link to the login page (which returns you to this page after login). | ||
==Parameters== | ==Parameters== | ||
− | ;tableid: | + | ;tableid:HTML id of the table |
;login:text for the login link displayed if user is not logged in | ;login:text for the login link displayed if user is not logged in | ||
;button:legend for the button that pops up the form | ;button:legend for the button that pops up the form | ||
;formtitle:title of the popup form dialog | ;formtitle:title of the popup form dialog | ||
− | ;auto:get legends from headings (default: | + | ;columns:a semicolon separated list of descriptions for each column; each description contains an ampersand separated list of '''opt'''='''arg'''; items not specified fallback to the the older ''auto'' functionality, form labels are column headings and the presence of an '''*''' signals a textarea |
− | ;bottom:add to bottom of table (default: | + | :;label:label in the form |
+ | :;type:type of field | ||
+ | ::;text:one line text field | ||
+ | ::;textarea:multiline text area | ||
+ | ::;select:select from multiple options | ||
+ | ::;country:country selection dropdown | ||
+ | ::;flagc:country selection dropdown which inserts flag and country name | ||
+ | ::;flagcl:country selection dropdown which inserts flag and country name (which links to country page) | ||
+ | ::;radio:radio buttons for selecting limited option set | ||
+ | :;options:specify exclamation point separated options for a '''select''' field | ||
+ | :;note:short explanatory text for form element (displayed in small font) | ||
+ | :;summary=true:use the value of this column in the edit summary | ||
+ | ;auto:get legends and form types from headings (default: ''false'') if the heading contains a '''*''' the field is a '''textarea''', otherwise it is a text input | ||
+ | ;bottom:add to bottom of table (default: ''false'') | ||
+ | ==Example== | ||
+ | <nowiki> | ||
+ | </nowiki> | ||
+ | {|id="testtable" | ||
+ | !Column1 | ||
+ | !Column2 | ||
+ | !Column3 | ||
+ | |- | ||
+ | |} | ||
</noinclude> | </noinclude> |
Revisión de 23:10 10 ago 2014
- If logged in, display a button that pops up a form to add a row to the table specified by the id.
- If not logged in, shows a link to the login page (which returns you to this page after login).
Parameters
- tableid
- HTML id of the table
- login
- text for the login link displayed if user is not logged in
- button
- legend for the button that pops up the form
- formtitle
- title of the popup form dialog
- columns
- a semicolon separated list of descriptions for each column; each description contains an ampersand separated list of opt=arg; items not specified fallback to the the older auto functionality, form labels are column headings and the presence of an * signals a textarea
- label
- label in the form
- type
- type of field
- text
- one line text field
- textarea
- multiline text area
- select
- select from multiple options
- country
- country selection dropdown
- flagc
- country selection dropdown which inserts flag and country name
- flagcl
- country selection dropdown which inserts flag and country name (which links to country page)
- radio
- radio buttons for selecting limited option set
- options
- specify exclamation point separated options for a select field
- note
- short explanatory text for form element (displayed in small font)
- summary=true
- use the value of this column in the edit summary
- auto
- get legends and form types from headings (default: false) if the heading contains a * the field is a textarea, otherwise it is a text input
- bottom
- add to bottom of table (default: false)
Example
Column1 | Column2 | Column3 |
---|