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
Make sure that every time the dialog is open, the paramOrder
widget is emptied so it can be refilled fresh from the model.
Bug: T88126
Change-Id: I628c66710cb1f2f77385b16c627585350f357c45
Change the current hacky layout to the proper ActionFieldLayout,
and also make sure that when the user adds a language, the new
language is selected.
Change-Id: I737a1dcfc08bd47829661daf3c08e2e480670842
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
The type in the templatedata editor didn't update because the events
were attached to the previous ooui SelectWidget, and should be
adjusted to use the new methods.
Bug: T86922
Change-Id: I619d1cc69f672d2d03d7dafa97ba3d950de9d89d
Make sure that aliases get trimmed and are not getting extra spaces
when saving a parameter.
NOTE: To prevent dirty diffs, only parameters that are 'touched'
(viewed or edited directly in the editor) will be trimmed. The editor
will keep all other "wrong" values that have trailing or preceding
whitespaces as-is.
Bug: T85330
Change-Id: I64ecb88a7d736fa36b5e6debf2e94b0d37152020
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
The noinclude tags should appear only if the page is not a subpage
and only around the <templatedata> tags.
Change-Id: I492bb35c8f2c70235f3ceefdddcc4df6548d7469
If the template is not in a subpage, all new <templatedata> strings
will be wrapped with <noinclude>.
This will not happen to existing <templatedata> strings, since there
is no way of knowing if existing strings are already inside a
<noinclude> chunk - especially if those tags also include a bit of
other text. This will be applied for all new templatedata tags that
are inserted in the main template page.
Bug: 69149
Change-Id: I083a76858513760910973cd788687822fda0e879
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
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
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
There was a pre-existing jshint config (.jshintrc) file that this upgrades based
on the equivalent files for VisualEditor and OOjs UI.
Change-Id: I3ecb0e65cc7ff090b7457be895917fbd8b8afd18
The 'required' property of a 'Param' is optional and defaults to false.
Thus there is no reason for adding it when it was not set and the user wants it to be false.
Bug: 61761
Change-Id: I2b2fae5d2d8b1dac2ad2e1a965d9ba5bd7372eef
The invalid characters ('|', '=', and '}}') will be displayed through
individual parameters, for consistency, and to avoid parsing problems
in translatewiki.
Change-Id: Ic87541419aab5664f3530209e1ad8689deec33a5
Translatewiki warns of an unbalanced parenthesis problem in the
translation string. Turning the {{ into a parameter solves this issue.
Change-Id: I2fd69b3e901175dad22d285aa2373916acd4f208
This adds a TemplateData manager to the edit page in the Template
namespace.
If a <templatedata> tag already exists, the tool will parse it and
display it in a visual interface that the user can then manipulate in
their own language. If there is no <templatedata> tag, the dialog will
appear empty and allow users to add and tweak their desired template
parameter data.
The tool also allows rudimentary parameter import, which picks up the
parameters from a current template into the GUI to make the user's life
easier when producing TemplateData.
The template documentation editor feature is off by default. To enable it
use $wgTemplateDataUseGUI = true in LocalSettings.
Bug: 50436
Change-Id: I863a8199c0b08cc52b320ed00dcba912dd2aeefc