JGonera has submitted this change and it was merged.

Change subject: Alpha: Talk page - allow access to lead section conversation
......................................................................


Alpha: Talk page - allow access to lead section conversation

list it as an unnamed discussion

Change-Id: Ia4aa2f3560a121d90e65a2eb06daf992efcae8da
---
M MobileFrontend.i18n.php
M MobileFrontend.php
M javascripts/modules/talk.js
M templates/overlays/talk.html
4 files changed, 17 insertions(+), 2 deletions(-)

Approvals:
  Siebrand: Looks good to me, but someone else must approve
  JGonera: Verified; Looks good to me, approved
  jenkins-bot: Checked



diff --git a/MobileFrontend.i18n.php b/MobileFrontend.i18n.php
index 23c6cd4..00ccf5b 100644
--- a/MobileFrontend.i18n.php
+++ b/MobileFrontend.i18n.php
@@ -234,6 +234,7 @@
        'mobile-frontend-talk-explained' => 'The following conversations are 
currently active',
        'mobile-frontend-talk-explained-empty' => 'There are no conversations 
about this page.',
        'mobile-frontend-talk-overlay-header' => 'Talk',
+       'mobile-frontend-talk-overlay-lead-header' => 'Unnamed discussion',
 );
 
 /** Message documentation (Message documentation)
@@ -591,6 +592,7 @@
        'mobile-frontend-talk-explained-empty' => 'Explains why the list is 
empty.',
        'mobile-frontend-talk-overlay-header' => 'Heading for talk overlay.
 {{Identical|Talk}}',
+       'mobile-frontend-talk-overlay-lead-header' => 'Heading for a discussion 
which has no heading (lead section of talk page)',
 );
 
 /** Achinese (Acèh)
diff --git a/MobileFrontend.php b/MobileFrontend.php
index 2d67995..9c04e77 100644
--- a/MobileFrontend.php
+++ b/MobileFrontend.php
@@ -379,6 +379,7 @@
                // for talk.js
                'mobile-frontend-talk-explained',
                'mobile-frontend-talk-explained-empty',
+               'mobile-frontend-talk-overlay-lead-header',
                'mobile-frontend-talk-overlay-header',
        ),
        'styles' => array(
diff --git a/javascripts/modules/talk.js b/javascripts/modules/talk.js
index 3946e6b..ccab1f5 100644
--- a/javascripts/modules/talk.js
+++ b/javascripts/modules/talk.js
@@ -23,6 +23,7 @@
                } );
                req.done( function( resp ) {
                        var topOverlay, sections, page,
+                               leadHeading = mw.msg( 
'mobile-frontend-talk-overlay-lead-header' ),
                                explanation;
 
                        if ( resp.error ) {
@@ -38,13 +39,21 @@
                                mw.msg( 'mobile-frontend-talk-explained-empty' 
);
                        topOverlay = new TalkOverlay( {
                                heading: mw.msg( 
'mobile-frontend-talk-overlay-header' ),
+                               leadHeading: leadHeading,
                                explanation: explanation,
                                sections: sections
                        } );
                        topOverlay.show();
+                       if ( !page.lead ) {
+                               topOverlay.$( '.lead-discussion' ).remove();
+                       }
                        topOverlay.$( 'a' ).on( 'click', function() {
-                               var
-                                       section = page.getSubSection( parseInt( 
$( this ).data( 'id' ), 10 ) ),
+                               var id = parseInt( $( this ).data( 'id' ), 10 ),
+                                       leadSection = {
+                                               content: page.lead,
+                                               heading: leadHeading
+                                       },
+                                       section = id === 0 ? leadSection : 
page.getSubSection( id ),
                                        childOverlay = new nav.Overlay( {
                                                content: M.template.get( 
'talkSection' ).render( section ),
                                                parent: topOverlay
diff --git a/templates/overlays/talk.html b/templates/overlays/talk.html
index dd12f9b..9e74098 100644
--- a/templates/overlays/talk.html
+++ b/templates/overlays/talk.html
@@ -4,6 +4,9 @@
 </div>
 <p class="mw-mf-overlay-header">{{explanation}}</p>
 <ul class="suggestions-results">
+       <li class="lead-discussion">
+               <a data-id="0">{{leadHeading}}</a>
+       </li>
        {{#sections}}
                <li>
                        <a data-id="{{id}}">{{heading}}</a>

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia4aa2f3560a121d90e65a2eb06daf992efcae8da
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to