jenkins-bot has submitted this change and it was merged.
Change subject: Use the new editor for topics that show on infinite scroll
......................................................................
Use the new editor for topics that show on infinite scroll
Update the topics that load on infinite scroll to use the new
editor system rather than the old.
Also clean up unnecessary api-handler references from the old
code.
Bug: T114326
Change-Id: I1d4848288394afce741bdf0ef0a31d6fc3bb72df
---
M handlebars/compiled/flow_block_header_edit.handlebars.php
M handlebars/compiled/flow_block_topic.handlebars.php
M handlebars/compiled/flow_block_topic_lock.handlebars.php
M handlebars/compiled/flow_block_topic_moderate_post.handlebars.php
M handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
M handlebars/compiled/flow_block_topiclist.handlebars.php
M handlebars/compiled/flow_block_topiclist_newtopic.handlebars.php
M handlebars/compiled/flow_block_topicsummary_edit.handlebars.php
M handlebars/compiled/flow_post.handlebars.php
M handlebars/flow_block_header_edit.handlebars
M handlebars/flow_block_topicsummary_edit.handlebars
M handlebars/flow_newtopic_form.partial.handlebars
M handlebars/flow_post_meta_actions.partial.handlebars
M handlebars/flow_reply_form.partial.handlebars
M handlebars/flow_topic_titlebar_lock.partial.handlebars
M modules/engine/components/board/base/flow-board-api-events.js
M modules/engine/components/board/base/flow-board-interactive-events.js
M modules/flow-initialize.js
18 files changed, 14 insertions(+), 386 deletions(-)
Approvals:
Catrope: Looks good to me, approved
jenkins-bot: Verified
diff --git a/handlebars/compiled/flow_block_header_edit.handlebars.php
b/handlebars/compiled/flow_block_header_edit.handlebars.php
index a7318c2..e6d6e28 100644
--- a/handlebars/compiled/flow_block_header_edit.handlebars.php
+++ b/handlebars/compiled/flow_block_header_edit.handlebars.php
@@ -58,13 +58,12 @@
<div class="flow-form-actions flow-form-collapsible">
<button data-role="submit"
- class="mw-ui-button mw-ui-constructive"
-
data-flow-interactive-handler="apiRequest"
-
data-flow-api-handler="submitHeader">'.LCRun3::ch($cx, 'l10n',
array(array('flow-edit-header-submit'),array()), 'encq').'</button>
+ class="mw-ui-button
mw-ui-constructive">'.LCRun3::ch($cx, 'l10n',
array(array('flow-edit-header-submit'),array()), 'encq').'</button>
'.LCRun3::p($cx, 'flow_form_cancel_button', array(array($in),array()), '
').' <small
class="flow-terms-of-use plainlinks">'.LCRun3::ch($cx, 'l10nParse',
array(array('flow-terms-of-use-edit'),array()), 'encq').'</small>
</div>
</form>
</div>
-</div>';
+</div>
+';
}
?>
\ No newline at end of file
diff --git a/handlebars/compiled/flow_block_topic.handlebars.php
b/handlebars/compiled/flow_block_topic.handlebars.php
index 50b074f..22676d2 100644
--- a/handlebars/compiled/flow_block_topic.handlebars.php
+++ b/handlebars/compiled/flow_block_topic.handlebars.php
@@ -206,10 +206,6 @@
'.$sp.' <div class="flow-form-actions flow-form-collapsible">
'.$sp.' <button data-role="submit"
'.$sp.' class="mw-ui-button mw-ui-constructive"
-'.$sp.'
data-flow-interactive-handler="apiRequest"
-'.$sp.' data-flow-api-handler="submitReply"
-'.$sp.' data-flow-api-target="< .flow-topic"
-'.$sp.' data-flow-eventlog-action="save-attempt"
'.$sp.'
>'.htmlentities((string)((isset($in['actions']['reply']['text']) &&
is_array($in['actions']['reply'])) ? $in['actions']['reply']['text'] : null),
ENT_QUOTES, 'UTF-8').'</button>
'.$sp.''.LCRun3::p($cx, 'flow_form_cancel_button', array(array($in),array()),
' ').' <small
class="flow-terms-of-use plainlinks">'.LCRun3::ch($cx, 'l10nParse',
array(array('flow-terms-of-use-reply'),array()), 'encq').'</small>
'.$sp.' </div>
diff --git a/handlebars/compiled/flow_block_topic_lock.handlebars.php
b/handlebars/compiled/flow_block_topic_lock.handlebars.php
index 9aa33b5..3cca185 100644
--- a/handlebars/compiled/flow_block_topic_lock.handlebars.php
+++ b/handlebars/compiled/flow_block_topic_lock.handlebars.php
@@ -40,9 +40,6 @@
'.$sp.' <div class="flow-form-actions
flow-form-collapsible">
'.$sp.' <button data-role="submit"
'.$sp.' class="mw-ui-button
mw-ui-constructive"
-'.$sp.'
data-flow-interactive-handler="apiRequest"
-'.$sp.' data-flow-api-target="<
.flow-topic"
-'.$sp.'
data-flow-api-handler="lockTopic"
'.$sp.' >
'.$sp.''.((LCRun3::ifvar($cx, ((isset($in['isLocked']) && is_array($in)) ?
$in['isLocked'] : null))) ? '
'.LCRun3::ch($cx, 'l10n',
array(array('flow-topic-action-unlock-topic'),array()), 'encq').'
'.$sp.'' : ' '.LCRun3::ch($cx,
'l10n', array(array('flow-topic-action-lock-topic'),array()), 'encq').'
diff --git a/handlebars/compiled/flow_block_topic_moderate_post.handlebars.php
b/handlebars/compiled/flow_block_topic_moderate_post.handlebars.php
index 5adce39..7274478 100644
--- a/handlebars/compiled/flow_block_topic_moderate_post.handlebars.php
+++ b/handlebars/compiled/flow_block_topic_moderate_post.handlebars.php
@@ -74,7 +74,6 @@
'.$sp.''.((LCRun3::ifvar($cx, ((isset($in['actions']['reply']) &&
is_array($in['actions'])) ? $in['actions']['reply'] : null))) ? '
<a href="'.htmlentities((string)((isset($in['actions']['reply']['url']) &&
is_array($in['actions']['reply'])) ? $in['actions']['reply']['url'] : null),
ENT_QUOTES, 'UTF-8').'"
'.$sp.'
title="'.htmlentities((string)((isset($in['actions']['reply']['title']) &&
is_array($in['actions']['reply'])) ? $in['actions']['reply']['title'] : null),
ENT_QUOTES, 'UTF-8').'"
'.$sp.' class="mw-ui-anchor mw-ui-progressive
mw-ui-quiet"
-'.$sp.'
data-flow-interactive-handler="activateReplyPost"
'.$sp.'
'.$sp.' data-flow-eventlog-schema="FlowReplies"
'.$sp.' data-flow-eventlog-action="initiate"
@@ -244,10 +243,6 @@
'.$sp.' <div class="flow-form-actions flow-form-collapsible">
'.$sp.' <button data-role="submit"
'.$sp.' class="mw-ui-button mw-ui-constructive"
-'.$sp.'
data-flow-interactive-handler="apiRequest"
-'.$sp.' data-flow-api-handler="submitReply"
-'.$sp.' data-flow-api-target="< .flow-topic"
-'.$sp.' data-flow-eventlog-action="save-attempt"
'.$sp.'
>'.htmlentities((string)((isset($in['actions']['reply']['text']) &&
is_array($in['actions']['reply'])) ? $in['actions']['reply']['text'] : null),
ENT_QUOTES, 'UTF-8').'</button>
'.$sp.''.LCRun3::p($cx, 'flow_form_cancel_button', array(array($in),array()),
' ').' <small
class="flow-terms-of-use plainlinks">'.LCRun3::ch($cx, 'l10nParse',
array(array('flow-terms-of-use-reply'),array()), 'encq').'</small>
'.$sp.' </div>
diff --git a/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
b/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
index 9969fe9..ab80f28 100644
--- a/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
+++ b/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
@@ -74,7 +74,6 @@
'.$sp.''.((LCRun3::ifvar($cx, ((isset($in['actions']['reply']) &&
is_array($in['actions'])) ? $in['actions']['reply'] : null))) ? '
<a href="'.htmlentities((string)((isset($in['actions']['reply']['url']) &&
is_array($in['actions']['reply'])) ? $in['actions']['reply']['url'] : null),
ENT_QUOTES, 'UTF-8').'"
'.$sp.'
title="'.htmlentities((string)((isset($in['actions']['reply']['title']) &&
is_array($in['actions']['reply'])) ? $in['actions']['reply']['title'] : null),
ENT_QUOTES, 'UTF-8').'"
'.$sp.' class="mw-ui-anchor mw-ui-progressive
mw-ui-quiet"
-'.$sp.'
data-flow-interactive-handler="activateReplyPost"
'.$sp.'
'.$sp.' data-flow-eventlog-schema="FlowReplies"
'.$sp.' data-flow-eventlog-action="initiate"
@@ -244,10 +243,6 @@
'.$sp.' <div class="flow-form-actions flow-form-collapsible">
'.$sp.' <button data-role="submit"
'.$sp.' class="mw-ui-button mw-ui-constructive"
-'.$sp.'
data-flow-interactive-handler="apiRequest"
-'.$sp.' data-flow-api-handler="submitReply"
-'.$sp.' data-flow-api-target="< .flow-topic"
-'.$sp.' data-flow-eventlog-action="save-attempt"
'.$sp.'
>'.htmlentities((string)((isset($in['actions']['reply']['text']) &&
is_array($in['actions']['reply'])) ? $in['actions']['reply']['text'] : null),
ENT_QUOTES, 'UTF-8').'</button>
'.$sp.''.LCRun3::p($cx, 'flow_form_cancel_button', array(array($in),array()),
' ').' <small
class="flow-terms-of-use plainlinks">'.LCRun3::ch($cx, 'l10nParse',
array(array('flow-terms-of-use-reply'),array()), 'encq').'</small>
'.$sp.' </div>
diff --git a/handlebars/compiled/flow_block_topiclist.handlebars.php
b/handlebars/compiled/flow_block_topiclist.handlebars.php
index 39befcc..8dc7f1e 100644
--- a/handlebars/compiled/flow_block_topiclist.handlebars.php
+++ b/handlebars/compiled/flow_block_topiclist.handlebars.php
@@ -65,8 +65,6 @@
'.$sp.' type="text"
'.$sp.' placeholder="'.LCRun3::ch($cx, 'l10n',
array(array('flow-newtopic-start-placeholder'),array()), 'encq').'"
'.$sp.' data-role="title"
-'.$sp.'
-'.$sp.'
data-flow-interactive-handler-focus="activateNewTopic"
'.$sp.' />
'.$sp.' <div class="flow-editor">
'.$sp.' <textarea name="topiclist_content"
@@ -78,9 +76,7 @@
'.$sp.' </div>
'.$sp.'
'.$sp.' <div class="flow-form-actions
flow-form-collapsible'.((LCRun3::ifvar($cx, ((isset($in['isOnFlowBoard']) &&
is_array($in)) ? $in['isOnFlowBoard'] : null))) ? '
flow-form-collapsible-collapsed' : '').'">
-'.$sp.' <button data-role="submit"
data-flow-api-handler="newTopic"
-'.$sp.'
data-flow-interactive-handler="apiRequest"
-'.$sp.' data-flow-eventlog-action="save-attempt"
+'.$sp.' <button data-role="submit"
'.$sp.' class="mw-ui-button mw-ui-constructive
mw-ui-flush-right">'.LCRun3::ch($cx, 'l10n',
array(array('flow-newtopic-save'),array()), 'encq').'</button>
'.$sp.''.LCRun3::p($cx, 'flow_form_cancel_button', array(array($in),array()),
' ').' <small
class="flow-terms-of-use plainlinks">'.LCRun3::ch($cx, 'l10nParse',
array(array('flow-terms-of-use-new-topic'),array()), 'encq').'</small>
'.$sp.' </div>
@@ -242,10 +238,6 @@
'.$sp.' <div class="flow-form-actions flow-form-collapsible">
'.$sp.' <button data-role="submit"
'.$sp.' class="mw-ui-button mw-ui-constructive"
-'.$sp.'
data-flow-interactive-handler="apiRequest"
-'.$sp.' data-flow-api-handler="submitReply"
-'.$sp.' data-flow-api-target="< .flow-topic"
-'.$sp.' data-flow-eventlog-action="save-attempt"
'.$sp.'
>'.htmlentities((string)((isset($in['actions']['reply']['text']) &&
is_array($in['actions']['reply'])) ? $in['actions']['reply']['text'] : null),
ENT_QUOTES, 'UTF-8').'</button>
'.$sp.''.LCRun3::p($cx, 'flow_form_cancel_button', array(array($in),array()),
' ').' <small
class="flow-terms-of-use plainlinks">'.LCRun3::ch($cx, 'l10nParse',
array(array('flow-terms-of-use-reply'),array()), 'encq').'</small>
'.$sp.' </div>
diff --git a/handlebars/compiled/flow_block_topiclist_newtopic.handlebars.php
b/handlebars/compiled/flow_block_topiclist_newtopic.handlebars.php
index 083cbdd..a1a4c0c 100644
--- a/handlebars/compiled/flow_block_topiclist_newtopic.handlebars.php
+++ b/handlebars/compiled/flow_block_topiclist_newtopic.handlebars.php
@@ -53,8 +53,6 @@
'.$sp.' type="text"
'.$sp.' placeholder="'.LCRun3::ch($cx, 'l10n',
array(array('flow-newtopic-start-placeholder'),array()), 'encq').'"
'.$sp.' data-role="title"
-'.$sp.'
-'.$sp.'
data-flow-interactive-handler-focus="activateNewTopic"
'.$sp.' />
'.$sp.' <div class="flow-editor">
'.$sp.' <textarea name="topiclist_content"
@@ -66,9 +64,7 @@
'.$sp.' </div>
'.$sp.'
'.$sp.' <div class="flow-form-actions
flow-form-collapsible'.((LCRun3::ifvar($cx, ((isset($in['isOnFlowBoard']) &&
is_array($in)) ? $in['isOnFlowBoard'] : null))) ? '
flow-form-collapsible-collapsed' : '').'">
-'.$sp.' <button data-role="submit"
data-flow-api-handler="newTopic"
-'.$sp.'
data-flow-interactive-handler="apiRequest"
-'.$sp.' data-flow-eventlog-action="save-attempt"
+'.$sp.' <button data-role="submit"
'.$sp.' class="mw-ui-button mw-ui-constructive
mw-ui-flush-right">'.LCRun3::ch($cx, 'l10n',
array(array('flow-newtopic-save'),array()), 'encq').'</button>
'.$sp.''.LCRun3::p($cx, 'flow_form_cancel_button', array(array($in),array()),
' ').' <small
class="flow-terms-of-use plainlinks">'.LCRun3::ch($cx, 'l10nParse',
array(array('flow-terms-of-use-new-topic'),array()), 'encq').'</small>
'.$sp.' </div>
diff --git a/handlebars/compiled/flow_block_topicsummary_edit.handlebars.php
b/handlebars/compiled/flow_block_topicsummary_edit.handlebars.php
index 2a785f1b..ead913d 100644
--- a/handlebars/compiled/flow_block_topicsummary_edit.handlebars.php
+++ b/handlebars/compiled/flow_block_topicsummary_edit.handlebars.php
@@ -59,8 +59,6 @@
<button
data-role="submit"
class="mw-ui-button mw-ui-constructive"
-
data-flow-interactive-handler="apiRequest"
- data-flow-api-handler="summarizeTopic"
data-flow-api-target="<
.flow-topic-summary-container">
'.LCRun3::ch($cx, 'l10n',
array(array('flow-topic-action-update-topic-summary'),array()), 'encq').'
</button>
diff --git a/handlebars/compiled/flow_post.handlebars.php
b/handlebars/compiled/flow_post.handlebars.php
index 35471e0..2e7cd90 100644
--- a/handlebars/compiled/flow_post.handlebars.php
+++ b/handlebars/compiled/flow_post.handlebars.php
@@ -51,9 +51,7 @@
'.$sp.' <span class="flow-post-meta-actions">
'.$sp.''.((LCRun3::ifvar($cx, ((isset($in['actions']['reply']) &&
is_array($in['actions'])) ? $in['actions']['reply'] : null))) ? '
<a href="'.htmlentities((string)((isset($in['actions']['reply']['url']) &&
is_array($in['actions']['reply'])) ? $in['actions']['reply']['url'] : null),
ENT_QUOTES, 'UTF-8').'"
'.$sp.'
title="'.htmlentities((string)((isset($in['actions']['reply']['title']) &&
is_array($in['actions']['reply'])) ? $in['actions']['reply']['title'] : null),
ENT_QUOTES, 'UTF-8').'"
-'.$sp.' class="mw-ui-anchor mw-ui-progressive
mw-ui-quiet"
-'.$sp.'
data-flow-interactive-handler="activateReplyPost"
-'.$sp.'
+'.$sp.' class="mw-ui-anchor mw-ui-progressive
mw-ui-quiet flow-reply-link"
'.$sp.' data-flow-eventlog-schema="FlowReplies"
'.$sp.' data-flow-eventlog-action="initiate"
'.$sp.' data-flow-eventlog-entrypoint="reply-post"
@@ -222,10 +220,6 @@
'.$sp.' <div class="flow-form-actions flow-form-collapsible">
'.$sp.' <button data-role="submit"
'.$sp.' class="mw-ui-button mw-ui-constructive"
-'.$sp.'
data-flow-interactive-handler="apiRequest"
-'.$sp.' data-flow-api-handler="submitReply"
-'.$sp.' data-flow-api-target="< .flow-topic"
-'.$sp.' data-flow-eventlog-action="save-attempt"
'.$sp.'
>'.htmlentities((string)((isset($in['actions']['reply']['text']) &&
is_array($in['actions']['reply'])) ? $in['actions']['reply']['text'] : null),
ENT_QUOTES, 'UTF-8').'</button>
'.$sp.''.LCRun3::p($cx, 'flow_form_cancel_button', array(array($in),array()),
' ').' <small
class="flow-terms-of-use plainlinks">'.LCRun3::ch($cx, 'l10nParse',
array(array('flow-terms-of-use-reply'),array()), 'encq').'</small>
'.$sp.' </div>
diff --git a/handlebars/flow_block_header_edit.handlebars
b/handlebars/flow_block_header_edit.handlebars
index 0df8655..3ada234 100644
--- a/handlebars/flow_block_header_edit.handlebars
+++ b/handlebars/flow_block_header_edit.handlebars
@@ -24,9 +24,7 @@
<div class="flow-form-actions flow-form-collapsible">
<button data-role="submit"
- class="mw-ui-button mw-ui-constructive"
-
data-flow-interactive-handler="apiRequest"
- data-flow-api-handler="submitHeader">
+ class="mw-ui-button mw-ui-constructive">
{{~l10n
"flow-edit-header-submit"~}}
</button>
{{> flow_form_cancel_button }}
@@ -34,4 +32,4 @@
</div>
</form>
</div>
-</div>
\ No newline at end of file
+</div>
diff --git a/handlebars/flow_block_topicsummary_edit.handlebars
b/handlebars/flow_block_topicsummary_edit.handlebars
index e431a08..6dcefb3 100644
--- a/handlebars/flow_block_topicsummary_edit.handlebars
+++ b/handlebars/flow_block_topicsummary_edit.handlebars
@@ -29,8 +29,6 @@
<button
data-role="submit"
class="mw-ui-button mw-ui-constructive"
-
data-flow-interactive-handler="apiRequest"
- data-flow-api-handler="summarizeTopic"
data-flow-api-target="<
.flow-topic-summary-container">
{{l10n
"flow-topic-action-update-topic-summary"}}
</button>
diff --git a/handlebars/flow_newtopic_form.partial.handlebars
b/handlebars/flow_newtopic_form.partial.handlebars
index 08d9b08..2bd8332 100644
--- a/handlebars/flow_newtopic_form.partial.handlebars
+++ b/handlebars/flow_newtopic_form.partial.handlebars
@@ -14,14 +14,6 @@
type="text"
placeholder="{{l10n "flow-newtopic-start-placeholder"}}"
data-role="title"
-
- {{!--
- You'd expect data-flow-eventlog-* data here
(this one
- needs to be clicked to expand the form). That
stuff will be
- in JS though, since we only want it on initial
focus (activating
- the form)
- --}}
- data-flow-interactive-handler-focus="activateNewTopic"
/>
<div class="flow-editor">
<textarea name="topiclist_content"
@@ -35,9 +27,7 @@
</div>
<div class="flow-form-actions flow-form-collapsible{{#if
isOnFlowBoard}} flow-form-collapsible-collapsed{{/if}}">
- <button data-role="submit"
data-flow-api-handler="newTopic"
- data-flow-interactive-handler="apiRequest"
- data-flow-eventlog-action="save-attempt"
+ <button data-role="submit"
class="mw-ui-button mw-ui-constructive
mw-ui-flush-right">{{l10n "flow-newtopic-save"}}</button>
{{> flow_form_cancel_button }}
<small class="flow-terms-of-use plainlinks">{{l10nParse
"flow-terms-of-use-new-topic"}}</small>
diff --git a/handlebars/flow_post_meta_actions.partial.handlebars
b/handlebars/flow_post_meta_actions.partial.handlebars
index 22435d7..a338f14 100644
--- a/handlebars/flow_post_meta_actions.partial.handlebars
+++ b/handlebars/flow_post_meta_actions.partial.handlebars
@@ -3,9 +3,7 @@
{{#if actions.reply}}
<a href="{{actions.reply.url}}"
title="{{actions.reply.title}}"
- class="mw-ui-anchor mw-ui-progressive mw-ui-quiet"
- data-flow-interactive-handler="activateReplyPost"
-
+ class="mw-ui-anchor mw-ui-progressive mw-ui-quiet
flow-reply-link"
{{!--
Initialize EventLogging:
* action: name of the action param
diff --git a/handlebars/flow_reply_form.partial.handlebars
b/handlebars/flow_reply_form.partial.handlebars
index 618f3e4..04973f8 100644
--- a/handlebars/flow_reply_form.partial.handlebars
+++ b/handlebars/flow_reply_form.partial.handlebars
@@ -47,10 +47,6 @@
<div class="flow-form-actions flow-form-collapsible">
<button data-role="submit"
class="mw-ui-button mw-ui-constructive"
- data-flow-interactive-handler="apiRequest"
- data-flow-api-handler="submitReply"
- data-flow-api-target="< .flow-topic"
- data-flow-eventlog-action="save-attempt"
>
{{~actions.reply.text~}}
</button>
diff --git a/handlebars/flow_topic_titlebar_lock.partial.handlebars
b/handlebars/flow_topic_titlebar_lock.partial.handlebars
index f08ed7d..9c13fab 100644
--- a/handlebars/flow_topic_titlebar_lock.partial.handlebars
+++ b/handlebars/flow_topic_titlebar_lock.partial.handlebars
@@ -19,9 +19,6 @@
<div class="flow-form-actions flow-form-collapsible">
<button data-role="submit"
class="mw-ui-button mw-ui-constructive"
-
data-flow-interactive-handler="apiRequest"
- data-flow-api-target="< .flow-topic"
- data-flow-api-handler="lockTopic"
>
{{#if isLocked}}
{{l10n
"flow-topic-action-unlock-topic"}}
diff --git a/modules/engine/components/board/base/flow-board-api-events.js
b/modules/engine/components/board/base/flow-board-api-events.js
index 6a5ee92..e7a83f0 100644
--- a/modules/engine/components/board/base/flow-board-api-events.js
+++ b/modules/engine/components/board/base/flow-board-api-events.js
@@ -99,22 +99,6 @@
} );
};
- /** @class FlowBoardComponentApiEventsMixin.UI.events.apiPreHandlers */
-
- /**
- * Before activating header, sends an overrideObject to the API to
modify the request params.
- * @param {Event} event
- * @param {Object} info
- * @param {Object} queryMap
- * @return {Object}
- */
-
FlowBoardComponentApiEventsMixin.UI.events.apiPreHandlers.activateEditHeader =
function ( event, info, queryMap ) {
- return $.extend( {}, queryMap, {
- submodule: 'view-header', // href submodule is
edit-header
- vhformat: mw.flow.editor.getFormat() // href does not
have this param
- } );
- };
-
/**
* Before activating topic, sends an overrideObject to the API to
modify the request params.
*
@@ -199,86 +183,6 @@
};
/**
- * Renders the editable board header with the given API response.
- * @param {Object} info
- * @param {string} info.status "done" or "fail"
- * @param {jQuery} info.$target
- * @param {Object} data
- * @param {jqXHR} jqxhr
- * @return {jQuery.Promise}
- */
-
FlowBoardComponentApiEventsMixin.UI.events.apiHandlers.activateEditHeader =
function ( info, data, jqxhr ) {
- var $rendered,
- flowBoard = mw.flow.getPrototypeMethod( 'board',
'getInstanceByElement' )( $( this ) ),
- $oldBoardNodes;
-
- if ( info.status !== 'done' ) {
- // Error will be displayed by default & edit conflict
handled, nothing else to wrap up
- return $.Deferred().resolve().promise();
- }
-
- // Change "header" to "header_edit" so that it loads up
flow_block_header_edit
- data.flow[ 'view-header' ].result.header.type = 'header_edit';
-
- $rendered = $(
-
flowBoard.constructor.static.TemplateEngine.processTemplateGetFragment(
- 'flow_block_loop',
- { blocks: data.flow[ 'view-header' ].result }
- )
- ).children();
-
- // Set the cancel callback on this form so that it returns the
old content back if needed
- flowBoard.emitWithReturn( 'addFormCancelCallback',
$rendered.find( 'form' ), function () {
- flowBoard.reinitializeContainer( $oldBoardNodes );
- } );
-
- // Reinitialize the whole board with these nodes, and hold onto
the replaced header
- $oldBoardNodes = flowBoard.reinitializeContainer( $rendered );
-
- mw.flow.editor.focus( $rendered.find( 'textarea' ) );
-
- return $.Deferred().resolve().promise();
- };
-
- /**
- * After submit of the board header edit form, process the new header
data.
- * @param {Object} info (status:done|fail, $target: jQuery)
- * @param {Object} data
- * @param {jqXHR} jqxhr
- * @return {jQuery.Promise}
- */
- FlowBoardComponentApiEventsMixin.UI.events.apiHandlers.submitHeader =
function ( info, data, jqxhr ) {
- var $rendered,
- flowBoard = mw.flow.getPrototypeMethod( 'board',
'getInstanceByElement' )( $( this ) );
-
- if ( info.status !== 'done' ) {
- // Error will be displayed by default & edit conflict
handled, nothing else to wrap up
- return $.Deferred().resolve().promise();
- }
-
- return flowBoard.Api.apiCall( {
- action: 'flow',
- submodule: 'view-header',
- page: mw.config.get( 'wgPageName' )
- } ).done( function ( result ) {
- // SUPERHACK: Add an indicator for handlebars to know
to load the partial from
- // the "old" system. This will go away when the OOUI
widget in JS is operational
- result.flow[ 'view-header' ].result.header.oldSystem =
true;
-
- // Render
- $rendered = $(
-
flowBoard.constructor.static.TemplateEngine.processTemplateGetFragment(
- 'flow_block_loop',
- { blocks: result.flow[ 'view-header'
].result }
- )
- ).children();
-
- // Reinitialize the whole board with these nodes
- flowBoard.reinitializeContainer( $rendered );
- } );
- };
-
- /**
* @param {Object} info
* @param {string} info.status "done" or "fail"
* @param {jQuery} info.$target
@@ -297,68 +201,6 @@
data.flow[ 'edit-title' ].workflow,
'.flow-topic-titlebar'
);
- };
-
- /**
- * After submitting a new topic, process the response.
- * @param {Object} info
- * @param {string} info.status "done" or "fail"
- * @param {jQuery} info.$target
- * @param {Object} data
- * @param {jqXHR} jqxhr
- * @return {jQuery.Promise}
- */
- FlowBoardComponentApiEventsMixin.UI.events.apiHandlers.newTopic =
function ( info, data, jqxhr ) {
- var schemaName = $( this ).data( 'flow-eventlog-schema' ),
- funnelId = $( this ).data( 'flow-eventlog-funnel-id' ),
- flowBoard = mw.flow.getPrototypeMethod( 'board',
'getInstanceByElement' )( $( this ) ),
- $stub;
-
- if ( info.status !== 'done' ) {
- // Error will be displayed by default, nothing else to
wrap up
- return $.Deferred().resolve().promise();
- }
-
- flowBoard.logEvent( schemaName, { action: 'save-success',
funnelId: funnelId } );
-
- flowBoard.emitWithReturn( 'cancelForm', $( this ).closest(
'form' ) );
-
- // remove focus - title input field may still have focus
- // (submitted via enter key), which it needs to lose:
- // the form will only re-activate if re-focused
- document.activeElement.blur();
-
- // _flowBoardComponentRefreshTopic relies on finding a
.flow-topic node
- // to replace, so let's pretend to have one here!
- $stub = $( '<div class="flow-topic"><div></div></div>'
).prependTo( flowBoard.$container.find( '.flow-topics' ) );
- return _flowBoardComponentRefreshTopic( $stub.find( 'div' ),
data.flow[ 'new-topic' ].committed.topiclist[ 'topic-id' ] );
- };
-
- /**
- * @param {Object} info (status:done|fail, $target: jQuery)
- * @param {Object} data
- * @param {jqXHR} jqxhr
- * @return {jQuery.Promise}
- */
- FlowBoardComponentApiEventsMixin.UI.events.apiHandlers.submitReply =
function ( info, data, jqxhr ) {
- var $form = $( this ).closest( 'form' ),
- flowBoard = mw.flow.getPrototypeMethod( 'board',
'getInstanceByElement' )( $form ),
- schemaName = $( this ).data( 'flow-eventlog-schema' ),
- funnelId = $( this ).data( 'flow-eventlog-funnel-id' );
-
- if ( info.status !== 'done' ) {
- // Error will be displayed by default, nothing else to
wrap up
- return $.Deferred().resolve().promise();
- }
-
- flowBoard.logEvent( schemaName, { action: 'save-success',
funnelId: funnelId } );
-
- // Execute cancel callback to destroy form
- flowBoard.emitWithReturn( 'cancelForm', $form );
-
- // Target should be flow-topic
- // @todo: add 3rd argument (target selector); there's no need
to refresh entire topic
- return _flowBoardComponentRefreshTopic( info.$target,
data.flow.reply.workflow );
};
/**
diff --git
a/modules/engine/components/board/base/flow-board-interactive-events.js
b/modules/engine/components/board/base/flow-board-interactive-events.js
index b9602da..76ec59e 100644
--- a/modules/engine/components/board/base/flow-board-interactive-events.js
+++ b/modules/engine/components/board/base/flow-board-interactive-events.js
@@ -58,159 +58,6 @@
return $deferred.resolve().promise();
};
- /**
- * @param {Event} event
- * @return {jQuery.Promise}
- */
-
FlowBoardComponentInteractiveEventsMixin.UI.events.interactiveHandlers.activateReplyTopic
= function ( event ) {
- var $topic = $( this ).closest( '.flow-topic' ),
- topicId = $topic.data( 'flow-id' ),
- component;
-
- // The reply form is used in multiple places. This will check
if it was
- // triggered from inside the topic reply form.
- if ( $( this ).closest( '#flow-reply-' + topicId ).length === 0
) {
- // Not in topic reply form
- return $.Deferred().reject();
- }
-
- // Only if the textarea is compressed, is it being activated.
Otherwise,
- // it has already expanded and this focus is now just
re-focussing the
- // already active form
- if ( !$( this ).hasClass( 'flow-input-compressed' ) ) {
- // Form already activated
- return $.Deferred().reject();
- }
-
- component = mw.flow.getPrototypeMethod( 'component',
'getInstanceByElement' )( $( this ) );
- component.logEvent(
- 'FlowReplies',
- // log data
- {
- entrypoint: 'reply-bottom',
- action: 'initiate'
- },
- // nodes to forward funnel to
- $( this ).findWithParent(
- '< .flow-reply-form [data-role="cancel"],' +
- '< .flow-reply-form [data-role="submit"]'
- )
- );
-
- return $.Deferred().resolve();
- };
-
- /**
- * @param {Event} event
- */
-
FlowBoardComponentInteractiveEventsMixin.UI.events.interactiveHandlers.activateNewTopic
= function ( event ) {
- var $form = $( this ).closest( '.flow-newtopic-form' ),
- component;
-
- // Only if the textarea is compressed, is it being activated.
Otherwise,
- // it has already expanded and this focus is now just
re-focussing the
- // already active form
- if ( $form.find( '.flow-input-compressed' ).length === 0 ) {
- // Form already activated
- return $.Deferred().reject();
- }
-
- component = mw.flow.getPrototypeMethod( 'component',
'getInstanceByElement' )( $( this ) );
- component.logEvent(
- 'FlowReplies',
- // log data
- {
- entrypoint: 'new-topic',
- action: 'initiate'
- },
- // nodes to forward funnel to
- $( this ).findWithParent(
- '< .flow-newtopic-form [data-role="cancel"],' +
- '< .flow-newtopic-form [data-role="submit"]'
- )
- );
-
- return $.Deferred().resolve();
- };
-
- /**
- * @param {Event} event
- */
-
FlowBoardComponentInteractiveEventsMixin.UI.events.interactiveHandlers.activateReplyPost
= function ( event ) {
- event.preventDefault();
-
- var $form,
- $this = $( this ),
- topicId = $this.closest( '.flow-topic' ).data(
'flow-id' ),
- flowBoard = mw.flow.getPrototypeMethod( 'board',
'getInstanceByElement' )( $this ),
- $post = $this.closest( '.flow-post' ),
- href = $this.attr( 'href' ),
- uri = new mw.Uri( href ),
- postId = uri.query.topic_postId,
- $targetPost = $( '#flow-post-' + postId ),
- topicTitle = $post.closest( '.flow-topic' ).find(
'.flow-topic-title' ).text(),
- replyToContent = $post.find( '.flow-post-content'
).filter( ':first' ).text() || topicTitle,
- author = $.trim( $post.find( '.flow-author' ).filter(
':first' ).find( '.mw-userlink' ).text() ),
- $deferred = $.Deferred();
-
- if ( $targetPost.length === 0 ) {
- $targetPost = $( '#flow-topic-' + postId );
- }
-
- // forward all top level replys to the topic reply box
- if ( $targetPost.is( '.flow-topic' ) ) {
- $targetPost.find( '#flow-post-' + postId +
'-form-content' ).trigger( 'focus' );
- return $deferred.resolve().promise();
- }
-
- // Check if reply form has already been opened
- if ( $post.data( 'flow-replying' ) ) {
- return $deferred.reject().promise();
- }
- $post.data( 'flow-replying', true );
-
- $form = $(
flowBoard.constructor.static.TemplateEngine.processTemplateGetFragment(
- 'flow_reply_form.partial',
- // arguments can be empty: we just want an empty reply
form
- {
- actions: {
- reply: {
- url: href,
- text: mw.msg(
'flow-reply-link', author )
- }
- },
- postId: postId,
- author: {
- name: author
- },
- // text for flow-reply-topic-title-placeholder
placeholder
- properties: {
- 'topic-of-post': $.trim( replyToContent
).substr( 0, 200 )
- },
- // Topic:UUID
- articleTitle: mw.config.get(
'wgFormattedNamespaces' )[ 2600 ] + ':' + topicId[ 0 ].toUpperCase() +
topicId.slice( 1 )
- }
- ) ).children();
-
- // Set the cancel callback on this form so that it gets rid of
the form.
- // We have to make sure the data attribute is added to the
form; the
- // addBack is failsafe for when form is actually the root node
in $form
- // already (there may or may not be parent containers)
- flowBoard.emitWithReturn( 'addFormCancelCallback', $form.find(
'form' ).addBack( 'form' ), function () {
- $post.removeData( 'flow-replying' );
- $form.remove();
- } );
-
- // Add reply form below the post being replied to (WRT max
depth)
- $targetPost.children( '.flow-replies' ).append( $form );
- $form.conditionalScrollIntoView();
-
- // focus the input
- $form.find( 'textarea' ).focus();
-
- return $deferred.resolve().promise();
- };
-
// @todo remove these data-flow handler forwarder callbacks when
data-mwui handlers are implemented
$( [ 'close', 'prevOrClose', 'nextOrSubmit', 'prev', 'next' ] ).each(
function ( i, fn ) {
// Assigns each handler with the prefix 'modal', eg. 'close'
becomes 'modalClose'
diff --git a/modules/flow-initialize.js b/modules/flow-initialize.js
index 22717a8..c0796f1 100644
--- a/modules/flow-initialize.js
+++ b/modules/flow-initialize.js
@@ -165,6 +165,9 @@
flowBoard.on( 'loadmore', function ( topiclist ) {
// Add to the DM board
mw.flow.system.populateBoardTopicsFromJson( topiclist );
+
+ replaceReplyForms( $board );
+ deactivateReplyLinks( $board );
} );
// HACK: Update the DM when topic is refreshed
@@ -185,9 +188,6 @@
replaceReplyForms( topicData.$topic );
deactivateReplyLinks( topicData.$topic );
-
- // Cancel the interactive handler so "old" system
doesn't get triggered for internal replies
- $(
'[data-flow-interactive-handler="activateReplyPost"]' ).attr(
'data-flow-interactive-handler', '' );
} );
// Load a topic from the ToC that isn't rendered on
@@ -282,7 +282,7 @@
function deactivateReplyLinks( $element ) {
// Cancel the interactive handler so "old" system
doesn't get triggered for internal replies
- $element.find(
'[data-flow-interactive-handler="activateReplyPost"]' ).each( function () {
+ $element.find( 'a.flow-reply-link' ).each( function () {
// Store the needed details so we can get rid
of the URL in JS mode
var href = $( this ).attr( 'href' ),
uri = new mw.Uri( href ),
--
To view, visit https://gerrit.wikimedia.org/r/243022
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1d4848288394afce741bdf0ef0a31d6fc3bb72df
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Mooeypoo <[email protected]>
Gerrit-Reviewer: Sbisson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits