Commit graph

32 commits

Author SHA1 Message Date
James D. Forrester 017fa53e65 Add a url type for URLs
Bug: T54880
Change-Id: I722fcbc957825c2aaea32d9350480d29a388bb68
2015-09-30 22:15:19 +00:00
James D. Forrester 62d3138216 Add a wiki-template-name type for template names
Bug: T88900
Change-Id: Ia1c87072f453df4b756de6725c4b3ab1dda84497
2015-09-17 12:28:11 -07:00
Ed Sanders 9f96761044 Dialog: Use a 'done' button on edit param page instead of 'back'
'Back' suggests that changes in the form won't be saved.

Change-Id: I0df0887caa6317393a3a891dd292aa4dc54cc32b
2015-09-14 12:25:22 +01:00
Timo Tijhof 65b101e60c Add example property to HTML rendering
Follows-up ec0467c65a.

Bug: T53049
Change-Id: I07dd73b7e2ba0994f29e1b9e619c5cbf347d4d9d
2015-04-28 16:48:13 +01:00
Moriel Schottlender ec0467c65a Add an example property to parameters
The example is optional and can be translated.

Bug: T53049
Change-Id: I9e2d66a805e25409532a742521886233ce3de569
2015-04-09 19:23:42 +01:00
Moriel Schottlender ff77f32e38 [BREAKING CHANGE] Change "default" property to InterfaceText
Default should be InterfaceText and support languages.

Bug: T54966
Change-Id: I7be3a8be72df3e5d80300bd72fcd7197e43155aa
2015-04-02 08:53:51 +01:00
Purodha 4c8673bbdb TemplateData: add PLURAL to message Templatedata-modal-notice-import-numparams
See
https://translatewiki.net/wiki/Thread:Support/About_MediaWiki:Templatedata-modal-errormsg-import-paramsalreadyexist/en

Change-Id: Ife5e9d0afd9320271c8921162487f8c0338f24cd
2015-03-26 21:39:29 +00:00
Purodha 6f9f9bb914 TemplateData: use consistent quotes
See
https://translatewiki.net/wiki/Thread:Support/About_MediaWiki:Templatedata-exists-on-related-page/en

Change-Id: I3917bb59e481175314f3af4557784c1681e56dca
2015-03-24 08:35:07 +00:00
Amir E. Aharoni b7d232ca72 Extra credits in en.json and qqq.json
Change-Id: I84a84cc9d00bf5cac6641fb39cfb76cf0d63c80b
2015-03-20 00:00:41 +02:00
Amir E. Aharoni ca53d523ab Remove extra 'or's from an English message
Change-Id: I09e358afbc2dd3bde277425e44e08186fd3f1fa9
2015-03-19 23:57:24 +02:00
Moriel Schottlender 3820295f23 Reorganize api calls and add sourceHandler and error message
Add a sourceHandler that deals with all source-related actions
like fetching template source and validating the existing
TemplateData string.

Also add a MessageDialog warning the user in case the TemplateData
is invalid. In this case, the user will be given the option either
to correct the JSON by hand or to start the editor to replace the
existing TemplateData with a new one.

Bug: T91730
Bug: T91325
Change-Id: I4e6d04f02565a02d8dcf5c70a575ab6433caa27f
2015-03-18 18:21:02 +00:00
Moriel Schottlender ffbc8e1520 TDG: Support optional text of 'deprecated' property
The deprecated property allows for either a boolean or text, so we
should allow the user to insert guidance text in case that property
is true. To achieve that, the model also defines 'textValue' for
boolean properties with text representation so an internal property can
be set to hold that value and inputs can be automatically built from the
property structure.

Bug: T90734
Change-Id: Iadc6abdcc0cf2721a311cf43847b306cb269b5e8
2015-03-11 17:08:26 +00:00
Moriel Schottlender d59d517339 Warn if a TemplateData block already exists in related page
Check if there already is a TemplateData block in a related
page and warn the user if that is the case. Related pages are
either the /doc page or, if we are already in a /doc page, its
immediate parent.

Bug: T74062
Change-Id: I83212f14ecd2dcc18970d21ad0d833b461405390
2015-02-18 17:56:13 -08:00
Moriel Schottlender 4757a83f88 Display a message when no parameters are defined
If no parameters are defined in the TemplateData, have the table
display a specific message noting that.

Bug: T53429
Change-Id: I3c9ae31ef9eafab7f94325fcd58e14a3e45c9818
2015-02-18 17:43:16 -08:00
Moriel Schottlender b3877b327d Allow adding a deleted parameter in the templatedata dialog
If a user adds a parameter that was previously deleted, the
parameter properties will be completely emptied, and the parameter
will be added as if it is new.

Bug: T86916
Change-Id: Ib739ee09229750f94314636d4290dbe6662b4c0f
2015-01-28 18:50:43 -08:00
Moriel Schottlender d212901649 Add param order drag/drop widget to TemplateData dialog
Make sure the parameter order is editable with the drag/drop widget.

Change-Id: I35079907b2ed9f5ecdcd438dd69ed9892ce3e428
2015-01-23 19:02:56 +00:00
Moriel Schottlender ee56d518fb Add deprecated switch to the editor
The 'deprecated' boolean property was missing from the templatedata
edit dialog.

Change-Id: Ib05e832d8fc91896816b3f8b22f7678dacb245cd
2015-01-16 11:00:27 -08:00
Moriel Schottlender df59f0179a Eventify TemplateDataGenerator and use oojs-ui
Change the ui/data behavior to work with oojs and event emitters,
and replace the gui from jquery ui to oojs-ui.

Changes made:
* Recreate the templatedata editor with oojs and ooui.
* Create a standalone templatedata model with internal validation.
* Allow the user to insert language-specific strings:
  * Allow adding arbitrary languages and values
  * Normalize output between language object and 'simple' string
  * Add new language code by searching for its name or code
* Import parameters from template code
  * If the template is in subpage and there is no code in the
    current page, the code will request the contents of the parent
    page.

Change-Id: I985ea03dfee58984ec22ec9a157a00968bfca878
2014-12-22 12:58:37 -05:00
Marielle Volz d6cac31082 Implement new "maps" property in Root
Add "maps" as an allowed root value to template data JSON.

Maps allow applications to map equivalencies between their
application-specific parameters and valid template parameters.

Each Map has arbitrary keys (from the consuming application) that
are mapped to one or more template parameters.

* Added root.maps to TemplateDataBlob
  * Validates that values are strings or arrays
  * Validates that values are valid params
* Added templatedata-invalid-param to i18n/en.json
  * Richer error message for when invalid value is a param
* Fixed existing tests to work with new "maps" property
* Added two new tests for maps
  * Test for invalid value (!string or !array)
  * Test for invalid parameter
* Added specification for root.maps property and Map object

Change-Id: I3bf5e002ad6c1632e02c4c2e393b244c51f77177
2014-11-08 20:29:51 +00:00
Brad Jorsch a9ac3e201f Add i18n for API module help
MediaWiki core change I04b1a384 added support for i18n of API module
help. This takes advantage of that while still maintaining backwards
compatibility with earlier versions of MediaWiki.

Once support for MediaWiki before 1.25 is dropped, the methods marked
deprecated in this patch may be removed.

Change-Id: I67395aff48185f3e09da31b51a08aa2541fe6a17
2014-10-29 14:59:23 -07:00
James D. Forrester f7706868f3 Let help link target be locally over-ridden; default to the MW help page
Bug: 67621
Change-Id: Ic205a8bd51516d3fa580955b310014e4fe30ec6d
2014-09-25 11:05:39 -07:00
James D. Forrester 41e8f193ac Re-label "Manage template documentation" to "Manage TemplateData"
Bug: 63389
Change-Id: I49c2f78376918ba3ad59afcb943fc7df67e627f7
2014-09-25 11:00:51 -07:00
Moriel Schottlender 4f3e647758 Implement new 'autovalue' parameter property
Add an 'autovalue' parameter property to the TemplateData spec. And
implement it in the validation for the API and in the editor.

Also added tests to make sure all parameter attributes preserve
their values before and after parsing, including the 'autovalue'
parameter.

Bug: 51428
Change-Id: Iffb376a804d39388d2b5b6ea3583ef2a292eea41
2014-09-19 16:36:29 -07:00
James D. Forrester 4b27cb0642 Sort i18n files alphabetically for better diffs in future
Change-Id: Idbdfd19e8b41129d40cb0c26dec8547e039715b4
2014-08-30 15:54:41 -07:00
Moriel Schottlender b313bbe485 Refactor TemplateData Editor
Refactor and rewrite the templatedata editor to make it more flexible and
adaptable to new types. Separating the model from the gui, and adding new and
improved unit tests.

Also added features:
* Map depracated param types into current types.
* Retrieve template code from top template page if we are in a subpage.
* Mark parameters that do not appear in the template code.
* Add parameter types and a more flexible way to add and adjust the types.
* Add a link to TemplateData documentation from the main edit page.
* Add support for paramOrder; order the parameters according to the given array.
* Make the template parameter table sortable so users can change the paraOrder.

Bug: 59745
Bug: 65951
Bug: 66920
Bug: 67310
Bug: 67621
Change-Id: I65a76c2b772ef76c5dbbe71dd433c881c097b202
2014-08-30 15:18:05 -07:00
Moriel Schottlender 9a7f8de499 Block object descriptions from edit
Some descriptions allow for language objects. For the moment, these
should be blocked for editing so the original JSON string won't be
corrupted. The current fix blocks any input that is not a string
or an expected array in aliases as uneditable.

Bug: 60089
Change-Id: I9b13e2f3cfd805d382564e270484557567932a0f
2014-06-04 17:37:02 -07:00
James D. Forrester 3f05967d94 Add 'date' type support for ISO 8601 date-times
Change-Id: Ida5b09fb763bef12f92cf687b5170b5f5b5840a2
2014-05-23 18:50:00 -07:00
James D. Forrester 759f0eef20 Add 'boolean' type support
Bug: 55331
Change-Id: I2508e3cc6e04f1eb382e6ec18c636bebdfccbf99
2014-05-20 20:40:05 +02:00
James D. Forrester fb34a07c02 Add a wiki-file-name type for file names
Bug: 52652
Change-Id: Ibe8d143abbb607eb71549536aaac6555528813cc
2014-04-28 13:21:53 -07:00
James D. Forrester 5293a6d3da Add 'suggested' status type for parameters
This is a status for parameters which are not 'required' but are recommended
to be high value, if not always used, by downstream template users. This
commit does not add GUI-related changes to address this, as the interface
probably needs moving from checkbox- to dropdown-based status setting given
that there are now four, rather than three, mutually-exclusive statuses.

Change-Id: I104976e76d5ad6d586d9c818418ba6e16af53506
2014-04-28 11:45:44 -07:00
James D. Forrester 4f01e7c8b0 Convert en.json back to having tabs, not spaces
Also, move spec.templatedata.json to spec.templatedata.txt, because it's
not now (and has never been) valid JSON and is triping json-lint, blocking
merge.

Change-Id: I46d6d91b71a054b4523639252d7e6a3a181d84e5
2014-04-24 15:53:46 -07:00
Siebrand Mazeland 255fc8225f Migrate to JSON i18n
Procedure per https://www.mediawiki.org/wiki/Manual:GenerateJsonI18n.php
with shim.

Change-Id: I6627353205c79a91da7615833ebfefe3316bff8d
2014-03-28 14:45:07 -07:00