Commit graph

21 commits

Author SHA1 Message Date
Alex Monk 93e4c59e4f Use LinkCache instead of an object in MWCategoryWidget to store hidden status (to be shared with the input widget)
Change-Id: Icb62b9b27ea1d61097d059fa268cc4834d46fc9f
2014-09-23 23:56:27 +01:00
Alex Monk e6c4315d93 Refactor a bunch of CategoryInputWidget code, tear out dead/broken redirect handling that should be rewritten
Category redirect stuff is currently broken because of I5c536697, but no one seems to have noticed.
Fix bug 69886 while we're here

Bug: 69886
Change-Id: I62cf23d0e86bc43d739bb4c4610a5a852146fa3f
2014-09-10 23:21:12 +01:00
Derk-Jan Hartman a270fc396d Categories: Don't suggest empty or old categories
The categories table holds all categories that exist OR have at one
point existed. This means it also contains a lot of vandalism and
other inappropriate names that happily come up in the suggestions.
This is undesirable. This changes the query to only list categories
with at least 1 entry.

Though technically it can be argued that an empty category with an
existing page might 'exist' and should thus be listed, with this
change they won't be. I don't think that is terribly incorrect to
say that such would be a 'new category', but we could also consider
renaming the label in the suggestion list to say:
'Currently unused category' or something similar.

As far as I can tell there is no way to test for page existance OR
generate a list based on allcategories with one API query.

Bug: 70025
Change-Id: I0e195d3ce26e69d4710d6a505b9da7d1b7678d92
2014-08-26 11:25:54 +02:00
James D. Forrester a232147b11 Switch 'disallowQuotedKeysInObjects' jscs rule on and fix up
Change-Id: I75ac4b378ef485feead9d0eff34ed7877b94b5d0
2014-08-22 13:50:48 -07:00
James D. Forrester c2f37a0450 test: Move mw into the global list of globals for VE-MW
Silly to have 38 MW-specific files needing to declare that they're using mw.

Change-Id: I97891ed922fe0c37d8c96425a4d23bd15098438b
2014-07-19 17:42:45 +00:00
Ed Sanders c70d32c017 Use registered target, instead of ve.init.Target
Depends on I468d4eb4 in core.

Uses various hacks to trick the test runner into thinking
an MW target is in use, when in fact we still use SA targets.

Change-Id: If4611307d5d7aaee4af84f86ef82faf9078043b6
2014-06-17 20:41:01 +01:00
Krenair 72f3c7808b Check last existing category for whether or not we're trying to re-add it
We were checking all the ones before it, just not the last.

Bug: 66105
Change-Id: Ic22233181a92860c288aa4e3176c469eba58ed43
2014-06-04 20:04:26 +01:00
Krenair 20a1860f49 Suggest categories that exist but don't necessarily have pages
Instead of suggesting categories that have pages but don't necessarily exist.

Replaces part of If39e6f9c

Bug: 49044
Change-Id: I5c53669776c4c5bbbfe7b753747f3f677a752d91
2014-05-28 17:37:01 +01:00
Krenair 9c2e1d8048 Follow redirects in the category widgets
Display the redirects nicely in the UI, etc.

Bug: 52414
Change-Id: Ib62144cb90899d0c525d6f08f6b5f1159b7d2a86
2014-04-16 15:30:14 +00:00
Krenair a4112ce30d Make new category suggestion section for hidden categories
Change-Id: If60437ce886c03ca1fb75ba23590e9cdb6c2d78b
2014-03-05 17:30:13 -08:00
Krenair 0fea59f171 Fix more code that misreads API data with $wgDebugToolbar enabled
See also I907ef6fc.

Change-Id: Ie44faa15629ebba834cb08ba6247ff3beaabd0ae
2014-02-11 10:28:55 +00:00
jenkins-bot 2284cb9aae Merge "Factor out AJAX defaults into ve.init.mw.Target.static.apiRequest()" 2014-01-15 10:37:43 +00:00
Roan Kattouw 97c4c6c71b Factor out AJAX defaults into ve.init.mw.Target.static.apiRequest()
Change-Id: I90b0858ccd657b7183ae5327903449d17d9f0bef
2014-01-13 11:45:30 -08:00
James D. Forrester 0ffd654bed Bump copyright like it's 2014
Change-Id: Ic469ebda2c061dc7da0b4c1625f43a7be55da4fa
2014-01-05 20:06:50 +08:00
Trevor Parscal db9f941fa6 Rename this.$ to this.$element, and this.$$ to this.$
Objectives:
* Rename this.$ to this.$element
* Rename this.$$ to this.$
* Get rid of the need to use this.frame.$$
* Rename OO.ui.Element.get$$ to OO.ui.Element.getJQuery

Changes: (using Sublime Text regex patterns)
* Replace "get$$" with "getJQuery"
* Replace "\.(\$)([^\$a-zA-Z])" with ".$element$2"
* Replace "\.(\$\$)" with ".$"
* Replace "'$$'" with "'$'"
* Set this.$ to null in constructor of OO.ui.Window
* Set this.$ to this.frame.$ in initialize method of OO.ui.Window
* Replace "\.(frame.\$)([^\$a-zA-Z])" with ".\$$2"

Bonus:
* Use this.$() in a bunch of places where $() was erroneously used

Change-Id: If3d870124ab8d10f8223532cda95c2b2b075db94
2013-11-03 23:03:49 -08:00
Trevor Parscal d2dfb9ac4f Split oojs-ui from ve.ui
* Move and rename generic parts of ve.ui to OO.ui
* We now have a UI test suite because ve.Element (outside ve.ui)
  is now part of oojs-ui, so it needs a test suite.
* Added to the MW test run (just like we do for unicodejs).
* Updated csslint config (also added ve-mw and syntaxhighlight
  which were missing).

oojs-ui still depends on the TriggerRegistry in VE, this is addressed
in a follow-up commit.

Change-Id: Iec147155c1ddf20b73a4d15d87b8742207032312
2013-10-28 22:40:08 -07:00
Trevor Parscal efafed3231 Remove ve.{inheritClass,mixinClass} and use OO instead
Change-Id: I8df9226a358a76b661eab6e967ff0d63d361f691
2013-10-18 18:58:08 +02:00
Timo Tijhof eb515188ec Convert try/catch uses of mw.Title to newFromText
`new mw.Title` throws on invalid input. Converting uses to
mw.Title.newFromText instead and converting try/catch to if/else.

mw.Title in general (regardless of which constructor) has been
improved in core. It will no longer crash on pages where the page
title was a false hit for invalid (e.g. we couldn't load VE on
[[.com]] because the js parser thought it was invalid).

However, though the initialisation works since core has been
fixed, there are still plently of cases where we take real user
input that can genuinely be invalid.

In cases where the code did not catch exceptions and there was
no obvious way to handle it, I left it as is (let's revisit them
in a separate commit). It would be an exception either way, and
I'd rather see "mw.Title: Parser error" than
"TypeError: null does not have method getNamespaceId".

Change-Id: I5b1b23d56d39cdb7ecb0809e3d721992e0c30f54
2013-10-09 21:21:25 +00:00
Ed Sanders e6f48c5c93 'Config' -> 'Configuration' in all comments
Because the former isn't a real word.

Change-Id: Ie6ed15f9e390b357bbaa768b57f3c3fd7cf21181
2013-09-25 11:23:16 +01:00
Rob Moen 6fba04f121 When normalizing category titles with mw.Title, use getMain method
This will get the name attribute plus this extension

Bug: 50702
Change-Id: I57298ef34b413002f1506b499903b73a18969e68
2013-07-10 15:52:58 -07:00
Roan Kattouw 92c38eab85 The great directory split of 2013
Move all MW-specific files into the ve-mw directory, in preparation
for moving them out into a separate repo.

All MW-specific files were moved into a parallel directory structure
in modules/ve-mw . Files with both generic and MW-specific things were
split up. Files in ve/init/mw/ were moved to ve-mw/init/ rather than
ve-mw/init/mw ; they're still named ve.init.mw.* but we should change
that. Some of the test files for core classes had MW-specific test cases,
so those were split up and the test runner was duplicated; we should
refactor our tests to use data providers so we can add cases more easily.

Split files:
* ve.ce.Node.css
* ve.ce.ContentBranchNode.test.js (MWEntityNode)
* ve.ce.Document.test.js (some core test cases genericized)
* ve.dm.InternalList.test.js (uses mwReference test document)
* ve.dm.SurfaceFragment.test.js, ve.ui.FormatAction.test.js
** Made core tests use heading instead of mwHeading
** Updated core tests because normal headings don't break out of lists
** Moved test runners into ve.test.utils.js
* ve.ui.Icons-*.css
* ve.ui.Dialog.css (MW parts into ve.ui.MWDialog.css)
* ve.ui.Tool.css
* ve.ui.Widget.css (move ve-ui-rtl and ve-ui-ltr to ve.ui.css)

ve.dm.Converter.test.js: Moved runner functions into ve.test.utils.js

ve.dm.example.js:
* Refactored createExampleDocument so mwExample can use it
* Removed wgExtensionAssetsPath detection, moved into mw-preload.js
* Genericized withMeta example document (original version copied to mwExample)
* Moved references example document to mwExample

ve.dm.mwExample.js:
* Move withMeta and references example documents from ve.dm.example.js
* Add createExampleDocument function

ve-mw/test/index.php: Runner for MW-specific tests only

ve-mw/test/mw-preload.js: Sets VE_TESTDIR for Special:JavaScriptTest only

ve.ui.Window.js:
* Remove magic path interpolation in addLocalStyleSheets()
* Pass full(er) paths to addLocalStyleSheets(), here and in subclasses

ve.ui.MWDialog.js: Subclass of Dialog that adds MW versions of stylesheets

ve.ui.MW*Dialog.js:
* Subclass MWDialog rather than Dialog
* Load both core and MW versions of stylesheets that have both

ve.ui.PagedDialog.js: Converted to a mixin rather than an abstract base class
* Don't inherit ve.ui.Dialog
* Rather than overriding initialize(), provide initializePages() which the
  host class is supposed to call from its initialize()
* Rename onOutlineSelect to onPageOutlineSelect

ve.ui.MWMetaDialog.js, ve.ui.MWTransclusionDialog.js:
* Use PagedDialog as a mixin rather than a base class, inherit MWDialog

bullet-icon.png: Unused, deleted

Stuff we should do later:
* Refactor tests to use data providers
* Write utility function for SVG compat check
* Separate omnibus CSS files such as ve.ui.Widget.css
* Separate omnibus RL modules
* Use icon classes in ViewPageTarget

Change-Id: I1b28f8ba7f2d2513e5c634927a854686fb9dd5a5
2013-07-02 20:51:38 -07:00
Renamed from modules/ve/ui/widgets/ve.ui.MWCategoryInputWidget.js (Browse further)