Commit graph

129 commits

Author SHA1 Message Date
Gilles Dubuc 961d47432b Download tab, basic download and preview
* Following design, use split button to display a pulldown
menu with possible image sizes. The download happens by
sending the special "download" parameter to the server.

* Offer link to preview image in the browser.

Change-Id: Ic9d895fead04c9128186c7376a0bb09f3596335c
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/79
2014-04-02 23:00:28 +00:00
Gergő Tisza 95111d2b73 Use mw-mmv CSS prefix consistently for all things
With apologies to anyone who gets a hundred merge conflicts
because of this :)

We had several different prefix styles (mlb-, mw-mlb-, mw-mmv-,
mw-mmv-mmv-, a few unprefixed), which was getting annoying,
and will be confusing to wiki editors who are trying to figure out
where a given style comes from. Such changes are better done before
going live because it breaks all local CSS tweaks on the wiki,
so I am renaming things now (also removing some stuff which wasnt
used anywhere).

Change-Id: I00447a25f0028e234169c6db941bedc99622eb8d
2014-03-31 21:33:12 +00:00
jenkins-bot 38fa243c49 Merge "Display black overlay while the viewer JS is loading" 2014-03-31 01:35:43 +00:00
jenkins-bot 53a641b63a Merge "Rename Buttons to CanvasButtons" 2014-03-30 08:47:39 +00:00
Gilles Dubuc 685f42f05f Display black overlay while the viewer JS is loading
I went for this option because it was the fastest to implement.
I think we should wait until we make the change to core to expose
image dimensions before we consider switching to another strategy.

Change-Id: I61c9342a2d6d6fc24a24e0988b3cf7f9a06859a2
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/248
2014-03-30 09:53:20 +02:00
Gergő Tisza fd5f3e2e7b Make $.animate a noop in some tests to avoid conflicts
Tests which trigger real animations conflict with tests using
Sinon.js fake timers. As a quick fix, disable animations in those
tests.

Change-Id: I1a5e9fbee853cc29621c6ccf286bd2191241fd2f
2014-03-29 20:56:06 +01:00
Gergő Tisza 7379957398 Rename Buttons to CanvasButtons
Less misleading as we have lots of buttons, and I plan to add a new
button class for the Commons/survey/reuse thing.

Change-Id: I74194e22e9066c58f9c1eba57629458b2b9148b5
2014-03-28 00:10:04 +00:00
Gergő Tisza b9b1529e9b Add more information to embed HTML
Adds site link, license link and long name, replaces internal license name
(we don't have it for most licenses) with short name.

Also fixes some problems in previous changesets that I stumbled on,
renames things to be more consistent/less misleading, and makes
EmbedFileInfo a thin container for existing classes. (That results
in a lot of Demeter's law violations, but it means one less model
to remember, which is a good thing since our property names are
often not very informative (e.g. EmbedFileInfo.url and
Image.url which had completely different meanings))

We always have the site information for embed texts (comes from the repo
API); that part of the tests was pointless, but now that EmbedFileInfo
depends on Repo they became impossible to maintain, hence the
deletion of half the test cases in getThumbnailHtml().

Change-Id: I94e1d0aca14e2a7d5fad983412090add8ad6bfa3
Mingle:  https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/369
2014-03-27 19:14:06 +00:00
Gergő Tisza d85e7bf32e Utilities to transform HTML to plain or filtered text
This takes care of several minor annoyances:
* centralizes all the text processing functions which have been
  floating all around the code, and adds proper tests
* filters out invisible elements (sometimes used for metadata)
* avoids merging separate words on HTML->text transformation
* adds caching since doing all this transformations could be
  processing-intensive for big chunks of HTML. (This might or
  might not be a good idea. I haven't done performance tests, so
  this might be premature optimization, and increases memory use.
  OTOH these functions are often called in situations where an
  immediate UI response is expected (such as selecting a size
  from the list) so even small delays would be perceivable.

Bug: 63126
Change-Id: I1ef1e3a33efdfea17612df00da6b629bf39e07aa
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/388
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/369
2014-03-27 19:11:09 +00:00
Gilles Dubuc da83227379 Makes the size information (WxH) in Embed lighter
Change-Id: I54ccafd81967eb682a2e10e9a0b9ef6c92e2806f
2014-03-26 11:32:25 +01:00
jenkins-bot 6d11e15cd5 Merge "Add getSiteLink() to Repo model" 2014-03-24 12:27:29 +00:00
jenkins-bot cf2450ccd1 Merge "Get more license info" 2014-03-24 12:18:18 +00:00
jenkins-bot a70873c60f Merge "Improve embed credit line" 2014-03-24 12:17:43 +00:00
jenkins-bot d94721ab37 Merge "Fix some text selection issues with share/embed" 2014-03-24 09:49:22 +00:00
Ori Livneh a2a9f9a85d Update MultimediaViewerNetworkPerformance schema rev.
Update schema to rev. 7917896, omitting the redundant 'userAgent' field, which
is already logged as part of the generic event capsule.

Change-Id: I558282ed29a14ba574204b4d5cba2a432449a75e
2014-03-24 04:17:57 +00:00
Gergő Tisza 27bde3effe Add getSiteLink() to Repo model
This is needed for the HTML embed text.

Change-Id: I286a0dde81675370fe9381651bd10437617426d0
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/369
2014-03-21 01:19:33 +00:00
Gergő Tisza c1ff536c3c Get more license info
Fetch more license information from the imageinfo API
(as needed by the reuse panel), store it in a new model

Change-Id: I331598b55b86d13e23a8bcd58c3ad8fcab749e6f
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/369
2014-03-20 23:07:02 +00:00
Gergő Tisza 341d0199f1 Improve embed credit line
Gets the text closer to the spec:
* links have #mediaviewer (lots of code duplication, see #373)
* image has alt text (was title in the spec but that made less sense)
* less convoluted logic in getCreditHtml()

Change-Id: I43db84adb7fe29850706f92ee978016939b59aaa
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/369
2014-03-20 22:08:28 +00:00
Aaron Arcos 40a6980d28 Fix some text selection issues with share/embed
Change-Id: Ic9d330c04d4e9335cdfce6e99870d1e5877b2a90
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/374
2014-03-20 14:12:39 -07:00
Gergő Tisza 466735fc10 Add HTML text to embed tab
Change-Id: Idcafe6dad9ffb17ffac365a350feff3903b37ff3
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/148
2014-03-19 05:47:47 +00:00
Gergő Tisza f650813eb5 Add embed tab to reuse dialog
Implements the wikitext part of the mingle card

Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/148
Change-Id: I5bcd8e2171f45c70736b7a7cfc695134269ed12d
2014-03-19 05:46:55 +00:00
Gilles Dubuc 56f923ae21 Add share panel, replace reuse
Mingle: 147

Change-Id: I5678002ac84965a80f5e63635151032e6c293194
2014-03-19 02:06:21 +00:00
Gilles Dubuc c6683b7e3f Make the panel animation more subtle
Also turns it into a CSS animation, which allows us
to clean a lot of code

Change-Id: Id6705b63b26d8be341e77352924cad6ac4b73da1
2014-03-14 09:04:28 +01:00
Pau Giner f0061261e6 Simplify "Usage box" and layout adjustments
Adjustments to simplify the uses box by removing borders
and adjusting font sizes and colors.

Change-Id: Ia2cdc6af130d2280b7c94734174da5c154e42b7c
2014-03-12 17:23:51 +01:00
Gergő Tisza 5a3d56f81b Merge MultiLightbox into LightboxInterface
Change-Id: I4363095e0504dd941793ba3addc7ee3cbe835536
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/178
2014-03-08 01:14:07 +00:00
Gilles Dubuc c386719cdb Some refactoring to get LightboxInterface closer to a proper UI component
* remove reference to MultimediaViewer
* move hash handling to MultimediaViewer
* make it inherit from Element, remove code duplication
* cleaner event handling life cycle (register on attach,
  unregister on unattach)

Change-Id: Ida8f68dead758a6ae3c429eb85c548af61e46801
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/178
2014-03-08 00:26:44 +00:00
jenkins-bot 0fa8f80942 Merge "Get rid of global viewer instance" 2014-03-05 17:52:18 +00:00
Gilles Dubuc 8beca0b106 Get rid of global viewer instance
- split event handler setup out of bootstrap and viewer creation
- simplify the tests setup/teardown

Change-Id: Icde1db81efd6191207ba35757192c800ea2d2e91
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/278
2014-03-05 02:33:06 +00:00
Gergő Tisza 59bd5e0032 Add tests for promise rejection error logging
Change-Id: I20d0803f211cbc4a7f00b58d015b565ca5c3b49b
Mingle:https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/268
2014-03-05 01:15:28 +00:00
jenkins-bot 44b9fa127a Merge "Fix resize issues (Part III, Fin)" 2014-03-05 00:16:16 +00:00
Aaron Arcos 6b7de4b129 Fix resize issues (Part III, Fin)
Last round of fixes and refactorings regarding resize issues
and the Canvas component:
  * Consolidate all the width calculation logic inside the Canvas component
  * Consolidate image resizing logic in the Canvas component
  * Fix size problem with SVG images
  * Clean up comments and tests

Change-Id: I0198cc1e3a45f7287b9a7494f73a8f158303f886
Bug: 56454
Mingle: 239
2014-03-05 00:14:54 +00:00
Gilles Dubuc d983a13377 Test to check that events are not trapped after the viewer is closed
Also fixes overeager preventDefault in the interface

Change-Id: I5e3b05c8546e24772016b72343e241caa2e6ef0e
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/274
2014-03-04 09:28:59 +01:00
Gilles Dubuc a82728ccdb Add test for clicking prev/next
Change-Id: I02653d97500d5a876f142a518d9b53b0d4746aef
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/145
2014-03-03 09:27:23 +01:00
Aaron Arcos fedaa553b4 Fix resize issues (Part II)
I was going to stage this but better give you the whole enchilada,
it is not that bad, ;-). This is what I am doing:

- Delete  things that are not used anymore.
- Componentize image ui element (Canvas).

Bug: 56454
Change-Id: Ib5461639a86d9f8e0a150f6d9543a20058d31e00
Mingle: 239
2014-02-28 10:22:21 +01:00
Gergő Tisza 822e129a37 Create fake user when userinfo request fails
Quick and dirty fix for a bug that completely breaks the metadata panel.
Should be refactored later (for a ForeignDbRepo, a missing user is
normal, for anything else it should still be treated as an error
condition, although maybe not with a rejection).

Bug: 62019
Change-Id: I433ae2bd1334593d9c5bfe0272ce7207f3fdf723
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/267
2014-02-28 03:06:23 +00:00
jenkins-bot 45a0031716 Merge "Bugfixes and improvements for the progress bar" 2014-02-27 01:35:26 +00:00
jenkins-bot ccdb14634a Merge "Make it obvious that the permission text is cut off; add expand link" 2014-02-27 01:25:29 +00:00
Gilles Dubuc 9d9fff1871 Bugfixes and improvements for the progress bar
- the bar now starts at 5% for a visual indication that
something is going on
- the bar animates (fast) to 100%, instead of
disappearing immediately
- the animation logic has been fixed to avoid seeing
the bar go backwards
- added sanity check in all the callbacks to make sure
that we don't apply any changes to an image we are
not looking at anymore (including progress updates)

Bug: 58055
Change-Id: I765a61c16513e9330a412c5ec96387623ae7dbc7
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/146
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/242
2014-02-27 02:13:03 +01:00
Gergő Tisza 976ffc76d3 Make it obvious that the permission text is cut off; add expand link
Fades out the bottom of the text and adds a link to replace it
with the full HTML version. Due to the way it is positioned,
the fade + link will be invisible if the text is less then 3 lines.
The implementation is not very polished; since this will be
replaced by some JS-based ellipsis thing, I didn't want to spend
too much time on it.

Change-Id: Ib30e40fe845b85bfcf9557970efb886d28b3e5c7
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/118
2014-02-27 01:06:25 +00:00
Gilles Dubuc 1e880b68ca Ignore left/right key presses when there's a modifier
Change-Id: I8998fd27a7d60f5826802153d3ad74ab8a37c3fe
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/236
2014-02-27 01:17:53 +01:00
Gilles Dubuc 77a483086f Blurred thumbnail preview + progress bar
Displays a blurred version of the thumbnail
while the actual image loads
Displays a progress bar showing the image load progress
Animates into focus once the actual image is loaded

Change-Id: I2b8bc4691c20ffb5b3f16da9a8b9d6fd1796d784
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/146
2014-02-25 14:57:33 +01:00
Gergő Tisza 109bbe6ac1 Namespacing MMV properly
Everything is under mw.mmv now.
(Also, I cut down on the number of direct global instance references a bit.)

Change-Id: I88bb3b62b82ce54126dd069b0aab4412d9404719
2014-02-25 13:16:22 +01:00
Gergő Tisza 53da285b07 Merge MultiLightbox into MultimediaViewer
* merges parent classes into child classes
* moves some files and tests to have a consistent directory structure

Change-Id: I360cc0805d8a561f5105fb063747457f67e1fccd
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/177
2014-02-25 02:00:13 +00:00
Gergő Tisza a04631c405 Show permission
Change-Id: I0b8b0626b36baba9732f7350213d8b53ec2cca95
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/118
2014-02-24 21:41:25 +00:00
Gilles Dubuc bfa530cc21 Wait for CSS to be truly loaded before opening the viewer
This is a workaround for core bug #61852

Change-Id: If7d830866993eddbf5784694514ff89aece56c5b
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/258
2014-02-24 19:13:04 +00:00
jenkins-bot de9d10ce06 Merge "Better way to detect CORS support" 2014-02-24 19:13:06 +00:00
Gilles Dubuc 75dbc72e6c Better way to detect CORS support
The old technique doesn't work in Firefox and
doesn't always work in Chrome depending on
when you call it.

https://hacks.mozilla.org/2009/07/cross-site-xmlhttprequest-with-cors/

Also fixes some tests that weren't overloading
the right function and were hitting the real
feature detection check

Change-Id: I0a9d6b5654efb169860ddf7e5e0551efb825920c
2014-02-24 18:53:01 +00:00
Gilles Dubuc ce58597b3b Fix hash self-reaction
* Fixes bug where the mmv would react to its own hash changes
* Adds jquery.hashchange for older browser support

Change-Id: I2d23699bb444d9eb533d239e25bc47fa96c902a9
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/254
2014-02-24 19:14:45 +01:00
jenkins-bot 79d72d391d Merge "Use cross-origin img attribute instead of data URI" 2014-02-24 09:46:59 +00:00
Gilles Dubuc e37c9b809c Fixes hash handling issues
* Fixes the bug where the browser hash would get nuked on
foreign anchor clicks
* Moves the hash handling back into the mmv itself
* Adds test coverage for the hash nuking bug

Change-Id: Iea57d0f4b9090f96e622418223d3f774923e8038
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/254
2014-02-24 08:45:08 +00:00