Commit graph

437 commits

Author SHA1 Message Date
Trevor Parscal f30336bc2e Always initialize data before use
LinkNodeInspector was broken when you clicked away/pressed escape, because data was not set.

Normalizing on data being initialized at the top of get*Process methods if used.

Change-Id: I89728ac558545a6f2c325014b6f457ec6bef17b8
2014-07-15 15:49:51 -07:00
Trevor Parscal 8ebea5a75b Close the citation dialog after the apply changes button is clicked
Change-Id: If3976389f0a1574fce993f5b79b9b18067a88878
2014-07-14 17:09:24 -07:00
James D. Forrester fbdff76263 Update VE core submodule to master (f2277ea)
New changes:
56de6f5 Localisation updates from https://translatewiki.net.
f8bda64 Widgetise demo menu
6ac48d8 Localisation updates from https://translatewiki.net.
365e131 builderloader: Omit value for boolean "disabled" attribute per HTML5
706e4b3 Prevent double counting of DM nodes in getNodeAndOffset
b141a7d Update OOjs UI to v0.1.0-pre (d2451ac748)
c5b3921 Localisation updates from https://translatewiki.net.
1606983 Update reference to ConfirmationDialog to use MessageDialog

Deletions:
* Styles for ve.ui.MWBetaWelcomeDialog - not needed anymore because
  OO.ui.MessageDialog provides them
* Styles for ve.ui.MWGalleryInspector - not needed anymore because
  ve.ui.MWExtensionInspector provides part of them and the rest are being
  replaced by programatic sizing

Modifications:
* ve.ui.MWLinkTargetInputWidget - Added support for validation and href
  getter
* Split message between tool and dialog title for ve.ui.MWEditModeTool
  and ve.ui.MWWikitextSwitchConfirmDialog

General changes:
* Updated inheritance.
* Added manager param to constructors of dialogs and inspectors.
* Updated use of show/hide with toggle.
* Added meaningful descriptions of dialog and inspector classes.
* Configured dialog and inspector sizes statically.
* Configured dialog action buttons statically.
* Interfaced with OO.ui.ActionSet to control action buttons.
* Moved applyChanges code into getActionProcess methods.
* Always using .next in setup/ready process getters and .first in
  hold/teardown process getters.

Change-Id: Ia74732e6e32c0808eee021f0a26225b9e6c3f971
2014-07-14 23:24: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 c2c046620b Apply 'original size' to images and enable apply button in ve-MW
Depends on core change I243cff5a2d56db48882c343a8bb91153edd96a43

Bug: 66863
Change-Id: If7914c254b70f4b2b9e2788f5755550eb020b21c
2014-07-08 13:11:07 -04:00
Roan Kattouw 1261ad4b3d Followup 26fd3777: hide "Go back" in insertion mode
"Go back" should only be shown if there's something to go back to.
So it should be visible if you came from "Change image", but not
if you came from "Insert media".

If the "Go back" button is hidden, the footer is empty, so hide it
completely in that case. Hiding the footer is tricky due to how
dialogs position things, so I hacked around OO.ui.Dialog's lack
of an API for toggling the visibility of the footer.

Change-Id: Ic97c4a2bf7beaa240e5a4dfda1e605752e1f4189
2014-07-02 18:00:58 -07: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
Moriel Schottlender 6bd9fde5c5 Merge Media Edit and Media Insert dialogs
Merge the media edit and media insert dialogs. Allow editing
of media properties when inserting a new image, and also
allow the user to replace the image on edit.

Bug: 67170
Change-Id: I35bd95503565dbf95090ee8110284db5a8fbba83
2014-07-01 17:30:51 -07:00
James D. Forrester f9e74d3c62 Move reference tool into Cite menu, and language into styling
This puts reference insertion and editing tools into the same menu (yay) and
applying-annotations-to-text tools into the same menu, too.

As part of this, I'm re-labelling the generic reference tool to "Basic" (now
that it has some context for users).

Change-Id: I8b8196d3c2e40237d61c8491ab30e737b82597d6
2014-06-30 19:24:15 -07:00
jenkins-bot 87663c99e0 Merge "Offer to retain changes when switching to the wikitext editor" 2014-06-30 23:40:30 +00:00
Alex Monk 237d68f6db Offer to retain changes when switching to the wikitext editor
Bug: 57462
Change-Id: I4e57f9dff4479531e7c715966bdad2cabb97ca8c
2014-06-27 22:31:07 +01:00
Alex Monk e3e116f0ae Set tabindex for template dialog info/remove buttons on parent <div> rather than <a>
Makes Firefox happy. Not sure why.

Bug: 66824
Change-Id: I6cf69c7ea36dc7870af59e7edc2f137143ba7ad5
2014-06-27 21:48:59 +01:00
Ed Sanders 4b9c91f164 Fix fragment after inserting an image node
* Return the fragment as it may have been cloned in the process
* Do away with DM node tree traversal, we can do everything
  with offsets.

Bug: 65706
Bug: 65716
Change-Id: I9a44d562d9365d72adac199725b52555cf0a8009
2014-06-19 17:45:21 +01:00
Moriel Schottlender 82745fed46 Insert images at the start of paragraphs
If a block image is inserted in the middle of a paragraph, insert
the image at its beginning so the paragraph isn't broken.

Bug: 65883
Change-Id: I7b82c647d259a6712a771bb4243b269ecbb73c9c
2014-06-18 19:27:08 -04:00
Ed Sanders c0bd7487f5 Fix selection after inserting nodes
Some surface fragment methods return a clone, so make sure
that is written back to this.fragment in dialogs, as this.fragment.select()
is called on teardown.

Functionally depends on If26cc0a2d in core.

Bug: 65706
Bug: 65716
Change-Id: Ia552b2a4c4c59ffc308a4acdecac78a7803a1c1f
2014-06-18 22:45:52 +00:00
jenkins-bot f8dbe1878c Merge "Show wikitext warnings in the reference and media caption dialogs" 2014-06-18 21:00:29 +00:00
Krenair 143c21999e Port MWSaveDialog to use ActionDialog
Relies on Id17d150d

Change-Id: I80dd89fa7ad55daa3ae7e9c01c4a78f6e54105ca
2014-06-18 20:43:45 +00:00
Krenair 046979ae80 Show wikitext warnings in the reference and media caption dialogs
Bug: 56213
Change-Id: I9da0ae627a990864cc8b9466d97c4419f315f65e
2014-06-18 16:12:02 +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
Ed Sanders 0791d86b77 Update VE core submodule to master (4d919d2)
Implement new language platform functions.

Also remove unused MWLanguageSearchDialog and MWLanguageSearchWidget.

New changes:
4d919d2 [BREAKING CHANGE] Move language functions to the platform

Change-Id: I54c0a8e5816a3c81851f95f1d3062a6091a9f4a3
2014-06-12 19:42:35 +00:00
Trevor Parscal 06f00d73ae [BREAKING CHANGE] Update VE core submodule to master (43a48cb) for window process cleanup
* Update size of save dialog earlier on, and swap back to save panel in
  save dialog on setup instead of ready to avoid scaling and sizing
  simultaneously
* Update use of closing/closed/opening/open events to use
  setup/ready/teardown events instead

New changes:
43a48cb [BREAKING CHANGE] Update OOjs UI to v0.1.0-pre (9f4f250f88) for window process cleanup

Bug: 65705
Bug: 65343
Bug: 60843
Change-Id: Idf6f85ae12f6ca80fde57a400cb5b11270938c1a
2014-06-12 00:42:13 +00:00
Moriel Schottlender 80d1240734 Disable/Enable alignment select widget with checkbox
The test of whether to update the model should only apply to model
and not GUI operations.

Change-Id: I594793cbf69b41cd8fe02067e9985dd1030af95c
But: 66288
2014-06-10 15:18:36 -04:00
Moriel Schottlender 9f2d31cfa0 Disable the size widget for 'frame' images
Frame images are not resizable; disable the media size widget when
the frame type is selected.

Depends on the change in ve-core:
Id1010798d30e2928358acb5694c429b9ab68ad57

Bug: 66353
Change-Id: I8c8da8933c51ba709a834731425d19445009673f
2014-06-10 18:43:25 +00:00
Moriel Schottlender cd3cbf1f9b Initialize 'default' size properly in media edit dialog
Make sure that image model and media edit dialog initialize the
default size properties according to the scalable correctly.
Also make sure that on creation of a new node or edit of existing
node's properties follow on whether the image is set to default
size or custom size.

Depends on the ve-core change:
Ia6bb041bfc050a48d8c40bbff4b73ed2893085e2

