jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/363635 )

Change subject: Remove Settings box when Quiz is set to simple
......................................................................


Remove Settings box when Quiz is set to simple

Due to the change for T161317, the settings table was being displayed even when
the display is set to simple.This change modifies the mustache templates to
remove the settings box.

Bug:T169529
Change-Id: I2a51df9bfb0fac7a6b1bc8e988836a2d81f6f095
---
M Quiz.class.php
M templates/Quiz.mustache
M templates/Setting.mustache
3 files changed, 44 insertions(+), 37 deletions(-)

Approvals:
  jenkins-bot: Verified
  Mvolz: Looks good to me, approved



diff --git a/Quiz.class.php b/Quiz.class.php
index b5c3330..7ef1d2c 100644
--- a/Quiz.class.php
+++ b/Quiz.class.php
@@ -131,6 +131,8 @@
                $settingsTable = $templateParser->processTemplate(
                        'Setting',
                        [
+                               'isSettingFirstRow' => ( !$this->mDisplaySimple 
|| $this->mBeingCorrected || $this->mState === 'error' ),
+                               'isSettingOtherRow' => ( !$this->mDisplaySimple 
|| $this->mBeingCorrected ),
                                'notSimple' => !$this->mDisplaySimple,
                                'corrected' => $this->mBeingCorrected,
                                'shuffle' => $this->mShuffle,
diff --git a/templates/Quiz.mustache b/templates/Quiz.mustache
index aaa30e8..155cbec 100644
--- a/templates/Quiz.mustache
+++ b/templates/Quiz.mustache
@@ -1,9 +1,9 @@
 <div class="quiz">
        <form id="quiz{{ quiz.id }}" method="post" action="#quiz{{ quiz.id }}">
                <div style="display:inline-flex">
-                       <table class="settings">
-                               {{{ settingsTable }}}
-                       </table>
+                       {{#settingsTable }}
+                               <table class="settings">{{{ . }}}</table>
+                       {{/settingsTable }}
                </div>
                <input type="hidden" name="quizId" value="{{ quiz.id }}" />
                <div class="quizQuestions">
diff --git a/templates/Setting.mustache b/templates/Setting.mustache
index 547b580..15f30a4 100644
--- a/templates/Setting.mustache
+++ b/templates/Setting.mustache
@@ -1,41 +1,47 @@
-<tr>
-       {{# notSimple}}
-               <td>{{ wfMessage.quiz_added }}</td>
-               <td><input class="numerical" type="text" name="addedPoints" 
value="{{ mAddedPoints }}"/>&#160;&#160;</td>
-       {{/ notSimple}}
-       {{# corrected}}
-               <td class="margin" style="background:{{ color.colorRight 
}}"></td>
-               <td style="background: transparent;">{{ 
wf.Message.quiz_colorRight }}</td>
-       {{/corrected}}
-       {{# error}}
-               {{^ corrected}}
-                       <td class="margin" style="background:{{ 
color.colorError }}"></td>
-                       <td>{{ wfMessage.quiz_colorError }}</td>
+{{# isSettingFirstRow}}
+       <tr>
+               {{# notSimple}}
+                       <td>{{ wfMessage.quiz_added }}</td>
+                       <td><input class="numerical" type="text" 
name="addedPoints" value="{{ mAddedPoints }}"/>&#160;&#160;</td>
+               {{/ notSimple}}
+               {{# corrected}}
+                       <td class="margin" style="background:{{ 
color.colorRight }}"></td>
+                       <td style="background: transparent;">{{ 
wf.Message.quiz_colorRight }}</td>
                {{/corrected}}
-       {{/ error}}
+               {{# error}}
+                       {{^ corrected}}
+                               <td class="margin" style="background:{{ 
color.colorError }}"></td>
+                               <td>{{ wfMessage.quiz_colorError }}</td>
+                       {{/corrected}}
+               {{/ error}}
        </tr>
+{{/ isSettingFirstRow}}
+{{# isSettingOtherRow}}
        <tr>
-       {{# notSimple}}
-               <td>{{ wfMessage.quiz_cutoff }}</td>
-               <td><input class="numerical" type="text" name="cutoffPoints" 
value="{{ mCutoffPoints }}"/></td>
-       {{/ notSimple}}
-       {{# corrected}}
-               <td class="margin" style="background:{{ color.colorWrong 
}}"></td>
-               <td style="background: transparent;">{{ 
wfMessage.quiz_colorWrong }}</td>
-       {{/ corrected}}
+               {{# notSimple}}
+                       <td>{{ wfMessage.quiz_cutoff }}</td>
+                       <td><input class="numerical" type="text" 
name="cutoffPoints" value="{{ mCutoffPoints }}"/></td>
+               {{/ notSimple}}
+               {{# corrected}}
+                       <td class="margin" style="background:{{ 
color.colorWrong }}"></td>
+                       <td style="background: transparent;">{{ 
wfMessage.quiz_colorWrong }}</td>
+               {{/ corrected}}
        </tr>
+{{/ isSettingOtherRow}}
+{{# isSettingOtherRow}}
        <tr>
-       {{# notSimple}}
-               <td>{{{ wfMessage.quiz_ignoreCoef }}}</td>
-               <td><input type="checkbox" name="ignoringCoef" {{{ checked 
}}}/></td>
-       {{/ notSimple}}
-       {{# corrected}}
-               <td class="margin" style="background:{{ color.colorNA }}"></td>
-               <td style="background: transparent;">{{ wfMessage.quiz_colorNA 
}}</td>
-       {{/ corrected}}
+               {{# notSimple}}
+                       <td>{{{ wfMessage.quiz_ignoreCoef }}}</td>
+                       <td><input type="checkbox" name="ignoringCoef" {{{ 
checked }}}/></td>
+               {{/ notSimple}}
+               {{# corrected}}
+                       <td class="margin" style="background:{{ color.colorNA 
}}"></td>
+                       <td style="background: transparent;">{{ 
wfMessage.quiz_colorNA }}</td>
+               {{/ corrected}}
        </tr>
+{{/ isSettingOtherRow}}
+{{# notSimple}}
        <tr>
-       {{# notSimple}}
                {{# shuffle}}
                        {{^ corrected}}
                                {{# shuffleDisplay}}
@@ -55,6 +61,5 @@
                                <td>{{ wfMessage.quiz_colorError }}</td>
                        {{/ corrected}}
                {{/ error}}
-       {{/ notSimple}}
-</tr>
-</div>
+       </tr>
+{{/ notSimple}}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2a51df9bfb0fac7a6b1bc8e988836a2d81f6f095
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh <[email protected]>
Gerrit-Reviewer: Mvolz <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to