jenkins-bot has submitted this change and it was merged.

Change subject: Hygiene: Add back button partial
......................................................................


Hygiene: Add back button partial

This is another instance of code duplication.
(Disclaimer: I'm currently not sure why we have back button (<-)
and cancel button (x) and when one should be used over the other)

Change-Id: Ie69635f8b2638354baefb4dda0421c1b9e823050
---
M includes/Resources.php
M javascripts/Overlay.js
M javascripts/modules/editor/EditorOverlayBase.js
A templates/backButton.hogan
M templates/modules/editor/EditorOverlayBase.hogan
M templates/modules/editor/EditorOverlayHeader.hogan
M templates/modules/editor/VisualEditorOverlayHeader.hogan
M templates/modules/talk/talkSectionAddHeader.hogan
M templates/modules/talk/talkSectionHeader.hogan
9 files changed, 13 insertions(+), 8 deletions(-)

Approvals:
  Jdlrobson: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Resources.php b/includes/Resources.php
index 31918a5..928d1a6 100644
--- a/includes/Resources.php
+++ b/includes/Resources.php
@@ -577,6 +577,7 @@
                        'mobile-frontend-overlay-continue',
                ),
                'templates' => array(
+                       'backButton.hogan',
                        'cancelButton.hogan',
                        'Overlay.hogan',
                        'LoadingOverlay.hogan',
diff --git a/javascripts/Overlay.js b/javascripts/Overlay.js
index 438dd3b..203a74f 100644
--- a/javascripts/Overlay.js
+++ b/javascripts/Overlay.js
@@ -38,6 +38,7 @@
                 */
                className: 'overlay',
                templatePartials: {
+                       backButton: M.template.get( 'backButton.hogan' ),
                        cancelButton: M.template.get( 'cancelButton.hogan' )
                },
                template: M.template.get( 'Overlay.hogan' ),
@@ -60,7 +61,8 @@
                        // Truncate any text inside in the overlay header.
                        this.$( '.overlay-header h2 span' ).addClass( 
'truncated-text' );
                        // FIXME change when micro.tap.js in stable
-                       this.$( '.cancel, .confirm' ).on( M.tapEvent( 'click' 
), function( ev ) {
+                       // FIXME: Remove .initial-header selector when bug 
71203 resolved.
+                       this.$( '.cancel, .confirm, .initial-header .back' 
).on( M.tapEvent( 'click' ), function( ev ) {
                                ev.preventDefault();
                                ev.stopPropagation();
                                if ( self.closeOnBack ) {
diff --git a/javascripts/modules/editor/EditorOverlayBase.js 
b/javascripts/modules/editor/EditorOverlayBase.js
index 2ce44d3..255d355 100644
--- a/javascripts/modules/editor/EditorOverlayBase.js
+++ b/javascripts/modules/editor/EditorOverlayBase.js
@@ -16,7 +16,7 @@
                        continueMsg: mw.msg( 'mobile-frontend-editor-continue' 
),
                        saveMsg: mw.msg( 'mobile-frontend-editor-save' ),
                        cancelMsg: mw.msg( 'mobile-frontend-editor-cancel' ),
-                       keepEditingMsg: mw.msg( 
'mobile-frontend-editor-keep-editing' ),
+                       closeMsg: mw.msg( 'mobile-frontend-editor-keep-editing' 
),
                        summaryRequestMsg: mw.msg( 
'mobile-frontend-editor-summary-request' ),
                        summaryMsg: mw.msg( 
'mobile-frontend-editor-summary-placeholder' ),
                        placeholder: mw.msg( 
'mobile-frontend-editor-placeholder' ),
@@ -181,7 +181,8 @@
                        // log edit attempt
                        this.log( 'attempt' );
 
-                       this.$( '.cancel' ).on( M.tapEvent( 'click' ), 
function() {
+                       // FIXME: This should be .close (see bug 71203)
+                       this.$( '.back' ).eq( 0 ).on( M.tapEvent( 'click' ), 
function() {
                                // log cancel attempt
                                self.log( 'cancel' );
                        } );
diff --git a/templates/backButton.hogan b/templates/backButton.hogan
new file mode 100644
index 0000000..c92b4ad
--- /dev/null
+++ b/templates/backButton.hogan
@@ -0,0 +1 @@
+<button class="back icon icon-back">{{closeMsg}}</button>
diff --git a/templates/modules/editor/EditorOverlayBase.hogan 
b/templates/modules/editor/EditorOverlayBase.hogan
index 24bd269..cc56ad3 100644
--- a/templates/modules/editor/EditorOverlayBase.hogan
+++ b/templates/modules/editor/EditorOverlayBase.hogan
@@ -2,7 +2,7 @@
        {{>header}}
        <div class="overlay-header save-header hideable hidden">
                <ul>
-                       <li><button class="back icon-24px icon 
icon-back">{{keepEditingMsg}}</button></li>
+                       <li>{{>backButton}}</li>
                </ul>
                <div class="overlay-title">
                        <h2>{{{previewingMsg}}}</h2>
diff --git a/templates/modules/editor/EditorOverlayHeader.hogan 
b/templates/modules/editor/EditorOverlayHeader.hogan
index 36189b0..b53bf23 100644
--- a/templates/modules/editor/EditorOverlayHeader.hogan
+++ b/templates/modules/editor/EditorOverlayHeader.hogan
@@ -1,6 +1,6 @@
 <div class="overlay-header initial-header hideable hidden">
        <ul>
-               <li><button class="cancel icon 
icon-back">{{closeMsg}}</button></li>
+               <li>{{>backButton}}</li>
        </ul>
        <div class="overlay-title">
                <h2>{{{editingMsg}}}</h2>
diff --git a/templates/modules/editor/VisualEditorOverlayHeader.hogan 
b/templates/modules/editor/VisualEditorOverlayHeader.hogan
index 351cf60..939d7cf 100644
--- a/templates/modules/editor/VisualEditorOverlayHeader.hogan
+++ b/templates/modules/editor/VisualEditorOverlayHeader.hogan
@@ -1,6 +1,6 @@
 <div class="overlay-header initial-header hideable hidden">
        <ul>
-               <li><button class="cancel icon 
icon-back">{{closeMsg}}</button></li>
+               <li>{{>backButton}}></li>
        </ul>
        <div class="toolbar"></div>
        <div class="switcher-container">
diff --git a/templates/modules/talk/talkSectionAddHeader.hogan 
b/templates/modules/talk/talkSectionAddHeader.hogan
index 5dcafe9..ce50549 100644
--- a/templates/modules/talk/talkSectionAddHeader.hogan
+++ b/templates/modules/talk/talkSectionAddHeader.hogan
@@ -1,6 +1,6 @@
 <div class="overlay-header initial-header hideable">
        <ul>
-               <li><button class="back icon 
icon-back">{{closeMsg}}</button></li>
+               <li>{{>backButton}}</li>
        </ul>
        <div class="overlay-title">
                <h2>{{editingMsg}}</h2>
diff --git a/templates/modules/talk/talkSectionHeader.hogan 
b/templates/modules/talk/talkSectionHeader.hogan
index b048225..3e25f89 100644
--- a/templates/modules/talk/talkSectionHeader.hogan
+++ b/templates/modules/talk/talkSectionHeader.hogan
@@ -1,6 +1,6 @@
 <div class="overlay-header initial-header hideable">
        <ul>
-               <li><button class="back icon 
icon-back">{{closeMsg}}</button></li>
+               <li>{{>backButton}}</li>
        </ul>
        <div class="overlay-title">
                <h2><span>{{section.line}}</span></h2>

-- 
To view, visit https://gerrit.wikimedia.org/r/162306
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie69635f8b2638354baefb4dda0421c1b9e823050
Gerrit-PatchSet: 11
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to