Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/363634 )
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: I0257af97ab2f3612d51c8b88dd29769a2db49e94
---
M Quiz.class.php
M templates/Quiz.mustache
M templates/Setting.mustache
3 files changed, 44 insertions(+), 37 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/34/363634/1
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 }}"/>  </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 }}"/>  </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/363634
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0257af97ab2f3612d51c8b88dd29769a2db49e94
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits