Commit graph

167 commits

Author SHA1 Message Date
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 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