Commit graph

272 commits

Author SHA1 Message Date
Ed Sanders 2d55fa64b1 Use a MessageWidget for the sub-page warning
Change-Id: I8b2878a9a817d14d3a4542a083e98a9f70cfde8d
2020-10-04 14:05:26 +01:00
Thiemo Kreuz de434822b4 Fix all eslint warnings
Change-Id: I731ea4a54b001a8d30743ca32188edb1c039253e
2020-09-24 13:31:18 +01:00
Thiemo Kreuz f6de5d3493 Fix parameter extraction from wikitext source
This fixes a series of issues:
* The JS implementation had a trim() in one place that was
  missing in PHP.
* The actual parameter name in the paramNames/$params array was
  trimmed, but the "normalized" name (this is only for duplicate
  detection) was not trimmed.
* It was possible for an empty parameter to show up.

This resulted in very strange behavior, e.g. {{{ 1}}}{{{1 }}}
was detected as "1" and "10" (?), i.e. it would try to renumber
the duplicate in a strange way (string "1" plus a counter that
starts with 0).

Change-Id: I0a6371f3633b03b5b21809ecd06ea4c72d7d914d
2020-09-22 18:27:23 +02:00
Thiemo Kreuz fa7d16a373 Update a few confusing variable names in editor code
Change-Id: I8e7bc84539e62784059e0a43ca3de48c31abe6cf
2020-09-18 15:50:51 +02:00
Thiemo Kreuz 47e8249349 More canonical property order in mw.TemplateData.Model class
This does not have any effect on how this code behaves. It's
only relevant when a human reads the code. I tried to bring the
properties in an order that makes the most sense, grouping stuff
that clearly belongs together, as well as following how stuff is
ordered on
https://www.mediawiki.org/wiki/Extension:TemplateData

Change-Id: Ibbe1027023f8d87bbd0a70411882a25671918670
2020-09-01 09:10:34 +00:00
jenkins-bot c42a4afede Merge "Allow different maps to be edited separately" 2020-08-30 16:14:59 +00:00
Khatean 76cf63dad2 Allow different maps to be edited separately
Seperate different maps of maps-object into different panels that
contains text-area to edit the map, delete button to delete the map, and
can be navigated through using a side-bar, that also have "Add new map"
button at the top to add a new map.

Bug: T258820
Change-Id: Ib53a73203f6010b3fd8a5cd78c74c904be2340f2
2020-08-28 20:18:27 +02:00
Thiemo Kreuz 4853c2ae3a Remove unused "changesBooleanValue" property
Not used anywhere:
https://codesearch.wmcloud.org/search/?q=changesBooleanValue

Change-Id: I40f08f4d7164dbcb7bef58bb647607573f852f15
2020-08-25 14:18:54 +02:00
Thiemo Kreuz a5fe1bfbb9 Move "Unknown" type to the top of the dropdown
"Unknown" is the special, default value when nothing else is
specified. It feels wrong to find this in alphabetical order
between all the other values, as if "Unknown" is something I'm
expected to pick. While this is possible, it's almost never
necessary. "Unknown" is the default anyway. If I'm fine with
that, I never change it. But if I want to pick something else,
I typically expect the list to show the "nothing selected yet"
default first so I can easily avoid it.

Change-Id: I283a1b0545efba208af777a0b2056740263dfc32
2020-08-19 17:30:05 +02:00
Siddharth VP 512911b92e Make getRawParams() ignore parameters in comments and nowiki tags
This is used by the includeMissingTitles option of API action=templatedata.
Parameter syntax existing within nowiki tags or comments will not be valid
for the template.

Bug: T237195
Change-Id: Ibbfa3e21488f2a37fc494862e929baf50607d4c9
2020-08-17 00:33:06 +00:00
Ed Sanders 71b27ed1ba Set import button to display:block, fixing text overflow
Bug: T259348
Change-Id: Ibbe2ccef8062275a20200445279033e084ca12aa
2020-07-31 14:19:43 +01:00
adham-khatean c4ca729ed5 Make the maps object editable from the TemplateData dialog
- Enable multiline.
- Enable updating the model with user changes if user clicks "Done".
- Disable "Done" button if the user inserts invalid JSON to handle JSON errors the
user might cause, and "Done" is enabled again if the JSON is valid.
- Create "cancel" button/action which will be for maps panel only, to
discard all changes made by the user.

Bug: T257503
Change-Id: Icd495290bae0b1684f8cd53864904a35e60fffe7
2020-07-24 16:07:04 +02:00
jenkins-bot 821c3b5af2 Merge "Create initial UI for maps panel in TemplateData GUI" 2020-07-09 19:12:27 +00:00
adham-khatean e719555d30 Create initial UI for maps panel in TemplateData GUI
Adding maps object to TemplateData GUI. By adding mapPanelButton to the
main panel and creating the map panel which contains multiline input
widget to show and insert the map info.

Bug: T254478
Change-Id: Iacff86812cbc448fcdbae24e7eeffb0384781dd5
2020-07-09 19:13:29 +02:00
Ed Sanders bf67ec6d52 build: Update eslint-config-wikimedia to 0.16.2
Change-Id: Ib53aa55795f228768a6226eebfdb5734d8a976d1
2020-07-08 13:08:35 +01:00
Thalia 8361c80307 Disable TemplateData dialog 'apply' action until changes are made
Change-Id: I890de938654ea598d3f7af2ea7f69e11188bbab4
2020-03-30 23:39:26 +01:00
adham-khatean 1bf9e95bb6 Fix borders for alias pills in TemplateData editor
fixing the problem of top and bottom borders for the alias pills in the
TemplateData editor are cut off, by setting the padding of the
class "tdg-templateDataParamWidget-param-aliases" to 1px

Bug: T248486
Change-Id: Ic66cda0be840fb3be966c2efa89062b7b9f117a3
2020-03-30 15:53:08 +02:00
Timo Tijhof 53f4783ffd Organise resource files in directories after their module bundles
* I've moved the one remaining file in resources/ to modules/.
  The repo had both resources/ and modules/.

* Class files are named after their class.

* Files with init logic on a page are named init.js.

* Files that only export re-usable classes for another module,
  are named index.js.

Bug: T193826
Depends-On: If661c68bea069e99cfff35711efdde7805a12851
Change-Id: Ic8975d7ba349ba50f9039545d2eb8d912ccdce26
2020-03-15 15:21:39 +00:00
Bartosz Dziewoński 2a137a2377 Ensure cancel confirmation dialog is visible on top of main dialog
Bug: T241819
Change-Id: I7764ad13acd52779e4f4ae853c05c795a80dc870
2020-01-03 12:57:30 +01:00
Ed Sanders 2db15c75a1 build: Update linters
Change-Id: Ie5cd0d355017eb802d0b302a69248886409fcbf9
2019-12-18 11:43:42 +00:00
Bartosz Dziewoński 2b8e39a278 templateDataGenerator: Fix off-by-one error when inserting new tag
There should not be a `- 1` here. It was kept in the refactoring in
34924e0a0b, but it should have been removed.

Also simplify the entire expression to just `matches.index`, which is
equivalent and easier to understand. We already use `matches.index` above.

Bug: T239445
Change-Id: I9cbeaabd50fb595c0ff622b86ce3870285e5b7c8
2019-11-28 21:39:32 +01:00
Ed Sanders cc8b0b5e2f Set back/close flags on dialog
Change-Id: I4a687495327b37ba96809cc927f1d9020ef797e8
2019-07-11 14:46:30 +01:00
David Lynch f3566cece2 tdDialog: handle name/alias swaps
If you changed the name to one of its own aliases, then went into the
alias field to remove that alias, the "Done" button would remain
disabled for no obvious reason. As such, rerun the name change handler.

Also, the input error-highlight was too low specificity for current OOUI
CSS, and so we weren't showing which field had an issue.

Bug: T222543
Change-Id: I49ac0587c4b5e58ce1fc3c42e3dffeae8f986672
2019-05-08 11:25:36 -05:00
Ed Sanders 6671a09959 build: Update eslint-config-wikimedia to 0.11.0
Change-Id: Ia109737bc7a0828dfdad14e4e2163d2add0c651c
2019-03-13 16:33:25 -07:00
Ed Sanders 0111b68d18 Remove use of OOUI's deprecated this.$
Change-Id: I5fb530a98ceb98329ad65ad57d55e9c416d99d86
2019-02-15 19:23:19 +00:00
Ed Sanders 49d469b2d1 build: Update eslint-config-wikimedia to 0.10.1
Change-Id: Ia8baa12906d4f23fcdf07a0bb664b4a3435d18df
2019-02-10 22:14:11 +00:00
jenkins-bot 4221945fc9 Merge "Ignore bang magic word in table syntax when guessing parameters" 2018-12-10 23:55:08 +00:00
jenkins-bot d7145f1180 Merge "Update eslint-config-wikimedia to 0.9.0" 2018-11-30 21:28:32 +00:00
Ed Sanders 47c3c69baa Update eslint-config-wikimedia to 0.9.0
Also bump stylelint (no fixes required)

