Matthias Mullie has uploaded a new change for review.

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

Change subject: Expand new-topic form if it has preloaded content
......................................................................

Expand new-topic form if it has preloaded content

Change-Id: Ia9d7e5e9ad657a0d31585aa53fea1492848c1b56
---
M handlebars/compiled/flow_block_topiclist.handlebars.php
M handlebars/compiled/flow_block_topiclist_newtopic.handlebars.php
M handlebars/flow_newtopic_form.partial.handlebars
M modules/engine/components/common/flow-component-events.js
4 files changed, 5 insertions(+), 3 deletions(-)


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

diff --git a/handlebars/compiled/flow_block_topiclist.handlebars.php 
b/handlebars/compiled/flow_block_topiclist.handlebars.php
index a5620dc..9a78bcc 100644
--- a/handlebars/compiled/flow_block_topiclist.handlebars.php
+++ b/handlebars/compiled/flow_block_topiclist.handlebars.php
@@ -112,7 +112,7 @@
         class="mw-ui-button mw-ui-destructive mw-ui-quiet mw-ui-flush-right 
flow-js"
 
 >'.LCRun3::ch($cx, 'l10n', array(array('flow-cancel'),array()), 
 >'encq').'</button>
-';},'flow_newtopic_form' => function ($cx, $in) {return 
''.((LCRun3::ifvar($cx, ((isset($in['actions']['newtopic']) && 
is_array($in['actions'])) ? $in['actions']['newtopic'] : null))) ? '    <form 
action="'.htmlentities((string)((isset($in['actions']['newtopic']['url']) && 
is_array($in['actions']['newtopic'])) ? $in['actions']['newtopic']['url'] : 
null), ENT_QUOTES, 'UTF-8').'" method="POST" class="flow-newtopic-form" 
data-flow-initial-state="collapsed">
+';},'flow_newtopic_form' => function ($cx, $in) {return 
''.((LCRun3::ifvar($cx, ((isset($in['actions']['newtopic']) && 
is_array($in['actions'])) ? $in['actions']['newtopic'] : null))) ? '    <form 
action="'.htmlentities((string)((isset($in['actions']['newtopic']['url']) && 
is_array($in['actions']['newtopic'])) ? $in['actions']['newtopic']['url'] : 
null), ENT_QUOTES, 'UTF-8').'" method="POST" class="flow-newtopic-form" 
data-flow-initial-state="'.((LCRun3::ifvar($cx, 
((isset($in['submitted']['content']) && is_array($in['submitted'])) ? 
$in['submitted']['content'] : null))) ? 'expanded' : 'collapsed').'">
 '.LCRun3::p($cx, 'flow_errors', array(array($in),array())).'
 '.LCRun3::hbch($cx, 'ifAnonymous', array(array(),array()), $in, false, 
function($cx, $in) {return ''.LCRun3::p($cx, 'flow_anon_warning', 
array(array($in),array())).'';}).'
                <input type="hidden" name="wpEditToken" 
value="'.htmlentities((string)((isset($cx['sp_vars']['root']['editToken']) && 
is_array($cx['sp_vars']['root'])) ? $cx['sp_vars']['root']['editToken'] : 
null), ENT_QUOTES, 'UTF-8').'" />
diff --git a/handlebars/compiled/flow_block_topiclist_newtopic.handlebars.php 
b/handlebars/compiled/flow_block_topiclist_newtopic.handlebars.php
index 650b09c..523f946 100644
--- a/handlebars/compiled/flow_block_topiclist_newtopic.handlebars.php
+++ b/handlebars/compiled/flow_block_topiclist_newtopic.handlebars.php
@@ -50,7 +50,7 @@
         class="mw-ui-button mw-ui-destructive mw-ui-quiet mw-ui-flush-right 
flow-js"
 
 >'.LCRun3::ch($cx, 'l10n', array(array('flow-cancel'),array()), 
 >'encq').'</button>
-';},'flow_newtopic_form' => function ($cx, $in) {return 
''.((LCRun3::ifvar($cx, ((isset($in['actions']['newtopic']) && 
is_array($in['actions'])) ? $in['actions']['newtopic'] : null))) ? '    <form 
action="'.htmlentities((string)((isset($in['actions']['newtopic']['url']) && 
is_array($in['actions']['newtopic'])) ? $in['actions']['newtopic']['url'] : 
null), ENT_QUOTES, 'UTF-8').'" method="POST" class="flow-newtopic-form" 
data-flow-initial-state="collapsed">
+';},'flow_newtopic_form' => function ($cx, $in) {return 
''.((LCRun3::ifvar($cx, ((isset($in['actions']['newtopic']) && 
is_array($in['actions'])) ? $in['actions']['newtopic'] : null))) ? '    <form 
action="'.htmlentities((string)((isset($in['actions']['newtopic']['url']) && 
is_array($in['actions']['newtopic'])) ? $in['actions']['newtopic']['url'] : 
null), ENT_QUOTES, 'UTF-8').'" method="POST" class="flow-newtopic-form" 
data-flow-initial-state="'.((LCRun3::ifvar($cx, 
((isset($in['submitted']['content']) && is_array($in['submitted'])) ? 
$in['submitted']['content'] : null))) ? 'expanded' : 'collapsed').'">
 '.LCRun3::p($cx, 'flow_errors', array(array($in),array())).'
 '.LCRun3::hbch($cx, 'ifAnonymous', array(array(),array()), $in, false, 
function($cx, $in) {return ''.LCRun3::p($cx, 'flow_anon_warning', 
array(array($in),array())).'';}).'
                <input type="hidden" name="wpEditToken" 
value="'.htmlentities((string)((isset($cx['sp_vars']['root']['editToken']) && 
is_array($cx['sp_vars']['root'])) ? $cx['sp_vars']['root']['editToken'] : 
null), ENT_QUOTES, 'UTF-8').'" />
diff --git a/handlebars/flow_newtopic_form.partial.handlebars 
b/handlebars/flow_newtopic_form.partial.handlebars
index 2858ce4..fcf7c34 100644
--- a/handlebars/flow_newtopic_form.partial.handlebars
+++ b/handlebars/flow_newtopic_form.partial.handlebars
@@ -1,5 +1,5 @@
 {{#if actions.newtopic}}
-       <form action="{{actions.newtopic.url}}" method="POST" 
class="flow-newtopic-form" data-flow-initial-state="collapsed">
+       <form action="{{actions.newtopic.url}}" method="POST" 
class="flow-newtopic-form" data-flow-initial-state="{{#if 
submitted.content}}expanded{{else}}collapsed{{/if}}">
                {{> flow_errors}}
 
                {{#ifAnonymous}}
diff --git a/modules/engine/components/common/flow-component-events.js 
b/modules/engine/components/common/flow-component-events.js
index bd78ff7..6baf8b2 100644
--- a/modules/engine/components/common/flow-component-events.js
+++ b/modules/engine/components/common/flow-component-events.js
@@ -477,6 +477,8 @@
 
                        if ( initialState === 'collapsed' ) {
                                component.emitWithReturn( 'hideForm', $this );
+                       } else if ( initialState === 'expanded' ) {
+                               component.emitWithReturn( 'showForm', $this );
                        }
                } );
        }

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

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

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

Reply via email to