[MediaWiki-commits] [Gerrit] mediawiki...MinervaNeue[master]: Use lead section when editing page without section marks

2017-08-02 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/369565 )

Change subject: Use lead section when editing page without section marks
..


Use lead section when editing page without section marks

The config variable `MFNamespacesWithoutCollapsibleSections` controls
namespaces where section collapsing is disabled. In those namespaces
page is not divided into sections marked with `.mf-section-X` classes.
If that's the case the edit button edits the first section, which is
the whole page.

Bug: T157995
Change-Id: I3ec353575529c1fb11a33fc35c9886cf232e327f
---
M resources/skins.minerva.editor/init.js
1 file changed, 4 insertions(+), 1 deletion(-)

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



diff --git a/resources/skins.minerva.editor/init.js 
b/resources/skins.minerva.editor/init.js
index 1def74e..675b94b 100644
--- a/resources/skins.minerva.editor/init.js
+++ b/resources/skins.minerva.editor/init.js
@@ -250,8 +250,11 @@
$( '.nojs-edit' ).removeClass( 'nojs-edit' );
$( '#ca-edit a' ).remove();
// FIXME: unfortunately the main page is special cased.
-   if ( mw.config.get( 'wgIsMainPage' ) || isNewPage || ( 
leadSection && leadSection.text() ) ) {
+   if ( mw.config.get( 'wgIsMainPage' ) || isNewPage ||
+   ( leadSection && leadSection.text() ) 
|| page.getSections().length === 0 ) {
// if lead section is not empty, open editor 
with lead section
+   // In some namespaces (controlled by 
MFNamespacesWithoutCollapsibleSections)
+   // sections are not marked. Use the lead 
section for such cases.
addEditButton( 0, '#ca-edit' );
} else {
// if lead section is empty or does not exist, 
open editor with first section

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3ec353575529c1fb11a33fc35c9886cf232e327f
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/skins/MinervaNeue
Gerrit-Branch: master
Gerrit-Owner: Bmansurov 
Gerrit-Reviewer: Bmansurov 
Gerrit-Reviewer: Jdlrobson 
Gerrit-Reviewer: Niedzielski 
Gerrit-Reviewer: Pmiazga 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...MinervaNeue[master]: Use lead section when editing page without section marks

2017-08-01 Thread Bmansurov (Code Review)
Bmansurov has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/369565 )

Change subject: Use lead section when editing page without section marks
..

Use lead section when editing page without section marks

The config variable `MFNamespacesWithoutCollapsibleSections` controls
namespaces where section collapsing is disabled. In those namespaces
page is not divided into sections marked with `.mf-section-X` classes.
If that's the case the edit button edits the first section, which is
the whole page.

Bug: T157995
Change-Id: I3ec353575529c1fb11a33fc35c9886cf232e327f
---
M resources/skins.minerva.editor/init.js
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/MinervaNeue 
refs/changes/65/369565/1

diff --git a/resources/skins.minerva.editor/init.js 
b/resources/skins.minerva.editor/init.js
index 1def74e..e13f10c 100644
--- a/resources/skins.minerva.editor/init.js
+++ b/resources/skins.minerva.editor/init.js
@@ -250,8 +250,11 @@
$( '.nojs-edit' ).removeClass( 'nojs-edit' );
$( '#ca-edit a' ).remove();
// FIXME: unfortunately the main page is special cased.
-   if ( mw.config.get( 'wgIsMainPage' ) || isNewPage || ( 
leadSection && leadSection.text() ) ) {
+   if ( mw.config.get( 'wgIsMainPage' ) || isNewPage ||
+( leadSection && leadSection.text() ) || 
page.getSections().length === 0 ) {
// if lead section is not empty, open editor 
with lead section
+   // In some namespaces (controlled by 
MFNamespacesWithoutCollapsibleSections)
+   // sections are not marked. Use the lead 
section for such cases.
addEditButton( 0, '#ca-edit' );
} else {
// if lead section is empty or does not exist, 
open editor with first section

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3ec353575529c1fb11a33fc35c9886cf232e327f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/skins/MinervaNeue
Gerrit-Branch: master
Gerrit-Owner: Bmansurov 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits