Werdna has uploaded a new change for review.

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

Change subject: Add tooltip for watching boards.
......................................................................

Add tooltip for watching boards.

Relies on Change 148291

Change-Id: Iffa4ed7da9ba6912723915a042a0309cec9dcaeb
---
M Resources.php
A handlebars/flow_tooltip_subscribed.handlebars
D handlebars/flow_tooltip_topic_subscription.handlebars
M i18n/en.json
M i18n/qqq.json
M modules/new/components/flow-board.js
M tests/browser/features/support/env.rb
7 files changed, 70 insertions(+), 21 deletions(-)


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

diff --git a/Resources.php b/Resources.php
index ea17154..eff4202 100644
--- a/Resources.php
+++ b/Resources.php
@@ -61,7 +61,7 @@
                        "flow_load_more.handlebars",
                        "flow_no_more.handlebars",
                        "flow_tooltip.handlebars",
-                       "flow_tooltip_topic_subscription.handlebars",
+                       "flow_tooltip_subscribed.handlebars",
                        "flow_topic.handlebars",
                        "flow_topic_titlebar.handlebars",
                        "flow_topic_titlebar_close.handlebars",
@@ -159,6 +159,8 @@
                        // Tooltip
                        'flow-topic-notification-subscribe-title',
                        'flow-topic-notification-subscribe-description',
+                       'flow-board-notification-subscribe-title',
+                       'flow-board-notification-subscribe-description',
                        // Moderation
                        'flow-moderation-title-unhide-post',
                        'flow-moderation-title-undelete-post',
diff --git a/handlebars/flow_tooltip_subscribed.handlebars 
b/handlebars/flow_tooltip_subscribed.handlebars
new file mode 100644
index 0000000..a2a9b6f
--- /dev/null
+++ b/handlebars/flow_tooltip_subscribed.handlebars
@@ -0,0 +1,12 @@
+{{#tooltip
+       positionClass="left"
+       extraClass="flow-notification-tooltip-topicsub"
+}}
+       <div class="flow-notification-tooltip-icon"><span class="wikiglyph 
wikiglyph-star-list flow-ui-constructive"></span></div>
+       <p class="flow-notification-tooltip-title">
+               {{l10n (concat "flow-" type "-notification-subscribe-title")}}
+       </p>
+       <p class="flow-notification-tooltip-content">
+               {{l10n (concat "flow-" type 
"-notification-subscribe-description")}}
+       </p>
+{{/tooltip}}
\ No newline at end of file
diff --git a/handlebars/flow_tooltip_topic_subscription.handlebars 
b/handlebars/flow_tooltip_topic_subscription.handlebars
deleted file mode 100644
index ecba95c..0000000
--- a/handlebars/flow_tooltip_topic_subscription.handlebars
+++ /dev/null
@@ -1,8 +0,0 @@
-{{#tooltip
-       positionClass="left"
-       extraClass="flow-notification-tooltip-topicsub"
-}}
-       <div class="flow-notification-tooltip-icon"><span class="wikiglyph 
wikiglyph-star-list flow-ui-constructive"></span></div>
-       <p class="flow-notification-tooltip-title">{{l10n 
"flow-topic-notification-subscribe-title"}}</p>
-       <p class="flow-notification-tooltip-content">{{l10n 
"flow-topic-notification-subscribe-description"}}</p>
-{{/tooltip}}
\ No newline at end of file
diff --git a/i18n/en.json b/i18n/en.json
index 92d93aa..baae13a 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -92,6 +92,8 @@
     "flow-topic-action-restore-topic": "Restore topic",
     "flow-topic-notification-subscribe-title": "This topic has been added to 
your watchlist.",
     "flow-topic-notification-subscribe-description": "You will receive 
notifications on all activities on this topic.",
+    "flow-board-notification-subscribe-title": "This board has been added to 
your watchlist.",
+    "flow-board-notification-subscribe-description": "You will receive 
notifications when new topics are added to this board.",
     "flow-error-http": "An error occurred while contacting the server.",
     "flow-error-other": "An unexpected error occurred.",
     "flow-error-external": "An error occurred.<br />The error message received 
was: $1",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 4404ff7..4a5f858 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -96,6 +96,8 @@
        "flow-topic-action-restore-topic": "Used as a link in a dropdown menu 
to clear the moderation state of a 
topic.\n{{Related|Flow-action}}\n{{Identical|Restore}}",
        "flow-topic-notification-subscribe-title": "Title text for the overlay 
