Commit graph

48 commits

Author SHA1 Message Date
jenkins-bot 4d53c5d86a Merge "Increase user-input delay in MediaSearchWidget" 2015-02-02 23:47:21 +00:00
Moriel Schottlender 7734e7e71f Do not send search query on whitespace
If the user inserts a whitespace to the search input we don't want
the API query to be sent out.

Change-Id: I8cd68a6039ca98e3d78c9f1aa88f4098a1a99edc
2015-02-02 14:20:29 -08:00
Moriel Schottlender 5d8108f229 Increase user-input delay in MediaSearchWidget
Increase the timeOut for the typing delay so we send search API
requests less frequently when the user types a search term.

Bug: T88188
Change-Id: Ibaf7184fb0eb9a02b460b0a66eabade791aea620
2015-02-02 14:01:49 -08:00
Moriel Schottlender 3d60389ea0 Add a layout queue to media result widget
Use a queue for the method that lays out the result images in
the rows; this queue will only run if the widget is visible,
to make sure that the calculations of the masonry view work
as they should.

In better words: Only cue the queue if the widget is visible.

Bug: T86802
Change-Id: Ia8a30a6a5cccd98a1201443d672e4a6ab4aa946f
2015-01-28 18:01:47 -08:00
Moriel Schottlender a44e0d2e5d Lazy load the media search results
* Set the src attribute only when the image is actually
  visible in the search results.
* Display the thumbnail image we have from the search
  results and then update with a larger one from the API.
* Request for more media results on a higher threshhold,
  when the user views 2 rows above the last available
  result.
* Correct the resizeToBoundingBox and simplify it to work
  properly for a non-square bounding box regardless of
  constraints.

Change-Id: If024b0335ce6a5d2d0eafdbfdfe1030dcaac3a75
2015-01-28 17:56:54 -08:00
James D. Forrester 7daf17fadc MWMediaDialog: Make the dialog bigger when searching for media to insert
Bug: T86397
Change-Id: I40e78441dd555dff837516220653b1c54bf5af92
2015-01-16 16:29:26 -08:00
jenkins-bot 2ebdf34c29 Merge "Transform the search widget to show image details" 2015-01-16 13:26:25 +00:00
Moriel Schottlender 4947420650 Transform the search widget to show image details
Add an info panel to the MediaDialog to show the user information
about the chosen file from the new extmetadata API.

Also, change the way results are viewed:
* Present the search results with their proper ratio.
* Use masonry fit for the search results.
* Change the resizeToBoundingBox method in ve.dm.MWImageNode to accept
  a specific side constraint, either 'width' or 'height'. This is also
  going to be useful for adding and calculating 'scale' considerations
  that affects the image height.
* Add info panel with details from extmetadata including author, license,
  date of upload and creation, etc.
* Get descriptions and data according to wiki language.

Bug: T78161
Bug: T74061
Change-Id: I7b4d019825aa89dd178665bd9492a07af15954ac
2015-01-16 13:22:54 +00:00
James D. Forrester 2f8b3e0d96 build: Bump copyright notices to 2015
Change-Id: Ie92dab7411116d3410195c3fb0a3513c664c0c30
2015-01-12 20:34:19 -08:00
Moriel Schottlender fbb6cd92b4 Fix image alignment in media dialog search
Make the image results align to the full width of the dialog. This
fix uses dynamic values of the width of the container rather than
a hard-coded value so it should work properly on all themes.

Bug: T78050
Change-Id: I05bb0d8a8b13c246840382b12e098d0579180016
2014-12-11 17:15:25 -05:00
James D. Forrester a8b4fc4966 Update VE core submodule to master (c8201dd)
New changes:
ff237d4 Fix z-indexes in core
e88d43e Localisation updates from https://translatewiki.net.
cf61803 Consistently use ve.ui.WindowManager everywhere
f9dfdb8 Update OOjs UI to v0.1.0-pre (23565e7519)
f79f7e3 Update OOjs UI to v0.1.0-pre (8f8896196f)
c8201dd Update OOjs UI to v0.1.0-pre (9ed4cf2557)

Local changes for the breaking change to OptionWidget and sub-classes.

Change-Id: Ife6abd312d4dc97be67cb84eea4cb9c6a0a31b1d
2014-11-21 17:41:04 -08:00
Ed Sanders 2997cee444 Fix lots of spelling mistakes and typos
Change-Id: Icf78d3d599326d3f12d09edcd2b8491ed35ade04
2014-11-21 13:00:50 +00:00
Ed Sanders 0efbfa7e21 Use hasOwnProperty instead of 'key in obj'
Change-Id: I48f044c547b48a97cdfb31f7b887dca0ed7e341b
2014-11-05 20:54:50 +00:00
Alex Monk 8bc150f901 Sort out some odd file permissions
Bug: 71933
Change-Id: I520ee83a9b4d6adec4b430238640cfd58b49aeb4
2014-10-12 03:01:31 +01:00
Moriel Schottlender 2e03a8276e Abort promises before sending new ones in MediaSearchWidget
Before sending new searches to the API, abort the previous ones if
they were not resolved. This will assure that the result presented
on the screen is valid to the latest search that was done even if
the user types quickly and sends many async requests simultaneously.

Bug: 67438
Change-Id: If88123019bfa972520e9db7c627a7f4cd8fc2526
2014-09-05 18:51:30 -04:00
Moriel Schottlender ae4511a02b Hide "no results" messaage in media search widget
After resolving the search queries to the API, make sure to display
or hide (!) the "no results" message.

Bug: 67438
Change-Id: I518fbf5ae18bb2265710600516d556c60e2b4924
2014-09-04 19:03:03 -04:00
James D. Forrester a232147b11 Switch 'disallowQuotedKeysInObjects' jscs rule on and fix up
Change-Id: I75ac4b378ef485feead9d0eff34ed7877b94b5d0
2014-08-22 13:50:48 -07:00
Moriel Schottlender e095b773b9 Use $.when() in MediaSearchWidget
Use $.when() to check if there were results to the search. This
also makes sure that the 'results not found' message only appears
when it actually should.

Bug: 65321
Bug: 67438
Change-Id: I437ef639918ace1041bb8c9f7fdd04a4e83885eb
2014-07-30 18:35:01 -07:00
Moriel Schottlender 2411a174e4 MWMediaSearchWidget: Use json/jsonp for local/foreign api respectively
In the media search widget use 'json' for remote searches and
'jsonp' for local searches.

Bug: 64822
Bug: 67749
Change-Id: Iccc9adb1261602f4bc7426f1caf5aed87aad51e5
2014-07-29 23:55:36 +00: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
Alex Monk 51142e8b11 Replace ve.bind( fn, ... ) calls with fn.bind( ... )
Bug: 62762
Change-Id: I1a7fc7f27fa737d17f5c6b3d084ef4a35e4bebc0
2014-07-10 13:54:07 +00:00
Moriel Schottlender 26fd3777e2 UX Improvements to the Media Dialog
In this fix:
* Adding 'go back' button to appear in the search panel.
* Hiding/showing the correct buttons within each panel.
* Disable the 'apply' button, and only enable when changes are done.
* Load the search query API and send API requests only when the
  search panel is up.
* Make sure the search query is updated with the page name every
  time the search page is loaded

Bug: 67443
Change-Id: I635986f30579c6358e0cc6fe54fbf97f49c83465
2014-07-03 00:43:02 +00:00
jenkins-bot f2c7788522 Merge "Use registered target, instead of ve.init.Target" 2014-06-18 01:45:01 +00:00
Krinkle d16c615bb2 Revert "Media search dialog: Only try to abort request if possible"
Per bug 59604. The TypeError isn't coming from calling ".abort". That
method is always there and part of every jqXHR object, always.

This reverts commit c5dbc13c65.

Change-Id: I43bb53d8c98ca83688020c029d9a3db2c34d54ee
2014-06-18 01:34:15 +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 c5dbc13c65 Media search dialog: Only try to abort request if possible
Sometimes we have to load images in a way that we can't abort.
In that case, don't bother trying to abort, it just creates annoying console
messages.

Bug: 59604
Change-Id: Idb675f57284d9ffa1fe69c87806009a31711dabe
2014-06-17 17:07:00 +00:00
jenkins-bot 55952a32b3 Merge "Use subpage only for media search string" 2014-06-04 22:10:29 +00:00
Moriel Schottlender cb35312c0b Use subpage only for media search string
In namespaces that allow for subpages, use the subpage part of the
page title for the initial search string in the MediaInsertDialog
search widget.

Bug: 51290
Change-Id: I31db88b484eee2206719dc337fbd7c70aef93b3a
2014-06-03 16:54:46 -04:00
Moriel Schottlender 6e096fcaef Small SVG images should still adhere to default thumb size
Make sure that SVG drawings have default size of the wiki default
even if their optimal defined size is smaller.

Bug: 62893
Change-Id: I682d832e456a501836f33ed1dfc7dbd78a4edf53
2014-06-03 13:47:18 -04:00
Moriel Schottlender 3a9faa44fc Hide 'no results found' once there's at least one result
Naturally, the 'no results found' should only appear as long as there
are actually no results found.

Bug: 52463
Change-Id: I0116b769b9e4995678975d43a74c54c4d426f672
2014-05-16 18:35:41 -04:00
Moriel Schottlender 8f68e9f497 If no media is found display a message in media insert dialog
Add a message indicating to the user that no image results were
found in the media insert dialog in case no results are found.

Bug: 52463
Change-Id: I93aea897d864298bf891a90c2fb147f7d34df06d
2014-05-14 16:08:11 -07:00
James D. Forrester f1471a59f3 MWMediaSearchWidget: Bump media search result size to 20
At 15 the new, taller dialog means we never get to search for more…

Change-Id: I255d93b8230f962579e1a07840b7cc209577876b
2014-03-29 00:08:59 +00:00
Moriel Schottlender 21ccb20d3a Only display image info if that exists
When a new search is performed in the MWMediaSearchWidget,
image thumbnail details are extracted from the API's imageinfo.
In some cases, this parameter does not exist. MWMediaResultWidget
relies on that parameter to get image details like 'src' and
width/height. Without it the search fails.

This fix makes sure that the thumbnail result is only displayed
if there are 'imageinfo' details at all. Otherwise, the image
result is ignored.

Bug: 61392
Change-Id: I5261059bb42d3a57441514eafaa0bffa3a3c3ba4
2014-02-14 18:12:26 -05:00
Moriel Schottlender bee4e5323f Make MWMediaSearchDialog not ignore empty scriptDirUrl
For wikis that are installed in root directory, the API parameter
'scriptDirUrl' is an empty string. This change makes sure it is not
ignored.

Change-Id: Ib58adf76c184c32c0cdbb9dba31db1e4028fa383
2014-02-10 13:42:05 -05: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
Moriel Schottlender 580a3f3d8d Use image sources from the fileRepo API
This commit switches from using hard-coded media source urls to utilizing
MediaWiki's API call for meta=filerepoinfo. The API call is done only if
needed when the media insertion dialog is loading, and is done only once
per session.


Bug: 50673
Change-Id: Ia5ad9a8c00cca6cbbbc890359dc529e29e1a6be7
2014-01-04 01:21:24 +00:00
Timo Tijhof 68cf65844e jscs: "var\t" -> "var "
Only 2 hits.

Change-Id: Ie8c5c39a49f620891bae8582dcc0d2f151e50e21
2013-12-04 21:06:19 +01: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
jenkins-bot 23dd5f9fb9 Merge "'Config' -> 'Configuration' in all comments" 2013-09-26 19:02:30 +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
Erick Guan 30f1ed4c75 No more configuration overrides
In various places in the UI code, certain properties of config objects
were overridden and in some cases the configurations were documented as
private as a strange hack to prevent them from being advertised in the
docs.

I, Trevor, have been convinced of the error of my ways, and gladly
reverse this situation, allowing all configurations to always be
overridden when desired, while still allowing default values.

Change-Id: I242e3b1902dec8e09eeea38fa64381e69ee04215
2013-09-23 23:59:14 +00:00
Timo Tijhof 44623c9b2a ve.copy: Remove obsolete copyArray and copyObject
These have been pointing to the same method for a while now,
we can safely remove these obsolete aliases and just use it
as generic copy.

* Each file touched by my editor had its new line at EOF fixed
  where absent
* Don't copy an otherwise unused empty object
  (ve.dm.Converter)
* Use common ve#copy syntax instead to create a link
  (ve.dm.Document, ve.dm.example)
* Remove redundant conditionals for isArray/copyArray/copyObject
  (ve.dm.example)

Change-Id: If560e658dc1fb59bf01f702c97e3e82a50a8a255
2013-07-30 01:44:22 +02:00
Rob Moen b61be39686 Normalize image titles in cache to prevent duplicates.
Bug: 50158
Change-Id: Ic86e063086917f739f53b4374b29f77bffd4ac1a
2013-07-11 10:11:24 -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.MWMediaSearchWidget.js (Browse further)