Jdlrobson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/69347


Change subject: Make editing work on pages other than main namespace
......................................................................

Make editing work on pages other than main namespace

Currently the editor loads the main namespace when you click edit
on a talk page. doh!

Change-Id: I87b4a783dff689dc4d524649b6d09e152e05fb94
---
M javascripts/modules/editor/editor.js
M tests/javascripts/modules/editor/test_EditorApi.js
2 files changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/47/69347/1

diff --git a/javascripts/modules/editor/editor.js 
b/javascripts/modules/editor/editor.js
index 133e914..0d7b1fc 100644
--- a/javascripts/modules/editor/editor.js
+++ b/javascripts/modules/editor/editor.js
@@ -14,9 +14,10 @@
 
        function init() {
                M.router.route( /^editor-(\d+)$/, function( section ) {
+                       var title = mw.config.get( 'wgTitle' ), ns = 
mw.config.get( 'wgCanonicalNamespace' );
                        section = parseInt( section, 10 );
                        new EditorOverlay( {
-                               title: mw.config.get( 'wgTitle' ),
+                               title: ns ? ns + ':' + title : title,
                                isNew: mw.config.get( 'wgArticleId' ) === 0,
                                section: section,
                                // FIXME: possibly we should have a global Page 
instance with
diff --git a/tests/javascripts/modules/editor/test_EditorApi.js 
b/tests/javascripts/modules/editor/test_EditorApi.js
index 1045c44..48d82e8 100644
--- a/tests/javascripts/modules/editor/test_EditorApi.js
+++ b/tests/javascripts/modules/editor/test_EditorApi.js
@@ -111,7 +111,7 @@
        } );
 
        QUnit.test( '#save, new page', 2, function( assert ) {
-               var editorApi = new EditorApi( { title: 'test', isNew: true } );
+               var editorApi = new EditorApi( { title: 'Talk:test', isNew: 
true } );
 
                sinon.stub( editorApi, 'post' ).returns( $.Deferred().resolve() 
);
 
@@ -120,7 +120,7 @@
                editorApi.save().done( function() {
                        assert.ok( editorApi.post.calledWith( {
                                action: 'edit',
-                               title: 'test',
+                               title: 'Talk:test',
                                section: 0,
                                text: 'section 0',
                                token: 'fake token',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I87b4a783dff689dc4d524649b6d09e152e05fb94
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>

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

Reply via email to