when a topic is added to watchlist.",
        "flow-topic-notification-subscribe-description": "Description text for 
the overlay when a topic is added to watchlist.",
+       "flow-board-notification-subscribe-title": "Title text for the overlay 
when a board is added to watchlist.",
+       "flow-board-notification-subscribe-description": "Description text for 
the overlay when a board is added to watchlist.",
        "flow-error-http": "Used as error message on HTTP error.",
        "flow-error-other": "Used as generic error message.",
        "flow-error-external": "Uses as error message. Parameters:\n* $1 - 
error message\nSee also:\n* {{msg-mw|Flow-error-external-multi}}",
diff --git a/modules/new/components/flow-board.js 
b/modules/new/components/flow-board.js
index 7011b32..82dbf73 100644
--- a/modules/new/components/flow-board.js
+++ b/modules/new/components/flow-board.js
@@ -832,18 +832,7 @@
                        if ( info.status === 'done' && data && data.watch && 
data.watch[0] ) {
                                if ( data.watch[0].watched !== undefined ) {
                                        // Successful watch: show tooltip
-                                       mw.tooltip.show(
-                                               $tooltipTarget,
-                                               $( 
flowBoard.TemplateEngine.processTemplateGetFragment( 
'flow_tooltip_topic_subscription', { unsubscribe: false } ) ).children(),
-                                               {
-                                                       tooltipPointing: 'left'
-                                               }
-                                       );
-
-                                       // Hide after 5s
-                                       setTimeout( function () {
-                                               mw.tooltip.hide( $tooltipTarget 
);
-                                       }, 5000 );
+                                       flowBoard.UI.showSubscribedTooltip( 
$tooltipTarget, 'topic' );
 
                                        unwatchUrl = url.replace( 'watch', 
'unwatch' );
                                        watchUrl = url;
@@ -1927,6 +1916,20 @@
                                        $.throttle( 50, 
FlowBoardComponent.UI.events.onWindowScroll )
                                )
                                .trigger( 'scroll.flow' );
+
+                       // Bind to the core watch link
+                       mw.hook( 'wikipage.watch.complete' ).add( function( 
$watchLink, doneAction, suppressNotify ) {
+                               var pageNamespace = mw.config.get( 
'wgNamespaceNumber' ),
+                                       topicNamespace = mw.config.get( 
'wgNamespaceIds' ).topic,
+                                       watchedPageType = (pageNamespace === 
topicNamespace) ? 'topic' : 'board';
+
+                                       if ( doneAction !== 'watch' ) {
+                                               return;
+                                       }
+
+                                       
FlowBoardComponent.UI.showSubscribedTooltip( $watchLink, watchedPageType, 'up' 
);
+                                       suppressNotify();
+                       } );
                };
 
                /**
@@ -2090,6 +2093,39 @@
                        }
                };
 
+               /**
+                * Shows a tooltip telling the user that they have subscribed
+                * to this topic|board
+                * @param  {jQuery} $tooltipTarget Element to attach tooltip to.
+                * @param  {string} type           'topic' or 'board'
+                * @param  {string} dir            Direction to point the 
pointer. 'left' or 'up'
+                */
+               FlowBoardComponent.UI.showSubscribedTooltip = function( 
$tooltipTarget, type, dir ) {
+                       dir = dir || 'left';
+
+                       mw.tooltip.show(
+                               $tooltipTarget,
+                               // tooltipTarget will not always be part of a 
FlowBoardComponent
+                               $( 
mw.flow.TemplateEngine.processTemplateGetFragment(
+                                               'flow_tooltip_subscribed',
+                                               {
+                                                       unsubscribe: false,
+                                                       type: type,
+                                                       direction: dir
+                                               }
+                                       )
+                               ).children(),
+                               {
+                                       tooltipPointing: dir
+                               }
+                       );
+
+                       // Hide after 5s
+                       setTimeout( function () {
+                               mw.tooltip.hide( $tooltipTarget );
+                       }, 5000 );
+               };
+
 
                /**
                 * Adds a flow-cancel-callback to a given form, to be triggered 
on click of the "cancel" button.
diff --git a/tests/browser/features/support/env.rb 
b/tests/browser/features/support/env.rb
index 8ac08ea..af299f8 100644
--- a/tests/browser/features/support/env.rb
+++ b/tests/browser/features/support/env.rb
@@ -1 +1,4 @@
 require "mediawiki_selenium"
+
+PageObject.default_element_wait = 30
+PageObject.default_page_wait = 30
\ No newline at end of file

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

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

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

Reply via email to