Commit graph

543 commits

Author SHA1 Message Date
Bartosz Dziewoński 44e47a6e8f Insert a new references list immediately, rather than showing a dialog
If a references list node is selected, open the dialog to edit it.
Otherwise just insert the references list for the default group, since
this is what the user wants to do in 99% of cases.

* Replaced the simple 'referencesList' command (which opened the dialog)
  with a custom implementation in ve.ui.MWReferencesListCommand, which
  inserts the references list or opens the dialog like before.
* Removed the ability to insert a references list from
  ve.ui.MWReferencesListDialog, since it should now never open without
  a references list selected. If it does, throw an error.

I considered the behavior of always showing the dialog if there is at
least one references list already in the document, but I think it would
be confusing if the tool behaved differently depending on the state of
the document (rather than merely current selection).

Bug: T71727
Change-Id: Ifbbfa28548de9c0435c5174fb7762079f59bac54
2015-03-17 15:20:22 -07:00
Moriel Schottlender 73356c333a Add general citations dialog
Add a dialog to group the possible citation types and allow the
user to choose the right citation dialog for them.

Depends on Ibf29417 in VE-core; useless without I3d9caef in VE-core.

Bug: T62768
Change-Id: I22a64265475b1b4c94b46c5af196bd08331a05e7
2015-03-16 17:20:38 -07:00
jenkins-bot 557e0e28ad Remove use of ve.indexOf and ve.getObjectKeys
Change-Id: Icbaa729209605fca8018e4bcbbe29c9ded64e7f2
2015-03-10 17:28:00 +01:00
Moriel Schottlender 06f29f343a Add a threshold to 'read more' calculation in media dialog info
When calculating whether to show the 'read more' button on fields
that are configured 'descriptions', use a threshold to check if
the height is enough to be shown.

Bug: T87265
Change-Id: I0601e4fa92cb58903641a146500cf560bc029425
2015-03-04 11:04:53 -08:00
jenkins-bot b4998f0932 Merge "Use mw.Api to run requests rather than our own stuff in ve.init.mw.Target" 2015-02-25 17:26:27 +00:00
Alex Monk 85373bcb9a Check whether template is altered before allowing apply
Again. Originally done in I5a664f86, the crucial part of which was reversed
in I1500f480.

Bug: T89913
Change-Id: I39b0cdcdb5f76fa75f506c874ef6223d8d8d53e6
2015-02-25 02:12:28 +00:00
Alex Monk 8e48f94580 Use mw.Api to run requests rather than our own stuff in ve.init.mw.Target
Bug: T58659
Bug: T89435
Change-Id: I18162f04c50f48606378aed62ee99fccdc3159f6
2015-02-25 01:57:22 +00:00
Ed Sanders e0e0cb446e Remove unused $popupOverlay
Change-Id: I17342d451833298b5b45ebd7d00cc17f3086df71
2015-02-24 18:19:07 +00:00
Roan Kattouw 237bb053d6 Remove the sanity check
It's slow, especially on large pages, and it's triggered
very infrequently these days, and only for known bugs.

In the future we should replace this with a debugging
interface that displays the DOM diff between the original
DOM and the round-tripped DOM, as opposed to the boolean
interface we have now.

By extension, this also means the visualeditor-needcheck
tag won't be applied to new edits any more, although
its registration and messages are kept around because
edits with this tag still exist in page histories.

Bug: T87161
Change-Id: I909153492a5786b4b69fccd42ce3c1d4bdb3a059
2015-02-17 17:14:34 -08:00
Moriel Schottlender a06df576b3 Correct the license URL in the media dialog
The license url read the response object instead of the response
value itself.

Bug: T89544
Change-Id: Ibb22e47e0097e012279e21211e1c7e2f1545f2b1
2015-02-16 14:49:12 -08:00
Timo Tijhof 5bf0ac251a Move svgMaxSize and namespacesWithSubpages to site config
These are currently in page-specific mw.config. As these are
not related any page, they should be in the global export.

This is needed to have our tests (and code base) run error-free
without a MediaWiki page.

Bug: T89434
Change-Id: Ic42bcd14028772ff0c06e28c76ffaf156f8b985f
2015-02-13 08:20:26 +00:00
Trevor Parscal a65148d69e Update VE core submodule to master (9240a51)
New changes:
50ccb23 Localisation updates from https://translatewiki.net.
9240a51 Update OOjs UI to v0.7.0

Local changes:
* MWTemplateDialog: Stop waiting for removed loading promise to
  finish, as in OOjs UI I2bfa013 the loading promise is removed
  since iframes were the only reason we needed it.

Change-Id: I1500f480d40d06e417366014b9c2a76f7ce9c29b
2015-02-11 16:50:45 -08:00
Moriel Schottlender a3973145d5 Display image uploader and artist correctly in the media dialog
Add the display for the actual uploader, and change the label
for the artist to "Artist" for differentiating the two roles.

Bug: T88835
Change-Id: Ie939572e7c1240321556f6f81ed9e67d792a339d
2015-02-11 11:14:43 -08:00
jenkins-bot 7ac177c02e Merge "Template dialog: Disable 'Apply changes' until a change is made" 2015-02-10 23:17:01 +00:00
Ed Sanders d6818c558d Use ve.ui.AlignWidget in media dialog
Change-Id: I70579971a22c5bfee1e373b57ba7fe24a46ef406
2015-02-10 10:49:53 +00:00
Roan Kattouw 3f15c5be5d MWMediaDialog: Focus the right thing on ready, depending on the panel shown
The ready handler unconditionally focused the surface, even if
a different panel was shown. Prior to aa9eb9545 this didn't
actually break the search mode, because the search input was
focused after the image repo information came back, which
usually happened after ready. However, aa9eb9545 instead focused
the search input from the setup process, which is too early.

Also introduce this.currentPanel as a way to track
which panel is currently visible.

Bug: T88881
Change-Id: I0189fbeed73ee9103e45fec4a1bc8d4ee1b6ed40
2015-02-06 18:12:06 -08:00
Moriel Schottlender aa9eb95455 Refactor MWMediaSearchWidget to use a queue and providers
Change the media search widget to work with resource queues and
providers. Create providers based on the user's filerepo settings
and aggregate their responses with the media queue. Stop asking
for more results from providers that are depleted.

Also fixes a rather nasty infinite-loop bug where the API returns
only very few images, and the UI keeps asking for more.

Bug: T78161
Bug: T88764
Change-Id: I65aed3446cd1f056476c56e6e04522c70e49e595
2015-02-06 16:45:56 -08:00
Moriel Schottlender 8a53b2cd07 Use css class instead of jquery show/hide
Replace instances of .show() and .hide() with ooui 'hidden' class
to make performance better.

Related ooui change: Ibf7c99aa4aad

Bug: T87420
Bug: T88736
Change-Id: I3af8a322e88b7ba3364f350819d6dbcdc8b13270
2015-02-06 11:03:59 -08:00
James D. Forrester bed038b509 build: Bump devDependencies to latest
Updates:
* grunt-contrib-csslint  0.3.1  ->  0.4.0
* grunt-contrib-jslint   0.10.0 -> 0.11.0
* grunt-jscs             0.8.1  ->  1.2.0

For jscs, leaving requireSpacesInsideArrayBrackets to avoid headaches for now.

Change-Id: I62d34444edbba65c8bd22d2fa5e50e16cabb0042
2015-02-02 14:30:39 -08:00
Moriel Schottlender 70fb0ea24f Use the new image cache in the media dialog
Prevent another api call for image sizing by caching the chosen
image in the media dialog with the imageInfoCache.

Bug: T88187
Change-Id: If2d905eeb5907f29b6839692509dfc07a06c230e
2015-02-02 19:32:46 +00:00
Alex Monk dc69b15db1 Template dialog: Disable 'Apply changes' until a change is made
Bug: T76926
Bug: T76927
Change-Id: I5a664f865c11690a19b754fc9877baf37e34edad
2015-01-31 03:19:06 +00:00
jenkins-bot cc6a629927 Merge "Use padding on save dialog panels so scrollbar is correctly positioned" 2015-01-31 02:31:02 +00:00
Ed Sanders e0d9b062d4 Use padding on save dialog panels so scrollbar is correctly positioned
Previously was using a margin so the scrollbar floated 1.25em from the
edge of the dialog.

Remove Apex-specific hack.

Change-Id: Idc953c492a6527a9216b77256d406fc3435ec0a9
2015-01-30 18:14:07 -08:00
jenkins-bot 6230e80904 Merge "MWSaveDialog: Make the diff screen a larger rather than large size" 2015-01-31 02:02:21 +00:00
jenkins-bot 4443349a11 Merge "Add a layout queue to media result widget" 2015-01-29 18:34:50 +00:00
jenkins-bot cc4e8e7ebd Merge "When changing image source, use already-available API info" 2015-01-29 18:34:03 +00:00
jenkins-bot e372b93c4c Merge "Lazy load the media search results" 2015-01-29 18:33:47 +00: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 e454b81f4d When changing image source, use already-available API info
When the user changes an image to another in the media dialog, we
already have API info that includes the original dimensions, media
type and other information that is required for the Scalable object
to compute the new current dimensions. We can use this info if it
exists instead of asking for another API call. Also make sure to
update the filename when we change an image in the dialog.

Bug: T87267
Change-Id: I9d86959b99b3f3dfed92255a9dba9a8fdd352dcb
2015-01-29 01:58:07 +00: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
jenkins-bot e9d770ed11 Merge "MWMediaDialog: Add contextual help for controls" 2015-01-28 23:42:01 +00:00
Moriel Schottlender 34f93bef08 Focus the add template input in the template dialog
Focus the page in the booklet layout so the add template
input is also focused at the opening of the template dialog.

Bug: T85484
Change-Id: Id9ae4653dc2a2e1d1dc16c83c540e22e30f4ea55
2015-01-23 17:55:26 -08:00
James D. Forrester d8f342a640 MWMediaDialog: Add contextual help for controls
Bug: T53798
Bug: T75731
Change-Id: Ideae0052c366a8c4e03285270569e5c5ca608ad8
2015-01-20 15:53:31 -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
James D. Forrester 9625bd2c99 MWSaveDialog: Make the diff screen a larger rather than large size
Bug: T78823
Change-Id: If14acbeb8449e27e692bc52556c1d31305b4c54a
2015-01-16 16:04:05 -08:00
Moriel Schottlender 061925be87 Add filename to the media dialog
Show the currently used filename at the top of the media dialog so
it can be copied and used in other pages if needed.

Bug: T54459
Change-Id: Ib1844c997189f7ead0656c5a811d3cab70030f89
2015-01-16 17:40:40 +00: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 cc293dc4c4 SurfaceWidgets should listen to history
The history event reflects actual changes, rather than the transact
event that masks staged changes done to the document.

Bug: T85845
Change-Id: I1faeb97677540f08c512b48b47fafe28b1072579
2015-01-12 11:51:44 -08:00
Alex Monk 9966298593 Re-focus edit summary input when save dialog is ready
I thought this was already being done elsewhere and so removed it back in Ifb8fd9be

Bug: T75675
Change-Id: Ia015c96ec8332af75428f156e4ed7a25184db96b
2015-01-06 00:54:02 +00:00
Bartosz Dziewoński 74db35b93c MWSaveDialog: Correct whitespace
Change-Id: I9f2ad375bc04e798aa4d2f2a8097a4af0a2b2e4d
2015-01-05 22:05:42 +01:00
Amir E. Aharoni 84629d1b6c Clarify a comment and correct its spelling
Change-Id: Idd1334d60822a1bfaae2354bca6cb277016f81f7
2014-12-28 00:51:52 +02:00
Timo Tijhof 2b7ae8c175 Remove use of bind() for inline functions
Follows-up b0e8900, 447e8de, d3f26e65.

Contrary to binding a reference, this-overiddes for inline
functions gets messy and fragile. There's also a minor
performance overhead that can be avoided. No separation of
concerns, eiter, as the object is held by the closure.

Also:
* Remove left-over instances of @method.
* Remove redundant '0' argument to setTimeout.
* Use null instead of $ for apply() on static methods like $.when.
* Use .empty().append() instead of .html(). Does the same but
  without additional overhead and without confusion association
  with "html" which isn't used (it doesn't serialise and re-parse
  or clone, it just appends when given one or more nodes).

Change-Id: I797a3667c67d52568150be9be5d043d149f22077
2014-12-16 23:27:53 +00:00
Alex Monk 0d0172d43b Set 's' accesskey on save button inside save dialog
Can be done much nicer than I expected last time I looked at this task

Bug: T76161
Change-Id: I9541cd9dac69330ed8a802f301617619221bc263
2014-12-15 21:07:54 +00:00
Bartosz Dziewoński 29ff7b737e Rename some things for my sanity
Change-Id: I101943fa027947e73f7f7559bd706faadad90e95
2014-12-12 20:49:00 +00:00
Bartosz Dziewoński 16e8255f69 Update VE core submodule to master (b5e2b87)
New changes:
96d0936 Mark primary buttons as progressive as well
68f184c Localisation updates from https://translatewiki.net.
b96c9dc [BREAKING CHANGE] Rename method cmpOffsetPaths to compareOffsetPaths
862f31d Convenience compareDocumentOrder method
b5e2b87 Update OOjs UI to v0.5.0

Local fixes to correct for breaking change I32608c7f in OOjs UI.

Change-Id: I64f5e2f6ccc0056bfa9eda5e65e87789b97b8ad5
2014-12-12 12:29:05 -08:00
jenkins-bot 87143d4c36 Merge "Mark primary buttons as progressive as well" 2014-12-11 22:59:04 +00:00
James D. Forrester 57a68d082b Mark primary buttons as progressive as well
Also make save button primary.

In anticipation of Iee91d2c6 in OOjs UI

Change-Id: I123044bfaba631866ad32a35643f23686a17a16f
2014-12-11 22:55:16 +00:00
Ed Sanders 45518019eb Update VE core submodule to master (9ac8136)
New changes:
9929b6d [BREAKING CHANGE] Make ve.init.target an OO.ui.Element

Local changes:
* Fix target constructors now they generate this.$element

Change-Id: Ia6bf604c67305834a3f73863a10336cfbb83fa77
2014-12-11 14:00:28 -08:00
Moriel Schottlender e0894b807f Surfaces should have parent document direction
Make sure all surface widgets have documents that are initialized
with the direction of the parent document, so the alignment is set up
correctly.

Bug: T71969
Change-Id: I6e5f003e18a9c5808d9a4b148eddf0d0f7e29e67
2014-12-10 16:46:16 -05:00
Timo Tijhof ee954cbdd5 Use String#slice instead of discouraged String#substr
Aside from the confusion and differences between substr() and
substring() and IE8 bugs with substr(), substr() was removed from
the spec as of ECMAScript 5. It's been standardised in the
optional Annex B section of ES5.

Change-Id: I221ef6ae6956ce20dd9bb74510500f747d04c3b1
2014-12-06 21:26:20 +00:00
Alex Monk fc6eaf6825 Don't re-enable apply changes in reference dialog if the changes have been undone
Per Roan on Ib5229bdc

Bug: T57976
Change-Id: I0450ab59ea8aa2e3130eb9124de74e67ffc0497f
2014-12-05 23:50:57 +00:00
Alex Monk db4d034fd7 Disable Apply Changes in reference dialog until changes have been made
Bug: T57976
Change-Id: Ib5229bdc480ec437436c5d8d351b06417d4ffd9b
2014-12-02 01:34:44 +00:00
jenkins-bot 55eba4c1cc Merge "Change event listener for caption surface in media dialog" 2014-12-01 19:05:09 +00:00
Moriel Schottlender 78b86cd72d Set panels after everything is initialized in media dialog
Only change the panels (and focus the caption surface) after the
surface is actually appended and initialized.

Bug: T76074
Change-Id: I3d514f38b5fd9f794c4ff8c44a64f5f3475a84bd
2014-11-26 19:26:44 -05:00
Roan Kattouw 8fc9b290c0 Followup c56a921: use cite-transclusion-* tools in MWReferenceDialog, not cite-*
Because a lot of toolbar customization was removed, use an evil
hack to get this in there for now. Should be cleaned up later.

