Sn1per has uploaded a new change for review.
https://gerrit.wikimedia.org/r/260227
Change subject: [WIP] Client-side loading of History tab
......................................................................
[WIP] Client-side loading of History tab
Flawed because we cannot get skin-specific messages
Bug: T117837
Change-Id: Iffe64ba97d055ceac87290ba0143bc853dac6334
---
M Resources.php
M modules/mw.flow.Initializer.js
2 files changed, 45 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/27/260227/1
diff --git a/Resources.php b/Resources.php
index 2432f64..af48d2f 100644
--- a/Resources.php
+++ b/Resources.php
@@ -496,6 +496,10 @@
'mw-ui-unsubmitted-confirm',
'flow-reply-link',
'flow-reply-link-anonymously',
+ // History tab displaying
+ 'history_short',
+ 'tooltip-ca-history',
+ 'accesskey-ca-history',
)
) + $mobile,
'ext.flow.vendor.storer' => array(
diff --git a/modules/mw.flow.Initializer.js b/modules/mw.flow.Initializer.js
index 6ee50a9..7223cc7 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.setupHistoryTab ); // Display history
tab on save
$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.setupHistoryTab ); // Display
History tab on save
// The category widget is inside the board description widget.
// Remove it from the nojs version here
@@ -384,6 +384,45 @@
};
/**
+ * Display the page history tab if it is not already on the page
+ * Connected to new topic 'save' event and description 'saveContent'
event
+ */
+ mw.flow.Initializer.prototype.setupHistoryTab = function () {
+ var portlet, skin, tabText, nextnode;
+
+ // If a skin like Vector uses the views portlet, then the
History tab
+ // should be in views. Other skins, such as Monobook, use the
cactions
+ // portlet.
+ skin = mw.config.get( 'skin' );
+ portlet = $( '#p-views' ).length > 0 ?
+ 'p-views' : 'p-cactions';
+
+ // Some skins like Vector have a separate message for the
History tab,
+ // while others like Monobook do not. We can't get these in a
nice way,
+ // so let's use the fallback message.
+ tabText = mw.msg( 'history_short' );
+
+ // If the History tab is in cactions, then it goes before the
Delete tab;
+ // if it is in views, the History tab goes before the Watch tab
+ nextnode = portlet === 'p-views' ?
+ '#ca-watch' : '#ca-delete';
+
+ // Add the History tab
+ if ( $( '#ca-history' ).length === 0 ) {
+ mw.util.addPortletLink(
+ portlet,
+ mw.util.getUrl( { action: 'history' } ),
+ tabText,
+ 'ca-history',
+ mw.msg( 'tooltip-ca-history' ),
+ mw.msg( 'accesskey-ca-history' ),
+ nextnode
+ );
+ }
+ };
+
+
+ /**
* 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/260227
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iffe64ba97d055ceac87290ba0143bc853dac6334
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