Commit graph

15 commits

Author SHA1 Message Date
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 4141bed38b Prevent a dependent property from updating on infinite loops
A dependent and dependee properties should only update one another
once in the model, and the UI should be responsible for resetting
the input when it is toggled.

Bug: T92558
Change-Id: I944aaf9c44d0f305a34458f0b8009a98c9570661
2015-03-12 14:01:38 -07: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
Timo Tijhof 3ecbaefef1 Document code with JSDuck
Change-Id: Ieb812a2fb85135f6db18a9a02c94efd83695a19e
2015-03-06 17:56:30 -08:00
Moriel Schottlender 9b3cf2b971 Delete boolean values if they are false
For values like 'deprecated', 'suggested' and 'required' make sure
that if they are marked as 'false' they are deleted from the result
string. If the original TemplateData already had either one of
those parameters marked as false don't delete so to avoid dirty
diffs.

Bug: T90283
Change-Id: I34c81d45e3967ce5398691d97d1a15908b8a2e57
2015-02-25 16:26:32 -08:00
Timo Tijhof 796e7b1a76 Correct jsduck documentation tags casing
Change-Id: Ic438492ea4e7060c3c5626ae9b5493f70cfb578e
2015-02-21 17:05:40 +00:00
jenkins-bot ca94adc3a9 Merge "Allow adding a new parameter again" 2015-02-19 02:10:11 +00:00
Moriel Schottlender c525aef5b0 Allow adding a new parameter again
Due to a bug, new parameters could not be added unless they were
previously deleted. This commit fixes that bug.

Change-Id: I3784d1b3d650893f26abb63994d13c08b148075b
2015-02-19 02:02:15 +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 e6e728b58e Change global class variables to mw.TemplateData
Nest all classes for the templatedata dialog in mw.TemplateData
namespace.

Change-Id: Ib514378c9fbc0fb993b3cbc2fa48ced920167226
2015-02-18 17:47:08 -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 16cca5b1a2 Trim aliases on save
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
2015-01-12 15:29:38 -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