Bug: T76082
Change-Id: I0fd5ddc6fa11162deb615f0b387d6d59c5cc4a3a
2014-11-26 15:49:04 -08:00
Moriel Schottlender 30ce139955 Change event listener for caption surface in media dialog
Make sure the dialog is listening to the correct event for when
caption surface changes.

Bug: T76074
Change-Id: I214947a440e4f78adf1541d8008599fe65ac8b2c
2014-11-26 20:04:07 +00:00
James D. Forrester e90cbe6a37 Follow-up I5bc30eca7: Register <visualeditor-formatdropdown-format-blockquote>
Also push it into correct place in the toolbar, and disable it from media and
reference dialogs' toolbars.

Change-Id: Icc3bf056860e35def13e03e77ffc6782acc4196a
2014-11-25 19:01:02 -08:00
jenkins-bot d34c275020 Merge "Work around broken BooketLayout#focus method in OOUI for now" 2014-11-25 23:57:26 +00:00
Roan Kattouw d2b8091372 Work around broken BooketLayout#focus method in OOUI for now
Change-Id: I1750951487fc7a8e1fcb5fff5dea6ee9a2547cf1
2014-11-25 15:54:03 -08:00
Ed Sanders 5ce4885529 Replace hacky wikitext warning listener with sequences
Uses the generic sequence detection now available in core instead
of a custom hack that had to been manually bound and unbound to
every surface and surface widget.

As the sequence detection looks at just-typed characters the behaviour
has reverted to showing a auto-hide message. This resolves an issue
with the previous system whereby typing in the same paragraph as existing
wikitext patterns triggered the warning.

Depends on I6a4d71d in core.

Bug: T53751
Change-Id: I7d914b1b60a1cf8c79a724e5f634e1e666c9562d
2014-11-25 22:39:29 +00:00
jenkins-bot a7dc4af551 Merge "Catch pagedeleted errors and give the ability to re-create the page" 2014-11-25 19:42:58 +00:00
Ed Sanders f79aed7572 Update VE core submodule to master (8ca8c41)
Local changes:
* Rename paste rules to import rules (also used by drag and drop)

New changes:
f5d83f8 Remove data-parsoid removal hack
99f938f Create 'preserveGenerated' mode for cloneElements and use in copy
938b44d [BREAKING CHANGE] Rename paste rules to import rules
c51288c ve.ce.Surface: Move insert HTML path to DM
10ce4cf Provide a FileDropHandler for HTML files
701bb9c Provide a FileDropHandler for CSV and TSV files
ca6b444 build: Update update-oojs.sh and update-oojs-ui.sh scripts

Change-Id: I5cfa15ab3efd03e2c64c2f9f725cb3098f53b32a
2014-11-24 18:55:32 -08:00
Ed Sanders c56a921585 Change command list from whitelist to blacklist
Also remove toolbar definitions as they can now be derived from
command availability.

Depends on If32d514a in core.

Change-Id: I2313f3cc2531686b27f96dc1110b28bb4b295f89
2014-11-24 18:28:37 +00:00
jenkins-bot b69fef2196 Merge "Focus the bookletLayout on ready in the template dialog" 2014-11-23 17:19:11 +00:00
Roan Kattouw 0bc3edfd91 Focus the bookletLayout on ready in the template dialog
Depends on I60377cb5 in oojs-ui

Change-Id: I5d8b73f878bf136efdc97493ef1f6e7bd6f56066
2014-11-21 18:13:27 -08: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
Roan Kattouw 4cf254a31b OO.ui.WindowManager -> ve.ui.WindowManager
In keeping with Id6660a4b54 in VE core.

Change-Id: I6fa6c0cdc3e514a66889e41c2eb4c710650a3405
2014-11-21 13:58:53 -08:00
Alex Monk 9bb766c5bb Catch pagedeleted errors and give the ability to re-create the page
Bug: 52073
Change-Id: I86a6e1510ccb5e59e94a5262dd3ccd91fdf05a70
2014-11-21 21:44:15 +00:00
Ed Sanders 320206fe42 Rename input variables in media dialog
Change-Id: I9b8edfaccb163aff313e267bb1a0f74455502242
2014-11-12 19:51:48 +00:00
Alex Monk ba81c45da9 Restore selection after closing save dialog
Also simplify some weird focus code in MWSaveDialog

Bug: 72911
Change-Id: Ifb8fd9be96a199f86412247211e3920a35dd22bf
2014-11-11 23:55:39 +00:00
Roan Kattouw aa84df021a Followup a86d824: fix reference to this in foreach callback
Bug: 73235
Change-Id: Ib8f877f747df6c8047c7e3d2c152e0e7a9f60b8a
2014-11-10 15:22:19 -05:00
Roan Kattouw a86d824c56 Fix craziness in template dialog focusing
setMode() is called multiple times, but it didn't
check whether the mode being set was already set.
Because it's a setter, make it idempotent.

This fixes the problem where the first input will
be focused first, then blurred later, but it
introduces a new problem because the label for
the 'mode' ActionWidget is set from setMode().
To solve that, factor the setting of this label
out into its own function and call it on setup.

Bug: 73138
Change-Id: I9bb127f22f6c0b745b393c523ec42f320fc85cf3
2014-11-07 16:41:03 -08:00
Alex Monk 3628fc0ffc Disable review button while save dialog is pending
Bug: 65310
Change-Id: I7cfb5d84b91b4a20282e126b8c863c15519b5a9d
2014-11-05 23:36:33 +00:00
Alex Monk 0dde78bd54 Pass $overlay to redirectTargetInput in MWSettingsPage
So the TOC options don't display over the top of suggestions for it