Bug: 66149
Change-Id: I6f60fba28e11a111bb40a100148ed1f12d518890
2014-06-09 19:39:15 -04:00
jenkins-bot dc5d7351d3 Merge "MWReferenceDialog: Allow swapping of existing references for others" 2014-06-07 00:55:19 +00:00
Krenair fdc3cb2710 MWReferenceDialog: Allow swapping of existing references for others
By disabling the selection button instead of hiding it.

Also make sure that there are other references before re-enabling it.

Bug: 65689
Change-Id: Ifb3d6ab6eacb71909eb13e3a72e971b49e2595c1
2014-06-06 16:30:03 -07:00
Ed Sanders a425ab4812 Move save panel init to getReadyProcess
Bug: 66168
Change-Id: I903d2892b56e531fa8d4d44873a3889b637e0f09
2014-06-06 11:51:27 -07:00
Moriel Schottlender 8bca6add25 Fixing issues in the alignment select in Media Edit dialog
Fixing the behavior of alignment select and checkbox in the edit
dialog. Adding a check on all UI events to make sure they update
the model only if the model value is different than the UI value.

Also adding the ability to check the default direction of a
specific node type, to predict default alignment values.

Bug: 65916
Change-Id: I82f624fa788383dec0a12afb473aef01593e670e
2014-06-05 21:20:44 -04:00
jenkins-bot cc14f33be9 Merge "Followup to small SVG default size" 2014-06-04 23:44:24 +00:00
Moriel Schottlender 4355ea4f10 Followup to small SVG default size
Make sure svg drawings on block images have the default size as
the wiki default, no matter their original set size.

Also took the opportunity to clarify the synchronization method
for scalable and image type in ve.dm.MWImageNode and call it when
the image model is loaded to make sure the details are always
synchronized before edit.

Followup to I682d832e456a501836f33ed1dfc7dbd78a4edf53

Bug: 62893
Change-Id: Ic47016d171634c532092067957cc2c3d431e9746
2014-06-04 19:38:15 -04:00
jenkins-bot 462a84787f Merge "Add tabindexes to template editor and required attribute where appropriate" 2014-06-04 23:28:21 +00:00
jenkins-bot 0ce474ab47 Merge "Don't allow inserting blank citations" 2014-06-04 22:57:27 +00:00
Alex Monk da5398909e Don't allow inserting blank citations
Bug: 64715
Change-Id: I76782bda12f7fbd7a162f179b78e1a36187a9257
2014-06-04 23:52:22 +01:00
Krenair 652136d712 Add tabindexes to template editor and required attribute where appropriate
At the moment, the natural tab order appears to simply ignore the info and
removal buttons

Bug: 65474
Change-Id: Ib18a9f7b0ce614bed9fee1199f1d36bc4bc012b9
2014-06-04 23:39:36 +01:00
jenkins-bot c8358205bd Merge "Adjust default alignment when switching from inline to block" 2014-06-04 22:37:06 +00: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 74a20b8ec9 Adjust default alignment when switching from inline to block
Once more with feeling; default alignment when switching between
inline to block and vise versa. This time, the problem was mainly
that the checkbox for position cannot be updated without triggering
its update event. It was triggered, however, before setting up the
positioning, which caused the model to run positioning twice and
get things wrong.

Another smaller fix in this commit was done to make sure that
the image model remembers the previous alignment, so when image
type changes from inline to block and vise versa, and the alignment
was default, it can recalculate default value for the new node.

Bug: 65564
Change-Id: I6c16a7855ad7e3ce302fa3d042d0a402251b31f0
2014-06-03 00:20:57 -04:00
Krenair 390d8ca793 Fix reference dialog apply button disabling when modifying existing reference
Existing references keep internal records of current saved data, which breaks
the current length check. Instead, use the new function to count all
*non-internal* elements

Relies on I8ecbf387
Related to bug 52182

Change-Id: I4b9bb866babe018d75dc083fab35375b9fb53d3c
2014-06-02 17:12:12 -07:00
jrobson fef33d30ec Add use existing reference to toolbar on mobile
Note currently a blank icon appears to the left of this.
This will need to be removed later.

Change-Id: Ia8be1f0e83a2154a48de3c3a47bd8feb0c9a2a2c
2014-06-02 12:12:32 -07:00
jenkins-bot 98f403f237 Merge "Use <visualeditor-toolbar-cite-label> correctly in the Media and Reference toolbars" 2014-06-02 17:38:36 +00:00
Trevor Parscal f58861b6c3 Cleanup save dialog counter label
This label is not needed, never visible, not internationalized and doesn't make sense.

KILL IT WITH FIRE!

Change-Id: Ia0b3eda5971598714644b9d0c4fec1fd44b6c440
2014-06-02 09:57:24 -07:00
Amir E. Aharoni c27d62d19f Use <visualeditor-toolbar-cite-label> correctly in the Media and Reference toolbars
Bug: 66039
Change-Id: Ie9cba04a0f117e1d5fb25a93f81df423787a9d79
2014-06-02 09:49:48 -07:00
Trevor Parscal f65c3c6ef1 [BREAKING CHANGE] Update VE core submodule to master (88fe25f)
Switch to processes for windows (dialogs/inspectors)

This conversion also required the splitting of MWLinkInspector into
MWLinkNodeInspector and MWLinkAnnotationInspector.

New changes:
88fe25f [BREAKING CHANGE] Update OOjs UI to v0.1.0-pre (dd888aba5c)

Change-Id: I662d8985463c9fc881775f70aef87ebeb454a73f
2014-05-30 22:03:45 -07:00
Alex Monk 96bcc2dc55 "Use an existing reference" in the reference dialog should be disabled when there is content
Bug: 65689
Change-Id: I55f7af71957634f5c19996be02a51af0288e9e2f
2014-05-30 21:04:51 +01:00
jenkins-bot a7bf8b6a7f Merge "Convert toolbar structure group from bar to list" 2014-05-28 23:06:36 +00:00
Moriel Schottlender f9df17c052 Another default alignment fix to MWImageModel
This time in the installment: Allow the model to predict the type
and default alignment based on parameters rather than just the
current status. This is important for initializing images, especially
inline images whose 'align' attribute is null or undefined, but must
be examined for default alignment.

Also changed:
* Make sure that model operations change each other, rather than
  let the editor change 'unrelated' model parameters.
* Use selectItem rather than chooseItem to avoid emiting the 'choose'
  event on edit dialog initialization.

Bug: 65564
Change-Id: I8c23fc53e7738d59565294d8b98fe7351bebbc67
2014-05-28 18:05:00 -04:00
Moriel Schottlender 7a6f59920d Fix default alignment in MWImageModel
Make default alignment a computed value, and make sure the GUI listens
to 'choose' instead of 'select' events for SelectWidgets so to prevent
recursive calls and make sure the GUI is updated properly.

Also added a default alignment check on type change so the user can
visually have an indication that the new image will have a different
alignment. The user can then change the value manually.

Bug: 65564
Bug: 65596
Bug: 62852
Bug: 65617

Change-Id: I55e16775d18e0a4bf7f1fa73bbb3aa5e0aa51a79
2014-05-24 03:22:52 +00:00
James D. Forrester 47e19a9873 Convert toolbar structure group from bar to list
Aligns with I84a4d948ae in stand-alone.

Change-Id: I533355a20bb329b91d6550bde4afa18180b38f59
2014-05-22 17:47:29 -07:00
Moriel Schottlender d8040dbffc Don't update image model twice
The image model is updated through events from the edit dialog.
There is no need to update the states of the select/checkboxes
at the end in 'apply'. The only inputs that are not updated
on change are caption and alternate text.

Bug: 65564
Change-Id: I18c009546120e270467418cff677ec491fd109ca
2014-05-21 14:41:33 -04:00
jenkins-bot 5798569c73 Merge "Image model and the media edit dialog" 2014-05-20 01:15:31 +00:00
Moriel Schottlender 37b3c07b26 Image model and the media edit dialog
Creating an MWImageModel that handles all image edit operations.
If the new attributes mean a change of image types from inline
to block or vice versa, the model will handle the creation and
insertion of the new node.

Change-Id: Ibe71bc8bd74e4ba5a024ac722432ccf0b8f65e71
2014-05-19 21:11:06 -04:00
Timo Tijhof 37087f1f5f MWTransclusionDialog: Remove setMode() call from teardown()
teardown() runs after the dialog has been hidden (if you need it
to be visible, use close() instead).

However removing it instead of moving because it is obsolete,
this is something that should be done from setup() instead, and
already is.

Bug: 65373
Change-Id: Ib6b4ab49f191d1d339e69934453786a82d97380f
2014-05-19 20:44:38 +02:00
Ed Sanders ddf88a5633 Fix styling on save dialog
Apply styles directly to textarea instead of wrapper div

Change-Id: Id2340cb81dd343266b8a57ae91057fa3015a47e0
2014-05-19 18:41:06 +01:00
Ed Sanders bd3b5ffc4f Initialise save panel on 'ready' so focus works
Bug: 65222
Change-Id: I18a0191a3013332621e44455ea59d5f8d683117e
2014-05-19 17:23:38 +01:00
Timo Tijhof 25d00cc777 build: Update jscs and jshint
jshint:
* Update to grunt-contrib-jshint v0.10.0 (jshint v2.5.0).
* Remove coding style options covered by jscs.
* Enable new option "freeze" (prohibits changing native prototypes).
  http://www.jshint.com/blog/new-in-jshint-oct-2013/#option-freeze
* Re-order to match http://www.jshint.com/docs/options/

jscs:
* Update to grunt-jscs-checker v0.4.4 (jscs v1.4.5).
* Format .jscsrc file in a more spacious way and order the
  properties less arbitrarily (using the jscs's readme order).
* Enforce more details of our coding style
* Get rid of the unsable "sticky" operator rules which have been
  deprecated in favour of using other rules instead that are able
  to enforce this more accurately.
  - disallowLeftStickedOperators: Remove deprecated rule.
    * Ternary covered by requireSpacesInConditionalExpression.
    * Rest covered by requireSpace{Before,After}BinaryOperators.

  - requireLeftStickedOperators: Remove deprecated rule.
     * Comma covered by disallowSpaceBeforeBinaryOperators.

  - requireRightStickedOperators: Remove deprecated rule.
    * Logical not (!) covered by disallowSpaceAfterPrefixUnaryOperators.

See also If46b94ce1, Ib731f11b1 and I0b0cadbc5 in oojs/core.

Also:
* Update grunt-contrib-watch to latest upstream version.
  Change log at https://github.com/gruntjs/grunt-contrib-watch/blob/v0.6.1/CHANGELOG#L1-L17

Change-Id: I6c5a34afea8b05a3dca617897c192594df06ca90
2014-05-15 16:52:34 +00:00
Moriel Schottlender 2731b1ee48 Make sure originalDimensions are available before use
Before applying default size based on originalDimensions, make sure
these are available through the scalable call. The image will be
marked as default size, but the presentation will depend on whether
or not we have the defaultDimensions from the API.

Bug: 65239
Change-Id: I41b30498713e969bd24ef0ad3e9a074c6ffcdc3b
2014-05-13 15:53:30 -04:00
Roan Kattouw 0bcab80d2a Stop explicitly setting autoFocus to true now that it defaults to true.
Change-Id: I8544cf83d8665848b8da8a7e2bbef9f8518e23ef
2014-05-05 14:18:12 -07:00
Trevor Parscal 62324167ff Update VE core submodule to master (a1e9df1)
Also adjust calls to InputWidget methods changed in
I324dfc2 in OOUI.

New changes:
9da32d7 Update OOjs UI to v0.1.0-pre (e6edd86d37)
b6aa671 Localisation updates from https://translatewiki.net.
1cba6e0 Update OOjs UI to v0.1.0-pre (9a6c625f5f)
94629f9 Localisation updates from https://translatewiki.net.

Change-Id: Id58d199c7ce3332a104ab2a5c395561ab94ae060
2014-05-02 15:50:32 -07:00
Ed Sanders 5a65cb67fb Fix typo: this.transclusionNode -> this.selectedNode
this.transclusionNode doesn't exist. Also remove instanceof checks
as they are already done in #get(Selected|Reference)Node.

Bug: 64717
Change-Id: I7ff0133d1ad45edda8de2cbad459706dbaceb5f2
2014-05-02 16:48:10 +01:00
Ed Sanders 65d92173ea Use correct fragment in windows
In two cases we were using fragment.getSurface().getFragment() which
creates a new fragment from the current selection instead of using
the range of the original fragment.

Change-Id: Ib41efe2ceb670a125c0c306d143e56f9b9c349e7
2014-05-01 11:58:25 +01:00
Roan Kattouw dfbb7815e9 Make reference list dialog small again
Also remove now-useless size setting in save dialog

Bug: 64670
Change-Id: I1abc760a27ce2b107a92413ff3d5da7d95915dc2
2014-04-30 18:05:41 -07:00
jenkins-bot e52883df5a Merge "Restyle parameter pages" 2014-04-30 23:32:44 +00:00
Trevor Parscal 853e4872b4 Restyle parameter pages
* Move description to a popup behind a little info icon button
* Make required indicator generic status indicator (required/deprecated)
  and move to left of the field
* Move param name and actions to above the field
* Show deprecated status and description

Bonus:

* Use auto-focus on CitationDialog (whoops!)
* Make pages that aren't meant to scroll not scroll (whoops again!?)

Depends on I59211b2 in OOUI

Bug: 53612
Change-Id: I3b968ad14aa6c43b6484e2565a9367d2ebc72fc5
2014-04-30 16:27:19 -07:00
jenkins-bot be8b5b0783 Merge "Bring the transclusion title back to life" 2014-04-30 22:28:00 +00:00
Trevor Parscal c04c0f750e Bring the transclusion title back to life
At some point getTitle was changed to updateTitle but the caller was still
assuming it would return a string. Also, we removed the transclusion
dialog title message, but were still trying to use it.

Changes:
* Change the logic so we use the parent method for updateTItle correctly
* Bring the transclusion title message back

Bug: 64671
Change-Id: I3beb8b1d4304ba73c428868b9ac2d0f6a1cc9944
2014-04-30 21:41:19 +00:00
Trevor Parscal 03306d8528 Make inserting existing references work again
When MWReferenceDialog was modified to inherit from ActionDialog the
search select method didn't get changed to call applyChanges. But really,
you can't just call applyChanges because you need all the promise setup
stuff that onApplyButtonClick does. The API for ActionDialog needs to be
improved, but this works just fine in the mean time.

Bug: 64677
Change-Id: Ib38a624811dc26ead7b9de64cb41aff642820452
2014-04-30 21:11:17 +00:00
jenkins-bot c3a043f206 Merge "Call clearAllMessages in setup instead of swapPanel on the save dialog" 2014-04-30 18:19:14 +00:00
Ed Sanders 265a739c07 Use window 'ready' event to focus surfaces
Depends on I57864586b in OOUI.

Change-Id: Ic9a6e8d466c4d8b1273f54e621bb5a6cab50be53
2014-04-30 11:15:41 -07:00
Trevor Parscal e4e6f8883e Use ActionDialog and NodeDialog
Based on I70e88f6 in VE core

* Cleanup dialogs by using node dialog and action dialog
* Move "Loading..." text from label of dialog apply button to dialog title
  (repurpose identical message)

Save dialog will be converted in a follow up.

Change-Id: I6a290f4bdc29e577c7c89b4babdab5853c4c10e5
2014-04-29 17:27:14 -07:00
James D. Forrester 3569efba3b Use TemplateData's suggested status for parameters
Change-Id: I8c8522d1fcc7e7b26984d72a8f8aaaedbddb9cb4
2014-04-28 12:10:31 -07:00
Krenair 7645b9805b Call clearAllMessages in setup instead of swapPanel on the save dialog
Was clearing things like captchas when swapping panels. It still makes
sense to clear these when opening up the dialog though.

Bug: 62766
Change-Id: I37ceeebc672e2866b805631b189108d8363bdc9f
2014-04-25 22:44:39 +01:00
Ed Sanders 2bc50e2e83 Image frame icons
Change-Id: Icc2d4f44db2860ce11b8022035ba670d7d5bf064
2014-04-24 10:50:00 -07:00
Ed Sanders be36dfca25 Use core language search dialog
Depends on I21a9d7e in core.

Change-Id: I12cacf775b490d7c676011a5a154deeefe5527c5
2014-04-23 18:43:03 -07:00
Trevor Parscal 30d9d99ae4 Make citation dialog display like transclusion dialog in single mode
This is a hack, should be cleaned up soon.

Bug: 64199
Change-Id: I01effbfd0fc6da41596c73e375d237443ebb9d70
2014-04-23 17:36:49 -07:00
Roan Kattouw ba455643fc [BREAKING CHANGE] Update VE core to master (cb2e61b)
Update dialogs and inspectors for breaking change in VE core

New changes:
a553012 [BREAKING CHANGE] Merge dialog and inspector actions into window actions
f9a0419 Localisation updates from https://translatewiki.net.
cbe81a0 Fix path to spinner in ve.ui.SpecialCharacterInspector.css

Change-Id: Icf90ace6442364283b66b234e3c78fc65212f070
2014-04-21 15:32:59 -07:00
Krenair b6f1793bf8 Use new OOUI pending feature rather than loading bar thing on save dialog
See I5c45cc6 for the oojs-ui change and I2fa71a1d for a similar commit

Change-Id: I77e3274a196bc13ae19a9520197f4a8b624fd528
2014-04-18 21:57:14 +01:00
jenkins-bot f002889376 Merge "Make transclusion dialog "pending" while loading" 2014-04-18 20:12:05 +00:00
Trevor Parscal 062b2ed681 Make transclusion dialog "pending" while loading
Also, only allow animation of anything after things are ready

Depends on I5c45cc6 in oojs-ui

Change-Id: I2fa71a1d9a43db960aac4c1fad87eae96c898fad
2014-04-17 15:06:11 -07:00
Trevor Parscal 89f040626e Disable transclusion dialog mode button while loading
Change-Id: Iec8ea9d490b43504d25ecf05bd4a43701d503c35
2014-04-17 15:03:43 -07:00
Trevor Parscal 926700fbca Re-split the transclusion dialog
We used to have two dialogs; a complex one, and a subclass that dumbed it
down - this was rubbish.

Then we merged them together - this was a'ight.

Now we have two dialogs again; a simple one, and a subclass that fancies
it up a bit - this is wicked keen broham.

Change-Id: I4b2ba31bed5c4f80940623702d635cacd19e0a66
2014-04-17 01:39:18 +00:00
Roan Kattouw 9d1b7432fd Also focus surface in media edit dialog
16ec8ffdcf did this for the reference dialog, but the media edit
dialog needs it too. Additionally, we need to focus it when the
user switches to a different page then comes back.

Bug: 63909
Change-Id: If1b9587f4d10dbe6374e987b35c781954bcc566d
2014-04-16 15:12:39 -07:00
jenkins-bot 4d6a59b16b Merge "Focus the surface in the reference dialog after it opens" 2014-04-16 19:00:51 +00:00
Roan Kattouw d335e59330 Fix another surfaceModel.getFragment() in MWCitationDialog
Change-Id: Ic12652bf3d53396f84d558595ce1e4a2d0a22796
2014-04-16 11:42:15 -07:00
Roan Kattouw 16ec8ffdcf Make inserting reference lists work again
surfaceModel.getFragment() is a null fragment, use this.getFragment()

Bug: 64012
Change-Id: I995929ff0dda60220e17e579994b51ffb406f149
2014-04-16 11:40:26 -07:00
Moriel Schottlender fa72f5fdc2 Border checkbox disabling/enabling fix
Due to a lack of clarity in the wikitext documentation the border
checkbox wasn't set up right. This is the proper behavior: border is
allowed for all unframed images (frameless and basic) while the
framed images (frame and thumb) have it anyways. Wikitext
documentation was also clarified for prosperity.

Change-Id: I4dd4775da473d669781553796be99646240c13fe
2014-04-16 13:14:58 -04:00
Moriel Schottlender 8d99aa88c8 Fix border checkbox
Make sure border is enabled for unframed types and disabled for
framed images.

Change-Id: I716e9bc4140fbc09aac52930d1dd8213f31617a3
2014-04-16 00:03:35 -04:00
Roan Kattouw b764ecc7f4 Focus the surface in the reference dialog after it opens
Otherwise the surface ends up in a weird half-focused state which
causes it to behave strangely.

Bug: 63909
Change-Id: I3ebc30fde0202116b383a5b497aca65b66732922
2014-04-15 22:25:41 +00:00
Trevor Parscal 9e6451d40c Fix inserting references list while selecting another kind of node
There are two ways dialogs determine if they are inserting or updating.

1. They evaluate whether the dialog is inserting or not and set a boolean
   flag, used later to steer the saving code

2. They evaluate whether the dialog is inserting or not and, if not,
   store the node to be updated in a property, used later to steer the
   saving code

In the reference list dialog, setup used strategy 1, and teardown used
strategy 2. We've now normalized to use strategy 2 in both methods, which
fixes this bug.

Bug: 61885
Change-Id: I1b077b2aef4121328bce2b373874dd7373e405a1
2014-04-14 19:44:28 +00:00
Ed Sanders 340a939c97 Remove remaining uses of surfaceModel#getSelection in dialogs
These were being used indirectly in the MW*Model's. Use surface
fragments instead.

Fixes I0fae3e5ff2bd.

Change-Id: I1d6aa5e00a9315cf7088f87f9e9d828833feec64
2014-04-11 11:14:43 -07:00
Ed Sanders 0e51180709 Update VE core submodule to master (55a5cdc): use new ve.ui.Dialogs and ve.ui.Inspectors
Move various bits of code from initialize to setup as required.

MWDialog is now useless so use ve.ui.Dialog directly.

New changes:
0b2d03f [BREAKING CHANGE] Pass fragments, not surfaces, to windows (reprise)
0101ac4 Update OOjs UI to v0.1.0-pre (ac6848398c)

Change-Id: I0fae3e5ff2bd0da5b74c244af226b07b1f5883bd
2014-04-09 20:28:30 -07:00
Roan Kattouw f2422d916c Update VE core submodule to master (c150259) for scalable changes
ve.dm.Scalable is now a computational model for image scaling and
size manipulation. This commit adjusts the nodes and the edit and
insertion dialog to handle the new scalable model, and by that
use a centralized computational engine for all scaling and size
changes.

New changes:
3ec19fb8 Refactor Scalable functionality

Change-Id: I017a017924f544cc8bc9b7d8245335759ae0e890
2014-04-09 17:29:49 -07:00
Ed Sanders 164cf27299 Use new model directionality in MW
Depends on I2065e17020dc89 in core.

Change-Id: I6e99db601af58a9c4200f885887de451f9f70daa
2014-04-09 18:21:25 +00:00
Trevor Parscal 84ed719cd0 Additional initializeSelection methodicde
Changes:

* Change uses of initializeSelection to selectItem
* Use "choose" event to respond to deliberate item selection by the user

Depends on changes in OOJS-UI (Ib3826ed)

Change-Id: Ia167a70ca5f40b1f15adad30620fdb13ef0d02d7
2014-04-07 12:15:40 -07:00
Trevor Parscal fc94173ff6 Fix more intalize typos
Change-Id: I24e0b3a93c15cc8a781eb9a35d9ba09510db40bd
2014-04-04 17:13:34 -07:00
Trevor Parscal 793fbb0e24 Correctly insert or update citations based on template option
When using a tool that opens a citation or citation transclusion dialog,
the dialog shouldn't use edit mode unless the template in the node and the
template the tool would insert match.

Bug: 63452
Change-Id: I34a5a2da576247f4046da45f742bccc3cec22c5a
2014-04-02 16:38:34 -07:00
Roan Kattouw 03c5822b6b Update VE core submodule to master (c5f4f78)
Also update tools for changes in VE core.

New changes:
e4de14b Make tools use commands
e029817 Make getToolsForNode place primary commands first

Change-Id: I66575ee6d49e6b2f5a5f789978da98bb55e6dc5e
2014-04-02 16:30:12 -07:00
Trevor Parscal 9e38cafc9f Remove constructive flag from return to save form button
It doesn't create anything, so it shouldn't be constructive.

Change-Id: I97d6fc3c5f992033e55ee6cde48245b1e96ddc16
2014-03-31 15:31:43 -07:00
jenkins-bot 927d24968d Merge "Make cite transclusion tools actually work" 2014-03-26 22:48:54 +00:00
Trevor Parscal ca95923d73 Make cite transclusion tools actually work
The transclusion tools shown in the toolbar in the reference dialog
passed a template to open with to the transclusion dialog, but it
didn't take that config parameter.

Moved this parameter up from CitationDialog to TransclusionDialog,
and moved its logic into the setup function.

Bug: 63037
Change-Id: I9249c845a5ae7cca2ec4d75d69e1236f7755d246
2014-03-26 22:42:30 +00:00
jenkins-bot 24efd6bd8d Merge "Blank the reference and media search queries when closing dialogs" 2014-03-26 21:49:36 +00:00
James D. Forrester 3f21a91c2b Blank the reference and media search queries when closing dialogs
Bug: 61959
Change-Id: I45e161d322d4fb0a63d35c1a75a2a39ba9f73def
2014-03-24 17:41:29 -07:00
jenkins-bot 2b84bbbfca Merge "Use "Insert citation" label for apply button of CitationDialog" 2014-03-25 00:19:56 +00:00
Trevor Parscal c385c01096 Use "Insert citation" label for apply button of CitationDialog
* Create a method to produce the correct label
* Override that method in the citation dialog subclass

Change-Id: Ic74a23dcf30aae201f3d6c312b760cf058aadf11
2014-03-24 17:16:43 -07:00
Trevor Parscal 1363d15c53 Move cite to be after link, instead of after structure
Change-Id: I69170b68997b8df595cc12e10b3467444e3ae952
2014-03-24 17:13:59 -07:00
jenkins-bot cc45c6a0d1 Merge "Fix 'original dimensions' async call in MediaEdit dialog" 2014-03-24 22:54:01 +00:00
Roan Kattouw 81876bc81a Update reference's internal item after inserting reference
This fails before the reference has been inserted, because
it's not yet in keyedNodes at that point.

Bug: 63031
Change-Id: I34ea1a88c0f332c23e43597d1c42158bfb0f1e98
2014-03-24 15:05:26 -07:00
Trevor Parscal be199c0bf2 Ultra-mega-hyper-citation editing on crack
Objectives:
* Allow users on-wiki to create tools and dialogs for citation templates
of their choosing
* Allow editing of citation templates directly, without having to go
through the reference dialog
* Provide citation template tools within reference editing that use the
same titles and icons as the citation tools do, but don't wrap the
inserted content in a ref tag

Changes:

* Reference list was cloning the DOM element it was inserting into its
view before the generated content node could finish rendering, so it
never ended up showing the finished rendering in the reference list
* Documenting hack about use of reference list node's destroy method,
and how we are depending on destroy not canceling generated content
rendering
* Introduced reference model
* Added saving/updating method to transclusion model
* Added getPartsList method to dm transclusion node, which caches the
result and invalidates the cache on update
* Added citation dialog, which extends transclusion dialog
* Added cite group to toolbars, cite-template in reference dialog toolbar
* Factored out getting the node to edit and saving changes procedures in
transclusion dialog so they could be extended in citation dialog
* Updated uses of autoAdd as per changes in oojs-ui (Ic353f91)
* Renamed MWDialogTool file since there was only one tool in it
* Expanded TransclusionDialogTool file out since there is now more logic
to it
* Switched to using ve.dm.MWReferenceModel instead of plain objects in
reference search widget

Configuration:

If you add to MediaWiki:Visualeditor-cite-tool-definition.json the
following code you will magically be presented with a delightful array
of citation options:

[
    { "name": "web", "icon": "ref-cite-web", "template": "Cite web" },
    { "name": "book", "icon": "ref-cite-book", "template": "Cite book" },
    { "name": "news", "icon": "ref-cite-news", "template": "Cite news" },
    { "name": "journal", "icon": "ref-cite-journal", "template": "Cite journal" }
]

...or...

[
    {
         "name": "any-name",
         "icon": "any-ooui-icon",
         "template": "Any template",
         "title": "Any title text"
     }
]

The title text is derived either from the title property or from the name
property by pre-pending the string 'visualeditor-cite-tool-name-' to
generate a message key. Titles for 'web', 'book', 'news' and 'journal' are
provided. The icon is a normal oo-ui-icon name, and more icons can be
added, as usual, by adding a class called .oo-ui-icon-{icon name} to
MediaWiki:Common.css. 'ref-cite-web', 'ref-cite-book', 'ref-cite-news'
and 'ref-cite-journal' are provided. The template name is simply the name
of the template without its namespace prefix.

Depends on Ic353f91 in oojs-ui

Bug: 50110
Bug: 50768
Change-Id: Id401d973b8d5fe2faec481cc777c17a24fd19dd4
2014-03-24 19:24:38 +00:00
Moriel Schottlender 8d63b2f6db Fix 'original dimensions' async call in MediaEdit dialog
The request for originalDimensions is taken from the API, which can be
rather slow. There is a future (soon) fix that refactors the entire way
we read the originalDimensions asynchronously and load it into the dialog
but until that is available, this fix introduces a couple of basic
fallbacks in case originalDimensions are not yet available in the size
widget.

Bug: 62024
Change-Id: I8d00cea6f1d667359a44a6c185c16340bc6e81c9
2014-03-21 12:33:53 -07:00
jenkins-bot f52b34d473 Merge "Followup 861d097: actually exclude reference tool in reference dialog toolbar" 2014-03-20 06:04:43 +00:00
Roan Kattouw 5ad0828936 Followup 861d097: actually exclude reference tool in reference dialog toolbar
It was excluded, but also promoted, and the toolbar resolves this ambiguity
in favor of promotion.

Bug: 62575
Change-Id: I2f1eadb27cbd16e3258aee0311c7b35f6311ea5a
2014-03-19 22:58:35 -07:00
Roan Kattouw 45b17da937 Don't use search widget emptiness as a proxy for "no reusable references"
This works the first time the dialog is opened, but if the user types
a value into the search widget that yields 0 results, then closes
and reopens the dialog, that value will persist and the search widget
will still be empty, so we'll wrongly disable the "Use existing reference"
button.

Instead, check what we're actually interested in directly: whether
the index of reusable references is empty.

Bug: 61960
Change-Id: If4bf6ced7dc3af643f602c07f3142a0e637a3247
2014-03-19 22:46:04 -07:00
James D. Forrester 18693e76e0 Remove commented-out, now-confirmed-as-wrong wrong image insertion code
Bug: 61560
Change-Id: Id66f7a3204bae0978cc4e86d443551ce878ef8c8
2014-03-17 11:55:56 -07:00
C. Scott Ananian 0128db1dec Clarified the default link for image insertion.
Bug: 61560
Bug: 49844
Change-Id: Iab37caf1b34906b9bb1be241aa869bd2d4877907
2014-03-17 14:38:29 -04:00
James D. Forrester b68c8d3819 Re-sync toolbarGroups for MWMediaEdit and MWReference dialogs
Change-Id: Ic42a57e0e7a1639242092dbe41e13c1b8586f841
2014-03-14 17:01:44 -07:00
Moriel Schottlender 1948ed8403 Fix regression bug 'default size' change on alignment
* Corrected the condition that set default size only if the image
  wasn't smaller than the default.
* Added a couple of sanity check conditions for the OO.Compare
  condition

Bug: 62586
Bug: 62581
Change-Id: I4db996cec33ac9d53ef485b53568100e3912c4ae
2014-03-13 00:00:46 -04:00
James D. Forrester da5d8847ea Make the reference dialog medium, not large
Change-Id: Iada77f7f61ee70a33c77f25b34a2cb6e612da6a6
2014-03-12 17:38:05 -07:00
Roan Kattouw aae2fb09de Actually make the save dialog grow when showing a diff
There was code doing it, but its effects were undone by a switch-case fall-through.

Change-Id: I59abc1bbbf086eb29bda86f15bfac3acec3b0950
2014-03-12 17:31:02 -07:00
James D. Forrester e68e93ed59 Make references list dialog small, and vary 'insert' vs. 'apply' button text
Change-Id: I4bbe60ae6a978e73ca55bf55cddbdaca05c56414
2014-03-12 17:01:03 -07:00
Trevor Parscal 91f38fdaf2 Keep label and disabled state of transclusion dialog apply button in sync
* Use "Insert template" when adding a single template
* Use "Insert transclusion" when adding a multi-part template
* Use "Apply changes" when working with an existing tranclusion
* Use "Loading..." and disable while waiting for template data
* Disable when the transclusion has only a template placeholder

Bug: 50998
Change-Id: Ib2fb3d8711ed6d3ef41cc0db55740c95394dd3f9
2014-03-12 14:56:26 -07:00
Moriel Schottlender 499c672195 Deal with images whose size is smalled than default
When an image is smaller than the default size, the placeholder 'default'
value will be the image's actual size. This means that if a user selects
default thumb size for the image, it won't be changed unless the original
size is bigger than the default. Also adjusted so that default size limits
width only, and doesn't act as a bounding box on size change.

Bug: 62293
Change-Id: I8341776794843ff63a93bedeadf5921851c57a26
2014-03-12 18:07:38 +00:00
Moriel Schottlender 5f2ce173a0 Enforce width-only default size only on larger images
While the documentation is unclear, it seems that the 'thumbsize' in
$wgDefaultUserOptions is setting up width limit rather than a general
bounding box.

Things that are adapted in this fix:

* Only resize the image if the image is bigger than default and marked
  as default size.
* Only limit width, even if the image is tall.
* Add rounding to calculated height value.
* Make sure new images follow these rules as well on insertion.

Bug: 62293
Bug: 62279
Change-Id: I37525bf3480bb1da8b0538f9b38576616aabbfa6
2014-03-10 19:05:14 +00:00
Moriel Schottlender 7f180f0313 Get item data from change event in select widget items
Fix a bug in MediaEditDialog that resulted from sync issues when the
'select' event is fired for OO.ui.ButtonSelectWidget widgets.

Use the details of the selected item given from the event rather than
checking the state of the widget with getSelectedItem().

Change-Id: Ifbbf722ff374e10b680a6b55ab99f5fc86480c40
2014-03-06 13:37:17 -05:00
Trevor Parscal 37f4996392 Merge TransclusionDialogs into one
* Automatically select single mode when possible
* Allow dynamic switching when possible
* Hide most of the controls and information when in single mode
* Allow parameter model to be instantiated without name and value args
* Place add param buttons at the bottom of template and param pages
  which are only visible when in single mode and on the last page

Change-Id: Iaffbf1863b808c8089dfcf09a976d165f28c8b74
2014-03-05 18:15:17 -08:00
Ed Sanders 4ad33a6267 Use align icons in media edit dialog
Depends on I70a7c6c5d32 in core.

Change-Id: I3db1d760898f4d826b078529a8d3a14dc521e13e
2014-03-05 17:25:01 -08:00
jenkins-bot 7201311d97 Merge "Inline CR fixes for Media Edit Dialog" 2014-03-06 01:15:04 +00:00
Trevor Parscal 2a08584e8c Update constructors of inspectors and dialogs as per changes in I345d6e6
This is harmless since the values were being passed through anyway.

Change-Id: Ie81afa6b5929047b624b4376f7d70db7a7d675a4
2014-03-05 17:07:20 -08:00
Trevor Parscal 27cda86183 Update VE core submodule to master (ab70193)
Also update for dialog size changes on oojs-ui, and make the
save dialog grow from 'medium' to 'large' when viewing a diff.

New changes:
ae195ac Update OOjs UI to v0.1.0-pre (e4f6ce0156)
ab70193 Pass surface set into ve.ui.Dialog and ve.ui.Inspector

Bug: 60494
Change-Id: Ib3065e228459aa00f18c309d234f3324fdb34059
2014-03-05 16:34:14 -08:00
Ed Sanders e0f37e04e3 Update MWCommandHelpDialog now core supports multiple shortcuts
Depends on I59a10957f5a in core.

Change-Id: I37b44df84bd2551fc0983743b7b32c6c69521607
2014-03-05 16:27:09 -08:00
Roan Kattouw 861d0976d5 Make the order of insert tools consistent in dialogs
The promote/demote rules in mw.Target had changed, but these changes
weren't copied to MWMediaEditDialog and MWReferenceDialog.

Also, we ideally shouldn't need to maintain these things
completely separately from each other.

Bug: 62286
Change-Id: I459c3310f2ac0d8860a686a05da4f45d9a888801
2014-03-05 14:49:52 -08:00
Moriel Schottlender 9e6e690e66 Inline CR fixes for Media Edit Dialog
Fixing several inline comments from the previous commit, and
reorganizing the usability of size select clicks to prevent loop
click bug.

Change-Id: I259d86e9bbe90270d8883b7a3de96979b1d5a156
2014-03-05 14:46:10 -05:00
Moriel Schottlender 89aecd54ba Deal with 'none'/'border' and default size in media edit
There are several conditions to defaultSize behavior of thumbnails and
frameless images and other images when it comes to default size. In the
same principle is 'border' which is not quite a type despite the fact
it 'behaves' as such in wikitext (and has a unique identifier that comes
instead of the other types.

This commit aims to organize this behavior for the user in an
understandable manner.

* Add 'basic' image type for images that have no specified type ('none')
* Handle the difference in 'default' size behavior between basic images
  and thumbnails/frameless. The thumb/frameless images have the default
  wiki size. Other images' default size is their original dimensions.
* Force wiki-configured default size for thumbnails and frameless images
  in the DM. This is done because at the moment Parsoid's output is of
  Wikipedia's default size rather than the local wiki's. The size is
  adapted if needed, directly in the DM.
* Added 'border' as a pseudo-type checkbox flag that sets css class
  'mw-image-border' is for parsoid rendering on save.
* Add 'make full size' to the size widget select and treat it as a faux
  default button for basic and frame images.

Bug: 62013
Bug: 62024
Bug: 61155
Bug: 61059
Bug: 61282
Change-Id: I6778705306f0dd6bb96afeb91383089a4ddab7ed
2014-03-05 03:53:46 +00:00
jenkins-bot 0aa43650b7 Merge "Revert "Revert "Set href attribute of newly inserted image to image title""" 2014-03-01 01:38:43 +00:00
Jforrester cb9548a8e6 Revert "Revert "Set href attribute of newly inserted image to image title""
This reverts commit e9ae4a94b4.

Change-Id: Icad3c2f5d3f0ddfba4bb0033011a3e5089fb5cd1
2014-03-01 01:35:57 +00:00
Trevor Parscal 2fb2f441e8 Prevent superfluous setPage calls by introducing a lock
Also, use new getClosestPage method in ooui to select which page should
be selected next when a page is removed.

Change-Id: I7ce4d2ca55aac72f3aaa14c98c7189a440598e08
2014-02-28 17:26:04 -08:00
Trevor Parscal 61c1f11fef Use small option for template dialog
It's much cuter this way.

Change-Id: Ibd4a3660b2ec1613ec64c75d29574b73da69a3b8
2014-03-01 01:24:29 +00:00
Trevor Parscal 315f10cea4 Cleanup dialog properties
No need to re-initialize properties set in parent class.

Change-Id: Ib98d9636ef169f58b4044d09972063bd5f19b3af
2014-03-01 01:24:02 +00:00
Trevor Parscal ec004d16be Move parameter adding to a placeholder page
Parameter placeholder pages are generated for parameter with empty
string as their name.

Change-Id: I56c3df1ada6c4f41ebf6466ca280a2333da60071
2014-02-28 17:20:24 -08:00
Trevor Parscal 85e0bf533a Use template name as dialog title whenever possible
Change-Id: I4235f6ed68e1f95c4593caa23ada734fb8493426
2014-03-01 00:57:55 +00:00
Trevor Parscal be27de3b89 Remove outline from TemplateDialog
Change-Id: I1df5700a241671678b22f490d5d3fc4a456a4218
2014-03-01 00:51:17 +00:00
Trevor Parscal d1b0b87257 Use label of first template as Template dialog title
Change-Id: Ib273430c94249c8dbad14abb9d1f6ad3286bdc8a
2014-03-01 00:51:01 +00:00
Trevor Parscal 21efc9994b Cleanup duplication in TransclusionDialog classes
Change-Id: I96bcd07a1548b21c8a11b9d2990400d4f48e044a
2014-03-01 00:50:37 +00:00
Trevor Parscal cbd3419dfb Update VE core submodule to master (ac4b49a)
Also update template/transclusion code for OOJS UI
OutlineControlWidget changes, and uses some of the new
functionality.

New changes:
ac4b49a Update OOjs UI to v0.1.0-pre (51f922ba17)

Change-Id: Id7a1f60cd6ce3bdaba7ccb8774563b9e81c75cad
2014-02-28 16:41:42 -08:00
Moriel Schottlender 0f51538272 Default/custom switch size quickfix
Handling a bug where the placeholders weren't set to images that weren't
set to default size. The switch to 'default' failed because there were
no placeholders and data for default to go on. This is now fixed in this
commit; if the image is non-default, the values are given to the media
size widget from the config settings.

Change-Id: I402b8d4de606c0939daa316408fcf5de2f0b2181
2014-02-26 18:39:05 -05:00
Moriel Schottlender 2a5ac5fb6a Limit thumbnail dimensions in media edit dialog
Add a dynamic limit to image dimensions; image is limited to its max
size if it is 'thumb' and unlimited in size otherwise.

This change depends on ve-core Scalable/MediaSizeWidget adjustment
https://gerrit.wikimedia.org/r/115306 (merged)

Bug: 61282
Change-Id: I1247b1360ae50af039673fa3f2b3521e457ef578
2014-02-26 12:43:26 -08:00
jenkins-bot 84fb866ed7 Merge "Set up wiki-default image size" 2014-02-26 20:31:49 +00:00
jenkins-bot 4862818c7f Merge "Rename MWTemplateParameter* classes to MWParameter*" 2014-02-26 17:57:07 +00:00
Trevor Parscal e2f6d798b8 Rename MWTemplateParameter* classes to MWParameter*
* The name was getting super long, and the Template prefix doesn't
  appear to be important.
* Soon we will add a placeholder class, which would have been
  MWTemplateParameterPlaceholder, but now just MWParameterPlaceholder
  which seems a little less ridiculous.

Change-Id: Ie2dfe0d4c7b960cd554f89fa6340173e8786c88a
2014-02-26 10:54:45 +00:00
Moriel Schottlender b54575a797 Set up wiki-default image size
This commit makes several adjustments to make sure default size is being
handled correctly:

* Add wiki's default size configuration parameter to the
  VisualEditor.hooks.php file so it can be called from VE.
* Make sure new images are inserted with default size and are
  marked 'defaultSize = true' for the DM to handle.
* Force default size if 'defaultSize=true' in the DM
* Add a 'default|custom' switch to the media edit dialog for size
  inputs. When 'default' is chosen, the media size widget will be
  emptied, displaying its placeholders (default size)
* When the size widget's values are 0 it will automatically turn to
  default size values. If the value started default and the user
  typed in a size, it will automatically override default and use
  custom size.

Bug: 47804
Change-Id: Ib973ea2afa96090a4ba61b2b55ee63457f1329c1
2014-02-25 16:26:15 -05:00
Alex Monk 1e8be87f43 Don't show edit summary preview if it's blank
Bug: 61716
Change-Id: I6cd7ee0ad947dcac24a50b6df61316fde74edb43
2014-02-22 00:55:43 +00:00
Moriel Schottlender e2f06d4875 Revamp media edit dialog's position widget
Added checkbox to set position (left/center/right) or none if unchecked.
Also handle 'default' position based on the wiki direction.

Bug: 61155
Change-Id: Iddd78c98929759a13d2dc5a774e72b59cbe28c36
2014-02-20 15:47:23 -08:00
jenkins-bot 37c84dc3bb Merge "Ensure we use our references to certain native or upstream methods" 2014-02-20 23:35:39 +00:00
jenkins-bot 81d8fb9130 Merge "Revert "Set href attribute of newly inserted image to image title"" 2014-02-20 21:37:16 +00:00
Timo Tijhof 58c647e3ac Ensure we use our references to certain native or upstream methods
Checked:
 ve.cloneObject       (oo|OO).cloneObject
 ve.getObjectValues   (oo|OO).getObjectValues
 ve.getObjectKeys     Object.keys
 ve.compare           (oo|OO).compare
 ve.copy              (oo|OO).copy
 ve.isPlainObject     ($|jQuery).isPlainObject
 ve.isEmptyObject     ($|jQuery).isEmptyObject
 ve.isArray           Array.isArray
 ve.bind              ($|jQuery).proxy
 ve.indexOf           ($|jQuery).inArray
 ve.extendObject      ($|jQuery).extend

Fixed:
* ve.dm.MWBlockImageNode.js (added in Iebb2081de)
* ve.dm.MWInlineImageNode.js (aded in I62ec12a6b)
* ve.dm.MWConverter.test.js (added in I90273786a)
* ve.ui.MWMediaInsertDialog.js (added in Ia5ad9a8c0)
* ve.dm.MWTemplateSpecModel.js (added in Ic3eb66538)
* ve.init.mw.MobileViewTarget.js
* ve.init.mw.ViewPageTarget.js
* ve.init.mw.Target.js

Skipped:
* ve.init.mw.ViewPageTarget.init.js
  - Feature test (which is for the very references from ve.js
    being ensured in this commit).
  - Misc code using $.inArray (can't use ve.js yet since that
    isn't loaded yet there).

Change-Id: I73ae005d3692e871fdcaea938641558c0b98ec69
2014-02-20 22:30:29 +01:00
jenkins-bot 78bdbb4c43 Merge "Let users set __NOINDEX__ & __INDEX__ status" 2014-02-20 01:50:29 +00:00
James D. Forrester 051c3498ae Let users set __NOINDEX__ & __INDEX__ status
Add a trinary option to the page settings pane of the meta dialog that
lets users set the page to have __INDEX__, __NOINDEX__ or neither (and so
have the default behaviour).

Bug: 57167
Change-Id: I30d483b5b6c3df7ee56a52c744bbdc610a01873d
2014-02-19 17:48:03 -08:00
James D. Forrester ffc5880417 Add placeholder to 'group' field in reference dialog too
It's just been added to the reference list dialog, but references have this
(totally confusing) field too.

Bug: 59180
Change-Id: Iab26b2c2c99842d33512b0145d1f91379e1cd412
2014-02-19 17:33:35 -08:00
jenkins-bot 71984326d1 Merge "Show placeholder text in group input box on reference list dialog" 2014-02-20 00:43:57 +00:00
jenkins-bot 3e0a88c03d Merge "Add MW-specific keyboard shortcut help" 2014-02-19 23:57:45 +00:00
Ed Sanders 2ce113f0c7 Add MW-specific keyboard shortcut help
For now just accessKey+S for save.

Change-Id: Idf4fa31b98d1fa9ea62d9a9f2937ae7496a9a201
2014-02-19 23:53:22 +00:00
jenkins-bot 1c2dd6986f Merge "Always pass a document model to the surface widget" 2014-02-19 23:51:16 +00:00
Ed Sanders a789ef64ac Always pass a document model to the surface widget
For consistency, in all other cases newDoc is a document model.

Related to the documentation change in Ie1ee9bd958b3, but not
strictly dependent on it.

Change-Id: I98ade6abd49ebd37d8eb8005e349b89b318d9421
2014-02-19 23:14:55 +00:00
jenkins-bot 01570025d3 Merge "Show preview of edit summary in review screen" 2014-02-19 23:07:19 +00:00
Krenair 675d91b7e8 Show preview of edit summary in review screen
Bug: 42139
Change-Id: I0bbfd0dd993da67295dea47129ca9f398f318b64
2014-02-19 15:03:04 -08:00
James D. Forrester e9ae4a94b4 Revert "Set href attribute of newly inserted image to image title"
This reverts commit 537e431466.

Bug: 61560
Change-Id: I60cd1b881dcb44f14925bfcdd013fcd100aa9e06
2014-02-19 22:27:28 +00:00
jenkins-bot d774a642c9 Merge "Disable save button (and Alt+S) on conflict" 2014-02-19 22:02:01 +00:00
Roan Kattouw 03dc2927ca Disable save button (and Alt+S) on conflict
In the conflict pane, we hide the save button, so disabling it doesn't
make a visual difference, but it also disables the Alt+S access key.

Change-Id: I8c0d92a40a02d525ec10932656ebf38a74a97cd4
2014-02-19 13:46:43 -08:00
jenkins-bot 0d2ea63596 Merge "Use accesskey=s on the save buttons" 2014-02-19 21:42:13 +00:00
Krenair ec8234f183 Use accesskey=s on the save buttons
Bug: 50897
Change-Id: I31d6b9ea065b3be85ed07fba7437bed71010512b
2014-02-19 19:34:13 +00:00
Moriel Schottlender 296cdbd2cb Make alternate text input stretch to full width
Make sure alternate text input box is stretch to the full width of
the MWMediaEditDialog screen.

Bug: 61329
Change-Id: I22f7e4bc6a03e6349e3494291764d3bf531d70de
2014-02-18 21:13:12 +00:00
Krenair 9c40de10b1 Show placeholder text in group input box on reference list dialog
Set to "General references" for now.

Bug: 59180
Change-Id: I39c3692c71674ff656617500aa22ec7191db2e96
2014-02-18 20:56:45 +00:00
Trevor Parscal 7a3267467a Update VE core submodule to master (64650c6)
Switch to using FieldLayout for laying out forms.

New changes:
64650c6 Update OOjs UI to v0.1.0-pre (424b40373e)

Change-Id: I757aecf3485673f54aa9e7f38e88c079dda4451d
2014-02-15 01:55:55 +00:00
Trevor Parscal 4c2d4c14ea Update VE core submodule to master (8b545f4)
Also update use of OO.ui.PageLayout to work with changes in OOUI.

See: I58a279dd949a867a4698a791103d5a6f2bd4b67f

New changes:
8b545f4 Update OOjs UI to v0.1.0-pre (3a9a4c1da8)

Change-Id: Ib5063db055a63082d08b2858bffb9f854d76c01b
2014-02-14 17:53:59 -08:00
jenkins-bot 912fda938d Merge "Explain what the number on the edit summary screen means" 2014-02-13 01:09:33 +00:00
Roan Kattouw d4e8be5f49 A couple more OO.ui.deferMsg() calls
So as to not show message keys as labels :)

Change-Id: I98951d48449ed26cf35c192e871e4bb56fcd4e8b
2014-02-12 15:04:28 -08:00
Moriel Schottlender 02c072a29e Update image size properly when size is default
When an image with default size has a size change, the defaultSize
attribute in the data model must be set to 'false' so the new size
can be updated in parsoid.

Bug: 61270
Change-Id: I84388aec62674a3e3c6773f29bda7156254b5f4a
2014-02-12 17:23:18 -05:00
jenkins-bot 2f9c71edd3 Merge "(Stand back again) Even moar label manias! (label refactoring) + VE core update" 2014-02-12 22:08:27 +00:00
Trevor Parscal eca0a08ad9 (Stand back again) Even moar label manias! (label refactoring) + VE core update
Update VE core submodule to master (84ced37) and update calling code
for changes in OOUI.

Depends on Ic967b88d55daf48d365487e17f76488b3f02c60f and Ib599b9bd5028e2df084fcc3da657aeb7f1569d2a

New changes:
94f03c3 Undefined variables first in selectNodes
62b5648 Localisation updates from https://translatewiki.net.
10c5a18 Don't descend into handlesOwnChildren nodes in selectNodes
4ed2432 Update jquery.client to MW's master (45192156d7)
d7e24b8 Localisation updates from https://translatewiki.net.
babb9da Localisation updates from https://translatewiki.net.
4639d18 Localisation updates from https://translatewiki.net.
a561537 Localisation updates from https://translatewiki.net.
8f7053a Localisation updates from https://translatewiki.net.
7112cc2 Update OOjs UI to v0.1.0-pre (a290673bbd)

Change-Id: Ie7d58472619509782f23a7dedc1ec27c3dcc7543
2014-02-12 14:05:23 -08:00
Moriel Schottlender 80558f85dc Quick fix: image size property update
This is a bit of a workaround for scalable image nodes to update the
current size rather than only the original one. This is done so the
MediaSizeWidget in the media edit dialog is fed the current dimensions
of the image even without the image being saved.

Ideally, the node's 'currentDimensions' property should be constantly
updated to current dimensions. This workaround fixes the given bug, in
which all images show the original wikitext/default size even after
being resized.

Bug: 61052
Change-Id: I902d1f51b1389f2f9b2b5c871b578ee2244a946f
2014-02-12 16:53:13 -05:00
Krenair c4903ac684 Explain what the number on the edit summary screen means
Bug: 50902
Change-Id: Ic548e624c1e7375b3151cc9d2f051a5bc665c759
2014-02-09 03:14:09 +00:00
jenkins-bot 6907654de1 Merge "Add image type change to media edit dialog" 2014-02-08 00:45:49 +00:00
Moriel Schottlender 19c584d166 Add image type change to media edit dialog
Adding a type change to the media edit dialog. Also changing SelectWidgets
to ButtonSelectWidgets for consistency.

Bug: 38129
Change-Id: I9c855e6381d970b5f08460822366f6333af24f82
2014-02-07 16:41:50 -08:00
jenkins-bot fd6fb32db2 Merge "Auto-select first auto-added required param and fix param order" 2014-02-07 23:21:00 +00:00
Ed Sanders cf62801694 Move paste rules to Target
Because ViewPageTarget isn't always loaded.

Bug: 60912
Change-Id: I16bd6a329120b3dd7dcb0de3e76e69e84c18553f
2014-02-06 22:41:51 +00:00
Trevor Parscal d487b44dd0 Auto-select first auto-added required param and fix param order
Symptoms:
* When adding a template with required parameters, the last parameter
  is initially focused
* Parameters and parts appear out of order, and adding/remove/moving
  them shows them in almost random placement

Diagnoses:
* Parameters are auto-focused when added, and parameters are auto-added
  in forward order
* TransclusionModel's process method had a bug in which the code to
  derive an offset from the item being removed would not be reachable
  due to an inverted logic statement

Prognosis:
* Fatal, with a 10% chance of survival

Treatment:
* Set focus on the first parameter after auto-adding required
  parameters to a template
* Invert the logic in TransclusionModel's process method, so that if
  the index IS undefined we will proceed to define it

Change-Id: I299053b63045ec933747831f1b4aa63493760f8b
2014-02-06 13:21:14 -08:00
Moriel Schottlender b522994344 Adding position setting to media edit dialog
This adds an image position/alignment to the media edit dialog.

Bug: 51293
Change-Id: I15fbd1ed0998a9093fa039b76624395d661af05b
2014-02-05 20:56:37 +00:00
Moriel Schottlender e8205a7133 Adding alternate text to media edit dialog
Adding an option to add or edit alt text to images in the media edit
dialog.

Bug: 38129
Change-Id: I6d339781822175c40c66a4689ec6e1a873cb081d
2014-02-05 20:56:30 +00:00
Ed Sanders fb4f7d3e24 The great image scaling rewrite of 2014 (MW)
Implement new logic in ve.Scalable from I5b4f0f91b.

Also update VE core submodule to master (57ed8d3).

New changes:
59a0afe The great image scaling rewrite of 2014

Change-Id: I24a2976036310d3814cc7d1853a68745e0499bd5
2014-02-05 12:55:11 -08:00
Ed Sanders 61d010df2f Move image info API call to media node
As other widgets may be interested in the image info, this should
be part of the DM node, which the media edit dialog then fetches
and uses to populate the MediaSizeWidget.

Other fixes:
* Remove spinner, not really necessary as the orignal size button is
  disabled if the orignal dimensions aren't set.
* Don't wait until image info call to resolve to initialise size
  widget values. These should always be available instantly from the
  attributes.

Depends on I9530ed4257e88b in core.

Change-Id: I394f49941b621059bc08c8a8f79471b2fe16c7d8
2014-02-05 12:48:31 -08:00
Ed Sanders 425d6fee54 Exclude galleries from reference/caption surface tools
Because putting galleries in either would just be silly.

Change-Id: I03013607f3caae0053661c3c47d46b888ab5fde0
2014-02-05 19:45:56 +00:00
Ed Sanders d7e9564d22 Hide structure tools in MWReferences
Technically these are possible to render (although there's currently
a Parsoid bug preventing it) but really references should just contain
one single paragraph.

Change-Id: I405d75a0935d3f4610e10b942b48fa0fa2679a20
2014-02-05 19:39:39 +00:00
Ed Sanders 1e6daf1ee6 Implement surface paste rules for media/ref dialogs
Extend default paste rules to prevent lists/tables/references/headings
as applicable.

Also update submodule to master (76ff210).

New changes:
f1a927f Internal paste rules and type conversions

Bug: 59603
Change-Id: I952f98477219a55d25a2bd817344bde58a4862d4
2014-02-05 11:17:33 -08:00
Ed Sanders f6acb93d5a Store original dimensions results in IV store
* Remove the this.mediaSize custom store object and replace
  with a hash function and the document's IV store.
* Remove this.inputs/this.fieldsets namespaces.
* Calculate this.filename as soon as this.mediaNode is set.
* Rename getMediaSize to getOriginalDimensions

Change-Id: I2030aade5d96555451f6a390d0aa3d44b860841f
2014-01-26 14:26:57 +00:00
Moriel Schottlender 8130acebfd Changing image size in MWMediaEditDialog
Adding the ability to edit image size in the media edit dialog.
The size is now a separate widget.

The following changes were made:
* The dialog was changed to a booklet with 'general settings' and
  'advanced settings', in preparation for other edit features.
* The original image maximum size is fetched from the API and cached.
* Maximum size is limited to the image's original maximum size.
* Aspect ratio is kept when changing height or width, using original
  image size to preserve a sane ratio through the MediaSizeWidget.
* If an error is found in the size, the image will retain its previously
  set dimensions.

Depends on MediaSizeWidget: I3d0f9348a52

Bug: 38129
Change-Id: I2946fb21c46ce05583b219f665ef68928188899e
2014-01-22 18:43:45 -08:00
Trevor Parscal f4156bd09f Update VE core submodule to master (e7e2833)
New changes:
* e7e2833 - Update uses of Push/IconButtonWidget to ButtonWidget
* d9d9eb5 - Update OOjs UI to v0.1.0-pre (d9bab13)
  * d9bab13 - The Great Button Refactor of 2014
* 22b93ef - Update OOjs UI build (88b2871)
  * 88b2871 - Fix png transparency on required.png
  * 670c468 - Add i18n

Also:
* Update uses of Push/IconButtonWidget to ButtonWidget as there
  is a breaking change in new OOjs UI version.
  This was separated from commit I325a4dcc316d0.

Change-Id: I82220d15221c52be03feafcfc85c2bd6c12ba462
2014-01-17 16:29:36 +01:00
Timo Tijhof 8e7a864e90 Clean up and doc fixes
Remove odd comment and move node property to list of properties.

Change-Id: Ife3161bbdbf01075e987e65d9bfef41994efa916
2014-01-16 17:41:08 +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
Trevor Parscal 278bcd9a20 Added indicators to toolbars
The down arrow is no longer default, so it needs to be specified
explicitly.

Updates submodule to include indicator changes
(see I0a1faef11a1e7e6ea3e44275c85f2efafae4dc9a)

Change-Id: I32aef3ea2e66fd823aeb07dac06cfefba9954270
2014-01-13 18:32:01 -08: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
James D. Forrester 0fadc2bc77 Let users set __NOTOC__ & __FORCETOC__ status
This creates a new panel in the meta dialog, "Page settings", where page-
level settings will be, err, set. For now, this exposes just the
behavioural switches for the presence/absence of the Table Of Contents –
__NOTOC__ and __FORCETOC__.

As part of this change, the meta dialog is renamed to "Options" to be
less confusing, and the icon for the meta dialog is changed to the
generic one for dialogs, which was previously unused. The page settings
pane is provided first in this list, given that the categories pane
(amongst others) is now directly accessible through the toolbar menu.

Bug: 56866
Bug: 56867
Change-Id: I33ce05c19d2e19b249e1cefd26fd0e3697d0085d
2014-01-05 18:56:53 +08:00