Sn1per has uploaded a new change for review.

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

Change subject: [WIP] Reload if board is new
......................................................................

[WIP] Reload if board is new

Really hacky and slow at the moment.

If the board is new, the History etc. tabs will not be rendered
by the server. Make these appear when a new board is saved (new
topic or new description) by reloading the page.

Bug: T117837
Change-Id: I9eb0cc34f8b580cdf6472e5e2d5956440935b122
---
M modules/mw.flow.Initializer.js
1 file changed, 14 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/26/260226/1

diff --git a/modules/mw.flow.Initializer.js b/modules/mw.flow.Initializer.js
index 6ee50a9..76b0a4f 100644
--- a/modules/mw.flow.Initializer.js
+++ b/modules/mw.flow.Initializer.js
@@ -352,7 +352,7 @@
                                var $stub = $( '<div 
class="flow-topic"><div></div></div>' ).prependTo( 
self.flowBoard.$container.find( '.flow-topics' ) );
                                return 
this.flowBoard.flowBoardComponentRefreshTopic( $stub.find( 'div' ), newTopicId 
);
                        }
-               } );
+               } ).once( 'save', this.onCreate ); // Refresh if board is new
 
                $form.replaceWith( this.newTopicWidget.$element );
        };
@@ -372,7 +372,7 @@
                descriptionWidget = new mw.flow.ui.BoardDescriptionWidget( 
this.board, {
                        $existing: $( '.flow-ui-boardDescriptionWidget-content' 
).contents(),
                        $categories: $( '.flow-board-header-category-view-nojs' 
).contents()
-               } );
+               } ).once( 'saveContent', this.onCreate ); // Refresh if board 
is new
 
                // The category widget is inside the board description widget.
                // Remove it from the nojs version here
@@ -384,6 +384,18 @@
        };
 
        /**
+        * If the board page is being saved for the first time, reload the page
+        * to show actions like History, Move, Protect, etc.
+        */
+       mw.flow.Initializer.prototype.onCreate = function () {
+               // HACK: a really, really crude way to check if the page is new
+               if ( $( '#ca-history' ).length === 0 ) {
+                       location.reload();
+               }
+       };
+
+
+       /**
         * Replace the reply forms given by the php version with js editors
         *
         * @param {jQuery} $element The element to conduct the replacements in

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9eb0cc34f8b580cdf6472e5e2d5956440935b122
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Sn1per <[email protected]>

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

Reply via email to