Change-Id: Ia6bd3a8c0392eafb939f9ff05827e1320f56b706
2018-11-29 14:19:33 +00:00
Ed Sanders e0cab02231 Use ve.deactivationComplete hook instead of ve.deactivate
We want to deprecate the latter.

Change-Id: Id1ae1049738220a86adb36cb3961592e3d8ca27c
2018-11-29 14:01:32 +00:00
Sam Wilson 75e54ae999 Ignore bang magic word in table syntax when guessing parameters
Three-braces-and-a-bang can be a table starting construct in templates.

This also fixes an overlooked bug in which the test wasn't checking
array element key names.

Bug: T157029
Change-Id: I69ed4fc9fe3bb126b7b39abea0f58ad56adf3885
2018-11-27 11:46:23 +08:00
Ed Sanders 822d0cd345 Rename module editPage→editTemplatePage, create minimal new editPage module
VisualEditorPluginModules loads whenever VE loads, so create a minimal
loader page to check if we are in the template namespace before loading
the rest of the TemplateData init code.

Bug: T208765
Change-Id: Id127eb4a2472a6ce9da7672f9237b182cf6be2eb
2018-11-24 00:14:03 +00:00
Ed Sanders 34924e0a0b Remove VETarget, use textSelection API
The textSelection API works with VE wikitext mode , so we
can use the same code for both editors.

Change-Id: I9032733b14d115bad8dcadefc50e791cf30eed7d
2018-11-14 14:53:42 +00:00
Bjornskjald 096d558272
Add stripping leading and trailing spaces from the "format" field
Bug: T177973
Change-Id: I5fc30479485da59b5ea097f97a2dfb7ec149918f
2018-11-01 22:55:40 +01:00
jenkins-bot 5ac1f53bde Merge "Replace deprecated 'advanced' by renamed to 'settings' icon" 2018-09-12 16:23:48 +00:00
Sam Wilson 79e5347d90 Prevent leading hash from starting param names when guessing
Parameter names can be constructed with parser functions, so
we should not include these as raw parameter names. There
might be more characters to add here.

Bug: T203605
Change-Id: If57a9ed7edf1e881cd121d9a1bcb2e7455c04ec9
2018-09-12 10:04:45 +08:00
Volker E 7da7b90b58 Replace deprecated 'advanced' by renamed to 'settings' icon
Bug: T190581
Change-Id: If509219d1b6404c66f2a3c942623e315f9b02e34
2018-09-07 20:05:46 -07:00
Seb35 db1fb276a0 Do not display editor on non-wikitext pages
The editor is displayed on 'Sanitized CSS' pages (template pages
ending with .css), it should not because it is not interpreted as
wikitext and tags are not recognised.

Change-Id: I58195de1ae54252d57e1cd912ee52801a093729e
2018-09-01 13:03:49 +02:00
Sam Wilson 27f4633224 Switch from $.inArray to array.indexOf
In response to https://gerrit.wikimedia.org/r/c/mediawiki/extensions/TemplateData/+/455486/2/modules/ext.templateDataGenerator.sourceHandler.js#175

Bug: T193265
Change-Id: Iffc1bb4c25dfe066db9955dbf7ebb183261e9827
2018-08-28 09:08:36 +08:00
Sam Wilson bc1422b788 Ignore subsequent similarly-named parameters when extracting
When extracting raw parameters from wikitext, ignore those that
only differ from already-found ones by spaces, underscores, or
hyphens.

Bug: T193265
Change-Id: I012e06bf4353eaaf0613124d7d6b88f3444d248a
2018-08-27 11:14:27 +08:00
Bartosz Dziewoński 2c114d099b Update icons for new 20px grid
Set viewBox to "2 2 20 20" to trim 2px off each side of our
existing 24px icons, therefore aligning them to the new 20px
grid. All of them had been drawn with large margins, so none
of the graphic is lost.

Bug: T177432
Change-Id: I5c49e976750a79e2e0fee389d1c8571faddfdf0e
2018-03-20 17:35:43 +00:00
Volker E 3cfe17ea37 Remove special font-size treatment following-up UI unified in 14px base
Removing `0.8em`/`12.8px` VE special base `font-size` for UI as we're unifying
OOUI interfaces to `14px` equals to `0.875em` at user agent default size.

Bug: T189920
Depends-on: I693d168d2ccf2babbcfe8952af3e1c262aa97773
Change-Id: Idf64b077d8e5ab5b1352052b72ac198816dcc07a
2018-03-20 16:55:41 +01:00
Ed Sanders 313a261f7c Make '/doc' subpage an MW message for local overrides
Bug: T125222
Change-Id: I48c666a1e313a56fd3be98d28edc24d200a35309
2018-02-16 18:16:33 +00:00
David Lynch f75b144129 Block duplicate parameter names when editing existing parameters
Previous behavior was to silently append a number to the name, which was hard
to notice. New parameters with duplicate names were already blocked.

Also, fix the disabling of the done button when there are errors.

Bug: T166520
Change-Id: I1d0c51a2aa8b8158874c98ac48fe257baeb1aee1
2018-02-07 11:09:47 -06:00
Ed Sanders b1d7ad8bc8 Use textSelection API to modify textarea
Bug: T73363
Change-Id: I411027236cbb3b349372a64ecbf670062758cfab
2018-01-26 10:32:03 -08:00
jenkins-bot e7b44663db Merge "Replace "getSelectedItem" with "findSelectedItem" for consistency" 2018-01-10 20:12:58 +00:00
zoranzoki21 6e33405482 Replace "getSelectedItem" with "findSelectedItem" for consistency
Bug: T184040
Change-Id: I469d0e0b9982ea5f5de35b514c76e817b1d8e9b5
2018-01-10 11:52:45 +00:00
Prateek Saxena 1e2c39bc0b Use findItemFromData instead getItemFromData
Depends-on: Ia2110f71d1642f61451cb8acc7e8a930d0feb31f
Bug: T76630
Change-Id: If93d7d85e05c57c65728a7b9dbc7f1c93c9953d8
2017-12-28 11:46:01 +05:30
Ed Sanders 798798d623 Update language search widget from VE
Change-Id: I1e1a32ba4a072d9216e0cb6ae97edb1bcf48f6d4
2017-10-03 16:28:30 +01:00
Ed Sanders 6c7d8a43c3 build: Update linters
Change-Id: Idb5705ef24c0731c47f33b310a9a3fb2fa5f2227
2017-10-03 16:23:24 +01:00
James D. Forrester 6a3a85b67e Replace constructive with progressive UI flag
Change-Id: Ia406001eb8bd30857f825b34971a7d7d7393bb01
2017-09-26 15:38:02 -04:00
Prateek Saxena 01c7867d8e Use findFirstSelectableitem instead of getFirstSelectableItem
Depends-on: Ic12be404eba490e5ce748f0d754a807e12f6ba76
Bug: T76630
Change-Id: Iba797c12bc4cd8ece93f44d67cd1aef36bd37a64
2017-09-06 15:45:52 +10:00
Prateek Saxena 5f40f91b01 Replace TextInputWidget (multiline) with MultilineTextInputWidget
Bug: T170275
Change-Id: I6010dd314e011c79330464c0e438ccf2f037a9bf
2017-07-17 11:24:26 +05:30
jenkins-bot 37973c1cd4 Merge "Fix font size of Manage TemplateData button" 2017-06-22 00:13:27 +00:00
Ed Sanders 6fa1082e21 Fix font size of Manage TemplateData button
Change-Id: I69fb993bf0f5df23c3b0ec12472460e239ff94ea
2017-06-21 23:40:30 +00:00
Ed Sanders 0ac10d79a5 Use correct name for message dialog
Bug: T168521
Change-Id: Iec58d7d6386e82df7f35609634df1fa569793e8a
2017-06-21 10:58:38 -07:00
Bartosz Dziewoński 00fc98db4f Update for deprecation of OOjs UI openWindow/closeWindow promise
Bug: T166729
Change-Id: I2ae5c13592539dd2a7cb98e0197ed2f891855d41
2017-06-06 20:40:40 +02:00
Ed Sanders a4e7fcdf32 Fix ,->; typo
Change-Id: Ic1742f33e90075bcb65ece900434fce8225a003c
2017-05-03 10:21:29 +01:00
Timo Tijhof ba3fe664d4 tests: Use assert.async() instead of QUnit.stop/start
* Remove use of undocumented 'this' inside promise callback,
  use the promise variable instead.
* Remove needless expectCount.

Change-Id: I3a698207440d8085a502fa54da8bb5feddfa1dcb
2017-04-13 13:09:03 -07:00
jenkins-bot a31aaedb88 Merge "Extend 'format' spec to include custom format strings." 2016-12-13 21:52:45 +00:00
jenkins-bot 9e721d2432 Merge "Add VE support" 2016-12-12 21:05:11 +00:00
jenkins-bot af8dedaf37 Merge "Follow-up I9ba06bb3a: Use separate window manager for dialog" 2016-12-07 00:39:17 +00:00
Ed Sanders e539f45589 Add VE support
Bug: T152230
Depends-On: Ic8b11d8052770e7c6550c98799893e9b640309ca
Change-Id: I91c045ef3e08eb7259d2861e65df521024199a53
2016-12-06 21:31:10 +00:00
Ed Sanders 4b0757b293 Follow-up I9ba06bb3a: Use separate window manager for dialog
The dialog wants to show a confirm dialog inside it, so we
need two separate managers.

Change-Id: Ib27b9348d73d1eeee5d353ad906fc33cc374ad66
2016-12-06 21:28:42 +00:00
jenkins-bot 48f9d52a5f Merge "Move icons to RL and generate inverted variants" 2016-12-06 20:53:09 +00:00
Ed Sanders e21a2563ce Move icons to RL and generate inverted variants
Also remove unused parameter icon.

Change-Id: I0ce10a50a0738ba111cfd63bc9cc5de03fae8c8d
2016-12-06 11:53:52 +00:00
Ed Sanders 94d0e73a6b Move all init code over to target
Change-Id: I9ba06bb3a57a7683e246461341c67462cab465d0
2016-12-05 17:02:38 +00:00
Ed Sanders a586d54e93 Abstract out editor manipulation form UI
Create target classes with get/setWikitext methods.

Also refactor some of the window manager code.

Bug: T152230
Change-Id: I7dcc137d79e029b69467ca282d8c52683e022598
2016-12-05 17:01:15 +00:00
Ed Sanders 6565ee4cf5 build: Replace jscs/jshint with eslint
Change-Id: Iff79501de8d80a860eebb4a6e31dc8fca3285505
2016-12-02 22:05:13 +00:00
C. Scott Ananian 5812413f11 Extend 'format' spec to include custom format strings.
Thanks to Thiemo Mättig for the suggestion and specification at
Wikimania 2016 in Esino Lario.

This is an extended version of Thiemo's original specification.  This
version also allows specification of "own line" properties for
templates; that is, whether the template should be preceded/followed
by a newline, as requested by James Forrester.

Bug: T138492
Bug: T135667
Change-Id: Idc6b2680330e6bf5caec2bf6fc86a705d25bc649
2016-09-01 14:14:47 -07:00
jenkins-bot 61360d69ec Merge "Make the help button a help link again" 2016-08-23 17:35:35 +00:00
David Lynch dbe26670af Make the help button a help link again
This gives it more visual indicators that it'll take you somewhere. Its
previous frameless-button appearance made it non-obvious that it was behaving
as a link.

Bug: T142484
Change-Id: I7732bf6db7ac63121d6ed1377c654ae8700895d1
2016-08-23 10:16:47 -05:00
jenkins-bot caef0269ac Merge "Fix renaming of parameters to another existing name" 2016-08-18 16:49:01 +00:00
jenkins-bot e6e6ae376c Merge "Fix renaming of parameters to the same name" 2016-08-18 16:47:45 +00:00
jenkins-bot 9e56136c0e Merge "Warn editors when they're adding blank TemplateData" 2016-08-17 16:47:11 +00:00
Alex Monk 05c83e5212 Fix renaming of parameters to another existing name
If the user tried to rename a parameter to "asd", but "asd" already existed,
we'd append "asd0", and the user would get "asdasd0". But what we actually
wanted to do was change it to "asd0".

Change-Id: I7fa05ed6fca54bc941e1843ebe6872a87383effb
2016-08-16 02:01:45 +01:00
Alex Monk aaa1841580 Fix renaming of parameters to the same name
Bug: T141574
Change-Id: Ifa26b5b215ec489415c47a0fbf72fbf2fcb3e09e
2016-08-16 02:01:27 +01:00
David Lynch 1564abd48d Dialog must listen for changes to the param names
Otherwise the second keystroke made while changing parameter names will cause
an error. I think this code previously assumed the change only happened once,
rather than on-keystroke.

Bug: T142889
Change-Id: I0e9c096a053667c51bbce74ee3ce1bd573ae7d49
2016-08-12 17:31:04 -07:00
Alex Monk 1de010108e Warn editors when they're adding blank TemplateData
Bug: T123207
Change-Id: I512ce01a0c7221e7636d26e546d1cbac5395b76b
2016-07-14 03:01:38 +01:00
Alex Monk 5fe2360d99 Move around parameter renaming logic to update paramOrder
Also make getNewValidParameterKey actually return (probably not necessary for
this commit but I discovered it in the process).

Bug: T138800
Change-Id: I94ec6729b98c126b609b747fe4ce04a5fc02f616
2016-06-29 13:41:04 +01:00
James D. Forrester c8f4e02651 build: Replace csslint with stylelint and bump others
Change-Id: I84a1b850073ffae51c1c35a4f371cbac23b0d94e
2016-05-20 13:14:59 +01:00
jenkins-bot dbd36a61d0 Merge "GUI data: Actually do something useful with the normalized type" 2016-04-08 19:29:41 +00:00
Alex Monk ba36cf6cfe GUI data: Actually do something useful with the normalized type
Nothing uses normalizedType

Bug: T131971
Change-Id: Ic3103a1d6022cc35602dc7f13b8762eac8af7f80
2016-04-08 19:48:48 +01:00
jenkins-bot 74f13b9914 Merge "GUI: Don't set format: null when outputting data" 2016-04-08 16:24:39 +00:00
Alex Monk 040c615165 GUI: Don't set format: null when outputting data
Bug: T131972
Change-Id: Ifa34049be9a04da9b5e6d95e22f3d393ebf562b6
2016-04-06 23:28:25 +01:00
Alex Monk 84b1ddf44c Localise names of types in HTML rendering
Reuses some messages, renaming them in the process.
Changes undefined on the client to unknown.

Bug: T61745
Change-Id: I2cf5c25acbe1c854c33b2eb3f23dc74393a456d4
2016-04-06 19:00:58 +00:00
James D. Forrester 9bb3c382f5 build: Bump devDependencies to latest and make pass
grunt-contrib-csslint   0.5.0  →  1.0.0
 grunt-contrib-jshint   0.11.3  →  1.0.0
 grunt-contrib-watch     0.6.1  →  1.0.0
 grunt-jscs              2.1.0  →  2.8.0

Change-Id: Ia6ca7c477b1c7ce8b3fc54994b1abf361c031eda
2016-03-24 08:54:20 -07:00
Bartosz Dziewoński 8e55adab59 [BREAKING CHANGE] Change default format to null instead of 'inline'
Don't enforce 'inline' as the default format if none is specified.
Instead preserve the unspecified value as 'null'. This allows
third-party tools to provide a better default experience when changing
existing content (e.g. by using smart detection to follow the format
already used).

Bug: T128337
Change-Id: I911c7999e3731c0125fc058118f8d7287d8f88f4
2016-03-01 22:53:27 +00:00
jenkins-bot 97f1b8797e Merge "Avoid calling repopulateParamSelectWidget multiple times on setup" 2016-02-25 20:52:19 +00:00
Ed Sanders 89f8b35018 Avoid calling repopulateParamSelectWidget multiple times on setup
Change-Id: I05ce3d8ff1109980248a0c2389298591f9b54553
2016-02-24 17:34:18 +00:00
jenkins-bot 109ee53725 Merge "Remove matching groups from regex" 2016-02-24 16:01:34 +00:00
Ed Sanders 2b5db1ed30 Remove matching groups from regex
Bug: T127898
Change-Id: I1cd040cafedf84785938564c5610be4601f41862
2016-02-24 15:59:59 +00:00
Ed Sanders 60883bf812 Included aliases in getAllParamNames
They are bound by they same uniqueness constraints as regular
parameter names.

Bug: T111320
Change-Id: Ia9c1593ec69e1aa97a07b769faf8c9f526dd2922
2016-02-24 15:13:20 +00:00
Ed Sanders 9dd781c18b Give drag handle an increased opacity on hover
Change-Id: Ic7f283b4d20cc8ba35924d4f79be6ba7d3414a78
2016-02-22 17:12:08 -08:00
Ed Sanders f11893573a Param list style tweaks
Change-Id: I244b010a4b1a06e33b31d029afaabe9290440e0f
2016-02-23 01:10:49 +00:00
Ed Sanders 4810a7552e Keep JSON data as an object (not a string) until the last possible point
Conversion to wikitext string can all happen in one place, and tests
are cleaner.

Change-Id: I42adc454dad0dcbb33d9395f8ced0b07a6535fed
2016-02-23 01:10:39 +00:00
Ed Sanders 5c7f50de62 Show param label in list if available
It looks like this is how the code was originally intended,
but 'name' and 'key' are the same thing.

Move the key to the 'alias' list where CSS already exists to
colour it differently.

Change-Id: Ieade122633cec14203f7959121e9cd7250bb9f7a
2016-02-21 02:43:54 +00:00
Ed Sanders beaea898c2 Make main template param select widget drag/drop re-orderable
Not having two lists of all the parameters seems like a good idea.

Depends-On: I30d1f7f56230d73eb47ccbf9881c0b952b15bd89
Change-Id: I5b2ba39fb7b98fc50816f63bc4fbfc9fe25e02a5
2016-02-21 02:43:48 +00:00
Ed Sanders 4bb9bb317a Fix splice re-ordering when moving items forward
Bug: T127203
Change-Id: I91824a4dff3faf9fc401e4824e568df3e891ea3f
2016-02-20 17:48:34 +00:00
Ed Sanders 6ac0d165b1 Fix documentation
Change-Id: I8c12afd193679762439ed3b189a8474ccd5b4c03
2016-02-20 17:48:33 +00:00
Bartosz Dziewoński d9e70f4285 Use MenuOptionWidget rather than OptionWidget for MenuSelectWidget items
The current way surprisingly mostly works, but you're supposed to use
the matching class. This fixes some styling inconsistencies.

Change-Id: I3f8ce19b1f96cc051b7ac987fa211d1b5ee9cc71
2016-02-19 18:55:16 +00:00
jenkins-bot 56e191aacb Merge "Fix linting paths and resulting errors" 2016-02-19 18:29:01 +00:00
Ed Sanders 384c9af747 Update language search/result widget
Change-Id: I646d89aa1dddbd31577810f0a8a1d8ddbabe3baa
2016-02-19 10:26:17 -08:00
Ed Sanders ce3ce51558 Fix linting paths and resulting errors
Change-Id: Ib415d306124df53be085e358e7b868aa1ced9fd1
2016-02-19 17:48:51 +00:00
Ed Sanders 2ea0e0e475 Fix case of class names
Change-Id: I74214eac20a52a3fd1f2e520522fbb5527421a2d
2016-02-19 13:16:29 +00:00
jenkins-bot a2eb417304 Merge "Fix mw.TemplateData.SourceHandler.prototype.extractParametersFromTemplateCode return doc" 2016-01-26 03:36:26 +00:00
jenkins-bot ba2565dec3 Merge "Don't show warning about already-known parameters that weren't imported" 2016-01-26 02:27:39 +00:00
jenkins-bot a99d959959 Merge "Try to put TemplateData in an existing noinclude at bottom of the page" 2016-01-25 12:11:58 +00:00
Alex Monk 423bc5c33d Fix mw.TemplateData.SourceHandler.prototype.extractParametersFromTemplateCode return doc
Does not return a promise

Change-Id: I790fb92542abca9768d0e55cfe79906e22886c1d
2016-01-20 22:34:00 +00:00
Alex Monk d723905034 Don't show warning about already-known parameters that weren't imported
Bug: T124223
Change-Id: Id102799b925ebaec6a1d819f1d2294982c24e407
2016-01-20 22:29:45 +00:00
Alex Monk 317e9a9e84 Try to put TemplateData in an existing noinclude at bottom of the page
Bug: T96537
Change-Id: I947577179fa05c8f095906d6a36743c94dfc7b78
2016-01-18 21:51:19 +00:00
Alex Monk ebbec6ad1c Show message about related pages (e.g. /doc) as a warning, not an error
Bug: T103753
Change-Id: I31eb0e159aeb5154ce2b507e8dfe19db0c1e2dfd
2016-01-13 18:22:55 +00:00
jenkins-bot 4f081392f2 Merge "Prompt user to confirm closing modified TemplateData edit dialog" 2016-01-12 23:48:31 +00:00
Alex Monk 334b9661b0 Avoid adding an extra blank line before <noinclude>
Bug: T86917
Change-Id: I44209ca4549f6eb40f5ba5d94d81b59f8a75fa79
2016-01-12 18:47:53 +00:00
Alex Monk cc6487498b Prompt user to confirm closing modified TemplateData edit dialog
Depends on Ieaf19fe4485b679e0ee21d16f8f2e0693808f386 to take effect with the
escape key. Otherwise only handles the visible 'Cancel' button.

Bug: T106382
Change-Id: Ibc55727fd6a5becfe10b4e74cae5e573d110575d
2016-01-12 17:43:50 +00:00
jenkins-bot 5d30ef8ecf Merge "Use checkbox widgets instead of toggle widgets" 2015-11-13 22:06:32 +00:00
Ed Sanders c069153411 Display format icon and message inside parameters table caption
Change-Id: Id9d6620ed766645384d31c63aacd7c8167c1ce19
2015-11-13 12:35:07 -08:00
Ed Sanders 12e11515b1 Use checkbox widgets instead of toggle widgets
Change-Id: I3a11d07f4dae71ea5ff567046257e50890f5287c
2015-11-13 12:05:38 -08:00
Ed Sanders dbf9a85aa8 Add block/inline icons
Change-Id: I7d07af249318e4f39d8e4a29d1fa3ccdd216e63b
2015-11-13 19:36:26 +00:00
jenkins-bot 0ca4dc4621 Merge "Introduce new 'format' template property" 2015-11-11 23:56:03 +00:00
eranroz 01821eae64 Introduce new 'format' template property
Adding format data, which defines the preferred source format
to use when using templates.

Possible formats:
* Inline - all parameters in a single line
* Block - each parameter is in its own line

Bug: T64147
Change-Id: Id856c4a38890526060d0619432f06174d66f7792
2015-11-11 23:52:17 +00:00
James D. Forrester 94a3bc44e7 Fix two uses of now-removed OOUI mixin aliases
Change-Id: I84c3f72a05d17f0f404a0beadbea70720494794d
2015-10-28 16:05:27 +01:00
James D. Forrester 98fffb3d78 build: Upgrade various devDependencies to latest and make pass
* grunt-contrib-csslint: 0.4.0 -> 0.5.0
* grunt-banana-checker: 0.2.2 -> 0.4.0
* grunt-jscs: 1.8.0 -> 2.1.0

Change-Id: I3070938723648ef4e320d6abf88112b9c5a2b802
2015-10-06 17:24:40 -07:00
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
Ed Sanders fffb070355 Use ActionFieldLayout for 'Add parameter'
Change-Id: I0d69b689cabfa9bd3a503b39a08ec98028a7eca8
2015-09-13 19:50:58 +01:00
Ed Sanders 49165cc00a Fix language widget
Change-Id: I2fc6984d20863cbe54153fbd83530cbaca585cca
2015-09-13 19:50:57 +01:00
Ed Sanders 10775df785 Remove $ = this.$ from OOJSUI code
This feature was removed a while ago.

Change-Id: I2ae0147f9e605e0f86ea4d26e8c1eaba43db29e2
2015-09-13 16:51:19 +01:00
Ltrlg fdd0514024 Go back to using a configurable link for documentation
The message allows per-wiki configuration. The default target is better
for normal users of TemplateData than the previous hard-coded one and
has already been translated in some languages from when it was used
previously.

This also moves the messages dependencies from `ext.templateData` to
`ext.templateDataGenerator.ui`, which is the only module that uses
them: the correct strings were displayed only by inheritance.

Bug: T112011
Change-Id: I81ab684bb0ed9b0767df75635284c51129ac7000
2015-09-10 21:56:05 +00:00
James D. Forrester ac2c2f268e build: Switch from grunt-jscs-checker to grunt-jscs
Use the 'wikimedia' preset, and make pass.

Change-Id: I1923b391bf79cc0992eb02ebe64c969e08354b6f
2015-06-05 18:21:18 -07: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
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
Bartosz Dziewoński a3ddde4a8f Don't flicker "Manage TemplateData" button's disabledness state
The code would call .setDisabled( true ), fire off an API request, and
then always call .setDisabled( false ) when the request finished,
regardless of the response.

Bug: T91324
Change-Id: Iee440a1fca966e0c66669ee5e78b6f5ab8f7f8d6
2015-03-07 20:20:32 +01:00
Timo Tijhof 3ecbaefef1 Document code with JSDuck
Change-Id: Ieb812a2fb85135f6db18a9a02c94efd83695a19e
2015-03-06 17:56:30 -08:00
Moriel Schottlender 3cc6afaa75 Use wikitext instead of page prop when checking for existing TemplateData
On the edit page, we show the user a message if a related page
(parent of /doc page, or vice versa) already has templatedata.

This check was wrongly detecting that the parent page has templatedata
when editing '/doc'. The check shouldn't use the 'templatedata' API
since that also includes transcluded templatedata.

Look in the wikitext content instead.

Change-Id: I9788e2beb0809ac3e676a90cd0dfe519c005afc9
2015-03-02 22:52:48 +00: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
jenkins-bot 39da09b516 Merge "Use ActionFieldLayout for language and auto-choose new lang on add" 2015-02-03 00:54:15 +00:00
jenkins-bot 492f933bb8 Merge "Reset paramOrder widget on dialog setup" 2015-01-30 17:50:17 +00:00
Moriel Schottlender 3ad7e0b1e3 Reset paramOrder widget on dialog setup
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
2015-01-30 17:41:41 +00:00
Moriel Schottlender d141e924f6 Use ActionFieldLayout for language and auto-choose new lang on add
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
2015-01-29 11:58:56 -08:00