Bug: 72838
Change-Id: I73f0f9e3a44a9f641b6bed2a42cac2c8293cc5c9
2014-11-01 04:49:36 +00:00
jenkins-bot 8f8613f27b Merge "MWTransclusionDialog: Blur active input when switching modes" 2014-10-31 22:55:24 +00:00
Roan Kattouw c324ed8b9a MWTransclusionDialog: Blur active input when switching modes
When show/hide options is clicked, the inputs in the main pane
move as the outline transitions in or out. This causes any dropdowns
below these inputs to become mispositioned: they don't move
because they're in an overlay.

To work around this problem, blur the active input when show/hide
options is clicked, so any dropdown attached to it is closed.
I tried blurring and immediately refocusing the active input to
force the dropdown to reposition itself, but that looks awkward
because of the transition (we'd have to wait for the transition
to complete before repositioning it, and during the transition
it'll stay open in the wrong place).

Bug: 72789
Change-Id: Ibd963690573af905066839f7276077089fa893c6
2014-10-31 04:19:41 +00:00
Roan Kattouw 884aa1f243 Add forgotten $overlay pass-through in MWReferenceDialog
We were doing this for the exact same widget in
MWReferenceListDialog, but not here.

Bug: 72785
Change-Id: I4a905b944be44ec1aec5cdba7580283ec18c5c7c
2014-10-30 14:50:10 -07:00
Alex Monk b71bb51171 Remove more references to ve.bind
Seems some of them have crept back in since I1a7fc7f2 (and we missed one somehow)

Bug: 72156
Change-Id: I5631fb7d5963d06aeb238c1daa44344b2060ef1a
2014-10-30 20:55:44 +00:00
James D. Forrester 6626450419 Toolbar: Make styling and insert menus collapsible
Also re-synchronise toolbar in MWMediaDialog and MWReferenceDialog.

Change-Id: I8cd5f0d9f7e188fa1a7ab8d34a2796340f5e99b7
2014-10-30 12:22:20 -07:00
jenkins-bot d73a692f57 Merge "Show warning on reference dialog when editing a reference used in more than one place" 2014-10-28 17:36:07 +00:00
Alex Monk 3846e20463 Show warning on reference dialog when editing a reference used in more than one place
Bug: 52792
Change-Id: I2b183c3867ddb601041f9989964aa6f78b5f37e4
2014-10-28 12:58:50 +00:00
Roan Kattouw 61e8115e8b Pass $overlay to widgets that need it
Also change this.$overlay (which doesn't even exist) to
config.$overlay in MWTemplatePlaceholderPage and document it.

Compensates for I39df86373ea in oojs-ui.

Change-Id: I4a233c058439d6cfb38d80ece890c8fe57d58f49
2014-10-27 17:36:19 -07:00
jenkins-bot 0dad360036 Merge "Disable parameter add icon when there's no transclusion parts" 2014-10-27 20:39:46 +00:00
Alex Monk d128378f5a Disable parameter add icon when there's no transclusion parts
Would put this code in onBookletLayoutSet, but that doesn't appear to be
getting called in this case.

Have to detect whether or not we should be changing the disabled status, rather
than just setting it straight away, which would break every other case where
onBookletLayoutSet is called.

Bug: 63158
Change-Id: I6f62479291424d9b2ee0e42481dec9d085169c63
2014-10-27 20:33:35 +00:00
Alex Monk c4dfd834dd Allow removing all parts from a transclusion to remove the transclusion
Rather than make a new function to determine whether it should be apply-able or
not (and run some checks again), move the enable/disable call into a new
function to do these checks and set the result.

Bug: 72191
Change-Id: I133afa1784e1afd44054f93ed84018894f7c6400
2014-10-25 00:13:29 +01:00
Moriel Schottlender 14e1de1009 Update initialHash after getting defaultDimensions in image model
On initialization, the image model has an initial scalable that has
the given currentDimensions from Parsoid; these are usually correct.
However, in cases where the wiki settings do not fit the user settings
and the images appear smaller or bigger in practice than the values
of the wiki-defaults, the initial hash will store the wrong values.

We will only know what the real values for the comparison will be
after we get them from the API and the calculation; only at that
point we can update the image model initial hash.

This is important so that later the dialog can properly understand
whether to enable the "apply" button if a user changed an image
to custom size and then back to default.

Change-Id: If17b50cc4a39993f98a20a3fec3ddf5d8cb400b3
2014-10-22 00:11:43 +00:00
Trevor Parscal 77eae16b88 Apply mw-body-content styles to SurfaceWidget
Changes:
* Override ve.ui.SurfaceWidget for use in MW
* Add mw-body-content class to surface view container
* Assert 1em sizing for surface view container to prevent
  mw-body-content from applying its own sizing
* Add new scripts and styles to RL config

Bug: 71652
Change-Id: Iac86facdc0c7a0e48c0f3617e2f6c2e7f001525e
2014-10-15 23:58:46 +00:00
jenkins-bot 1b6a234d09 Merge "Put category popups in the inner overlay for now" 2014-10-15 00:17:47 +00:00
Roan Kattouw 267212c531 Put category popups in the inner overlay for now
We really shouldn't need the inner overlay for this,
we should be able to deal with popups being in
oo-ui-window-overlay. But for now, we're not, and
this fixes the current problems.

Depends on If16d16d2b in oojs-ui.

Bug: 72052
Change-Id: Ie06056b96db19ac4caf1f9c0e3a1c49cfddc6682
2014-10-14 17:02:51 -07:00
Roan Kattouw ed33c2583c Followup 1fc13cc: fix JS errors caused by incorrect context binding
Bug: 71997
Change-Id: Idb84a1c9dad91ef69554acb73398c0a0e30fece2
2014-10-14 12:27:46 -07:00
jenkins-bot 8005868566 Merge "Make MWTransclusionModel and MWTemplateDialog extensible" 2014-10-10 20:40:19 +00:00
Christian Williams 1fc13cce68 Make MWTransclusionModel and MWTemplateDialog extensible
Wikia has done some work on the template user experience, including
automatically showing all available parameters without the use of
TemplateData. In order to make our changes, we had to make some changes
to VE-MW.

ve.dm.MWTransclusionModel.js
* this.specCache is created so subclasses can reference it.
* Promise handlers in the fetch() method have been broken out as class
  methods so they can be overridden in subclasses.

ve.ui.MWTemplateDialog.js
* addPromptedParameters() has been moved to the
  initializeNewTemplateParameters() class method so subclasses can
  overwrite. In Wikia's implementation, we have a method of getting
  all parameters and a dialog that shows all of the parameters, so the
  request to addPromptedParameters is overwritten.
* Added a done() handler to the transclusionModel promise for Wikia
  extensibility.

Change-Id: I073c5850420e7719e82957f879423c2717af674a
2014-10-10 20:38:18 +00:00
suchetag 7d82d173c6 Replacing title attribute with mixin TitledElement
The title attribute for byte counter in MWSaveDialog is replaced with the mixin TitledElement from label widget in OOUI

Change-Id: Ic4b37fac9e16b6db9091a16376e06d55bbb3d649
2014-10-09 22:57:04 +00:00
suchetag 36f95e4b21 Bringing back the edit summary byte counter in the save dialog
Bug: 71837
Change-Id: I14b1c8a8f0b8501e5ea5a3041f6aa99ae2529b2f
2014-10-10 02:56:01 +05:30
Roan Kattouw 77ba5c62c1 Followup 78e3a91: can't assign getValue() to $textarea, oops
Well spotted, Ed.

Change-Id: Ic3ce07591130d59fb2da5df2e410f39f672c71e1
2014-10-08 22:55:27 +02:00
jenkins-bot 922032f5d0 Merge "Replacing $input in save dialog" 2014-10-08 20:26:22 +00:00
suchetag 78e3a91455 Replacing $input in save dialog
Bug: 56647
Change-Id: I4703d0625767efd1b15bbc00848c77b322b43e53
2014-10-09 01:51:48 +05:30
Roan Kattouw 56953f89e4 Followup b8d8a5b: pass selections, not ranges, to SurfaceFragment#clone
Bug: 71825
Change-Id: I095d20840a1844f557a023f933aa1e6104138002
2014-10-08 20:00:21 +00:00
Ed Sanders 1af18c3c12 Update VE core submodule to master (984b57a)
New changes:
6bbcd6a Localisation updates from https://translatewiki.net.
b8d8a5b [BREAKING CHANGE] The Great Selection Rewrite of 2014

Local changes:
Update to use new selection/range API

Change-Id: I5480d5c77d599c93c2d374fac88bb2fdb68b0024
2014-10-07 21:39:33 +02:00
jenkins-bot 82e62f8ec6 Merge "Get confirmation when trying to insert/edit template/citation with required parameters missing" 2014-09-17 19:33:48 +00:00
Alex Monk b3ba809ccb Get confirmation when trying to insert/edit template/citation with required parameters missing
Relies on I5d894f8a in MW core. We'll need to update our wfUseMW when that gets merged.

Bug: 50747
Change-Id: I35e55658a3990121afe4d996ef4ee06547d2aa0c
2014-09-17 12:31:23 -07:00
jenkins-bot bdbc75473b Merge "Validate size widget when activating/deactivating apply button" 2014-09-16 23:54:26 +00:00
Moriel Schottlender 20c4fbbc1e Validate size widget when activating/deactivating apply button
In the Media Dialog, make sure the size widget is valid before
applying or disabling the apply/save buttons.

Bug: 70861
Change-Id: I6ec9eb69fe6576f1c668270b12157de9910f0214
2014-09-16 14:48:40 -04:00
Alex Monk 65b232a35b Show pending state on action button and keep dialog open when switching to source mode
Instead of doing a blocking overlay, we're simply keeping the dialog open,
which is necessary for the pending status of the action buttons anyway.

Requires Ib2c8f336 in OOUI

Bug: 65012
Change-Id: I65b5de4a1666a81b157a71f6fec490007689eb44
2014-09-15 20:44:55 +01:00
James D. Forrester b46159eeed Relabel the cancel button in the save dialog to "Resume editing"
Bug: 69116
Change-Id: I35289ff02681c3bf46a7bb491c017c500f30c7a6
2014-09-11 11:52:21 -07:00
Roan Kattouw e92e4912fe Followup cb86c4f: fix call to renamed setChanged() function
setChanged() was renamed to checkChanged(), but one call wasn't
updated. This was causing JS errors in a documentUpdate event
handler, which caused pawn nastiness.

Bug: 70450
Change-Id: I71e576638f9e2fde450f4412229cf980e6ba7e10
2014-09-05 14:50:24 -07:00
Moriel Schottlender cb86c4f030 Check for changes in the model
Create an image model hash and check for changes to the image every
time the dialog is changed, so we can activate and deactivate the
apply button properly.

Bug: 68058
Change-Id: I94b7e4879c6e752432c6f937a8cf1b9f15d1b56d
2014-09-04 14:05:01 -07:00
jenkins-bot 567b0e7d53 Merge "Use combo box widget to suggest existing values for reference group" 2014-09-02 20:21:32 +00:00
Alex Monk 802b018133 Use combo box widget to suggest existing values for reference group
Bug: 61574
Change-Id: I2ab47e79a8b90db8631d042c80b0759e9c250523
2014-08-30 02:33:04 +01:00
Alex Monk 14b23d7ba4 Make sure mediawiki.notification is loaded -before- calling ViewPageTarget#checkForWikitextWarning
That function needs to return the result immediately, not wait for module loading (via mw.notify).
This was breaking us being able to keep track of what wikitextWarning object was in use (but only
the first time we used the module), and therefore fail to close the warning when the wikitext
disappeared.

Bug: 70168
Change-Id: I0f1427423a5fe82ec8e70e2f0462a3044ca7ace8
2014-08-29 21:18:24 +01:00
jenkins-bot 1135d066ac Merge "Make the image model persistent" 2014-08-28 16:08:03 +00:00
Moriel Schottlender e34fdae776 Make the image model persistent
Make sure the image model can switch parameters when the image
source is switched, rather than having to instantiate a new
image model.

Also, when the image is changed, retain aspect ratio but make sure
to preserve the width of the previous image (unless the new image
is smaller)

Added 'resizeToBoundingBox' and 'scaleToThumbnailSize' static methods
in MWImageNode that return scaled dimensions based on the image
dimensions and the bounding box detals.

Depends on core change Idbb8b29db8e

Bug: 69450
Bug: 68000
Change-Id: I4327c86a9127f46da5522dc1197411fda757d5a4
2014-08-28 12:04:49 -04:00
Alex Monk c71d06f1e0 Toggle trash button (on transclusion dialog) visibility when changing to non-parameter pages
Bug: 70101
Change-Id: Id18f910ea9f96121584ece0270dda3f8529478dd
2014-08-27 21:00:34 +01:00
jenkins-bot 323fb9e712 Merge "Remove delete button from required parameters in template dialog" 2014-08-27 10:04:39 +00:00
Roan Kattouw 6fce4c6359 Make the Resolve conflict button actually appear
If you got an edit conflict, the save dialog would
dead-end: there was no way for you to actually get to
the edit conflict resolution page because we were
hiding the resolve button.

Bug: 69150
Change-Id: Iaccb7d0ec25d8f15398e437d614184433c33e6eb
2014-08-27 01:06:54 +00:00
Alex Monk 11fef44a08 Remove delete button from required parameters in template dialog
Bug: 60358
Change-Id: I5d03f466475bfafd4569480431969f5001365eb8
2014-08-26 01:39:51 +01:00
James D. Forrester a232147b11 Switch 'disallowQuotedKeysInObjects' jscs rule on and fix up
Change-Id: I75ac4b378ef485feead9d0eff34ed7877b94b5d0
2014-08-22 13:50:48 -07:00
jenkins-bot df85006b03 Merge "Refactoring ImageModel constructor" 2014-08-21 01:54:46 +00:00
James D. Forrester 67f304a414 Update VE core submodule to master (c4ce5ee)
New changes:
c4ce5ee Update OOjs UI to v0.1.0-pre (466a8762ac)

Update changes:
* Remove manager arugment from window constructors
* Use this.$content instead of this.frame.$content
* Use this.getDir() instead of this.frame.getDir()
* this.loading is now a promise, not a boolean

Change-Id: Ia83449a60078dd24ea4f976221c0859e5a121279
2014-08-20 18:42:52 -07:00
James D. Forrester 5148a0836a Rename "reference list" to "references list" internally
That's what we call them in human-speak, and it makes sense to have them align.

Bug: 49923
Change-Id: I8dcfba249fb9ea13c2b4052e98a4d253c302b1ba
2014-08-20 18:26:54 -07:00
Moriel Schottlender 88a0790aab Refactoring ImageModel constructor
This change creates the scalable object that's attached to the image
model through its constructor. Also adds a 'resourceName' variable
to store attributes.resource, which is mostly used for API calls.

Change-Id: I713c59d1cec5f87387a87c98a59e75b3d5c1050e
2014-08-20 18:13:12 -07:00
James D. Forrester 97c0894379 Label 'insert' buttons with just "Insert" instead of varying by content
Depends on VE-core change I23b0772a

Change-Id: Ia8fb88d3501ffa2c26add4419da5463a926f45d1
2014-08-20 14:23:57 -07:00
Roan Kattouw fbd7923741 Make MWMediaDialog not crash on API errors
resp.query won't be set if resp.error is set instead.

Also rename alignButons to alignButtons.

Change-Id: Ie69fe1ddae393ee02b44e9288a35e0dd47d17e4e
2014-08-16 00:30:16 -07:00
Moriel Schottlender c4c5add175 Fix bad jquery 'append' calls
There are several incorrect usages of jquery .append() method that
uses an array instead of an argument list. This isn't the proper use
of the method and while it does work now, according to Krinkle,
this might stop working in the near future.

Also see I76decb67db086bb387 for the same fix in ve-core.

Change-Id: I78a0d54ad76ab5401bc0532e636a9aaa2c0c0e04
2014-08-12 22:57:11 +00:00
Amir E. Aharoni 268c8677ee Flip direction buttons in media dialog in RTL
Flip the order of the buttons in the alignment widget
so that they display the directions correctly in both
ltr and rtl.

Bug: 69165
Change-Id: I7bd1d6c89aaef09492ae07eadababd68305b245e
2014-08-06 14:09:43 +01:00
Alex Monk e74e32b5af Tear down meta dialog pages when cancelling
Currently it's only being done when applying, caused by Ia74732e6. We
need the teardown event to reach the page so they can do things like
clear categories.

Bug: 68484
Change-Id: I6c31229121c1477a55ce955354770ed7cdde470d
2014-08-05 16:24:26 +00:00
Roan Kattouw c9e04f2211 Don't send API requests to preview empty (or whitespace-only) edit summaries
Change-Id: I1b75a012eebececa5fd53d5ceedb9221648182fb
2014-08-02 19:12:25 -07:00
jenkins-bot 06e883f66b Merge "ve.ui.MWMetaDialog: Really *ALWAYS* return to normal tracking behavior" 2014-07-31 07:51:26 +00:00
Bartosz Dziewoński bcd9c56701 ve.ui.MWMetaDialog: Really *ALWAYS* return to normal tracking behavior
This #getActionProcess method is kinda weird… introduced in fbdff762.

Bug: 68901
Change-Id: I5007a379445b286884814557a85c6efea5e5d4cc
2014-07-31 09:30:00 +02:00
James D. Forrester 1fcc9fa035 Update VE core submodule to master (61dea59)
New changes:
76bbf3b [BREAKING CHANGE] Fix camel-casing of countNonInternalElements

Local changes:
Use renamed countNonInternalElements function

Change-Id: Ib5f86ea5cfeb5e577f61349ed4bbb231ea155638
2014-07-29 17:15:35 -07:00
Moriel Schottlender 50dae0ab16 Focus the caption surface on initialization
Whenever the edit mode is active, focus the caption surface. This
is also true for cases where the dialog starts in the 'insert' mode
and then switches to 'edit'.

Bug: 68806
Change-Id: I60b862dc5738a65a6bb31eb32184c35cc108b232
2014-07-29 15:34:09 -04:00
Ed Sanders c23cebd5f6 Comment used messages
Change-Id: I22594b11f06f349c43162d52646a5c647c6ad0a3
2014-07-28 13:08:39 +01:00
Roan Kattouw 7cc31d0c34 Actually show the corruption warning in the save dialog
It was being set, then immediately cleared again.

Also remove the unused dirtymsg div.

Change-Id: I22e5fbe814d14684626a7502d2401f414838709b
2014-07-25 11:39:03 -07:00
jenkins-bot 9774ceed20 Merge "Bump the height of the references list a little" 2014-07-24 00:43:02 +00:00
jenkins-bot 3771aa92c1 Merge "Make the image model work without a node" 2014-07-24 00:32:54 +00:00
Moriel Schottlender 1bc7d074fe Make the image model work without a node
The image model should go by image attributes (whether it comes from
an existing node or a new one) and not a node.

Bug: 68242
Bug: 68000
Change-Id: I4cabd678157619331b3c47d3b44bc16a28fd7bd7
2014-07-23 17:27:30 -07:00
James D. Forrester 833baef313 Bump the height of the references list a little
Bug: 68226
Change-Id: Ic3c7b31dcaa6f7f8da3d86efab8c7ab94f4b1e62
2014-07-23 17:24:21 -07:00
Ed Sanders d8d3a8c98e Defer building of MWReferenceSearchWidget index
It can be very slow on pages with lots of references and
isn't required until you click 'Use existing reference'.

What is required is knowing if the list will be empty for
greying out the button, but that can be precomputed very cheaply.

Change-Id: I56909801a5685bb04e0c83cfb95463f705b8dfae
2014-07-23 15:12:31 +01:00
jenkins-bot e9f78820c3 Merge "Fix reference dialog focus" 2014-07-23 02:08:32 +00:00
Ed Sanders 24c322a124 Use native focus
It's faster.

Change-Id: I0a8a2452aa987e2b93c5c8ba3c6efa2bcafbaa86
2014-07-22 19:05:14 -07:00
James D. Forrester 27c30322ed Clamp height of MWReferenceDialog to between 300 and 400px to avoid it being too small
Bug: 68232
Change-Id: If32edc5622565b28ae1f6a2423a7c2289965733c
2014-07-22 18:57:39 -07:00
jenkins-bot f7c7efbad7 Merge "test: Move mw into the global list of globals for VE-MW" 2014-07-23 00:02:22 +00:00
jenkins-bot 016c93c29b Merge "Auto-open "Add parameter" part of template dialog when tabbed to or opening with no required/suggested params" 2014-07-22 23:37:41 +00:00
James D. Forrester a9356992d8 Put "re-use reference" in the toolbar "Cite" menu, and give it an icon
Bug: 68201
Change-Id: I9fc61e498748fb086c3e506959bee2438b8cbea6
2014-07-22 13:10:06 -07:00
jenkins-bot 107ce12f9d Merge "Fix heights of Reference, ReferenceList and Template dialogs" 2014-07-22 16:11:39 +00:00
Alex Monk 42db347213 Auto-open "Add parameter" part of template dialog when tabbed to or opening with no required/suggested params
Bug: 55925
Change-Id: I8475074e25de3969717a6d4dbb88bbb0000ebb4e
2014-07-21 22:38:05 +01:00
Ed Sanders 9bc8d07486 Fix reference dialog focus
Wasn't migrated to processes.

Change-Id: Idb5f614c172378aad5d37bf8f726adad338c3eb1
2014-07-21 13:58:48 +01: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