Werdna has uploaded a new change for review.
https://gerrit.wikimedia.org/r/92496
Change subject: Add a Cancel button to topic-level reply
......................................................................
Add a Cancel button to topic-level reply
Change-Id: I2491959b90c98338de0283a313323a94f5de9415
---
M modules/discussion/ui.js
1 file changed, 21 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/96/92496/1
diff --git a/modules/discussion/ui.js b/modules/discussion/ui.js
index 703e771..87efc57 100644
--- a/modules/discussion/ui.js
+++ b/modules/discussion/ui.js
@@ -173,12 +173,31 @@
$container.find( '.flow-topic-reply-form
.flow-post-form-controls' ).hide();
// Set up topic reply form
$container.find( '.flow-topic-reply-content' ).click(
function() {
- mw.flow.editor.load( $( this ) );
+ var $textbox = $( this );
+ mw.flow.editor.load( $textbox );
+ $form = $( this ).closest( '.flow-topic-reply-form' );
// display controls
- $( this ).closest( '.flow-topic-reply-form' ).find(
'.flow-post-form-controls' ).show();
+ $form.find( '.flow-post-form-controls' ).show();
} );
+ // Add cancel link to topic reply forms
+ $( '<a />' )
+ .attr( 'href', '#' )
+ .addClass( 'flow-cancel-link' )
+ .addClass( 'mw-ui-button' )
+ .addClass( 'mw-ui-text' )
+ .text( mw.msg( 'flow-cancel' ) )
+ .click( function ( e ) {
+ e.preventDefault();
+ $form = $( this ).closest(
'.flow-topic-reply-form' );
+ $form.find( '.flow-post-form-controls' )
+ .hide();
+
+ mw.flow.editor.destroy( $form.find( 'textarea'
) );
+ } )
+ .prependTo( $container.find( '.flow-topic-reply-form
.flow-post-form-controls') );
+
// Set up the scroll to new topic reply form
$container.find( '.flow-topic-comments .flow-reply-link'
).click(
function( e ) {
--
To view, visit https://gerrit.wikimedia.org/r/92496
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2491959b90c98338de0283a313323a94f5de9415
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Werdna <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits