user interface improvements: show percentage; mouseover tooltip on radio buttons
This commit is contained in:
parent
872edab5c0
commit
ac144b99a3
4 changed files with 34 additions and 12 deletions
|
@ -42,6 +42,8 @@ class SurveyView(ConceptView):
|
||||||
return template.macros['survey']
|
return template.macros['survey']
|
||||||
|
|
||||||
def results(self):
|
def results(self):
|
||||||
|
result = []
|
||||||
|
response = None
|
||||||
form = self.request.form
|
form = self.request.form
|
||||||
if 'submit' in form:
|
if 'submit' in form:
|
||||||
self.data = {}
|
self.data = {}
|
||||||
|
@ -53,15 +55,19 @@ class SurveyView(ConceptView):
|
||||||
value = int(value)
|
value = int(value)
|
||||||
self.data[uid] = value
|
self.data[uid] = value
|
||||||
response.values[question] = value
|
response.values[question] = value
|
||||||
|
# TODO: store self.data in track
|
||||||
|
# else:
|
||||||
|
# get response from track
|
||||||
|
if response is not None:
|
||||||
result = response.getGroupedResult()
|
result = response.getGroupedResult()
|
||||||
return [dict(category=r[0].title, text=r[1].text) for r in result]
|
return [dict(category=r[0].title, text=r[1].text,
|
||||||
#return [{'category': 'foo', 'text': 'bar'}]
|
score=int(round(r[2] * 100)))
|
||||||
return []
|
for r in result]
|
||||||
|
|
||||||
def isChecked(self, question, value):
|
def getValues(self, question):
|
||||||
|
setting = 0
|
||||||
if self.data is not None:
|
if self.data is not None:
|
||||||
setting = self.data.get(question.uid)
|
setting = self.data.get(question.uid) or 0
|
||||||
if setting is not None:
|
return [dict(value=i, checked=(i == setting))
|
||||||
return value == setting
|
for i in range(question.answerRange)]
|
||||||
return value == 0
|
|
||||||
|
|
||||||
|
|
|
@ -11,10 +11,12 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th i18n:translate="">Category</th>
|
<th i18n:translate="">Category</th>
|
||||||
<th i18n:translate="">Response</th>
|
<th i18n:translate="">Response</th>
|
||||||
|
<th i18n:translate="">%</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr tal:repeat="fbitem feedback">
|
<tr tal:repeat="fbitem feedback">
|
||||||
<td tal:content="fbitem/category" />
|
<td tal:content="fbitem/category" />
|
||||||
<td tal:content="fbitem/text" />
|
<td tal:content="fbitem/text" />
|
||||||
|
<td tal:content="fbitem/score" />
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<br />
|
<br />
|
||||||
|
@ -37,12 +39,14 @@
|
||||||
<tr tal:repeat="question item/adapted/questions">
|
<tr tal:repeat="question item/adapted/questions">
|
||||||
<td tal:content="question/text" />
|
<td tal:content="question/text" />
|
||||||
<td style="white-space: nowrap">
|
<td style="white-space: nowrap">
|
||||||
<span tal:repeat="value python:range(question.answerRange)">
|
<span tal:repeat="value python:item.getValues(question)">
|
||||||
<input type="radio"
|
<input type="radio"
|
||||||
|
i18n:attributes="title"
|
||||||
tal:attributes="
|
tal:attributes="
|
||||||
name string:question_${question/uid};
|
name string:question_${question/uid};
|
||||||
value value;
|
value value/value;
|
||||||
checked python:item.isChecked(question, value)" />
|
checked value/checked;
|
||||||
|
title string:survey_value_${value/value}" />
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Binary file not shown.
|
@ -202,6 +202,18 @@ msgstr "Trifft nicht zu"
|
||||||
msgid "Fully applies"
|
msgid "Fully applies"
|
||||||
msgstr "Trifft voll zu"
|
msgstr "Trifft voll zu"
|
||||||
|
|
||||||
|
msgid "survey_value_0"
|
||||||
|
msgstr "trifft für unser Unternehmen überhaupt nicht zu"
|
||||||
|
|
||||||
|
msgid "survey_value_1"
|
||||||
|
msgstr "trifft eher nicht zu"
|
||||||
|
|
||||||
|
msgid "survey_value_2"
|
||||||
|
msgstr "trifft eher zu"
|
||||||
|
|
||||||
|
msgid "survey_value_3"
|
||||||
|
msgstr "trifft für unser Unternehmen voll und ganz zu"
|
||||||
|
|
||||||
msgid "Evaluate Questionnaire"
|
msgid "Evaluate Questionnaire"
|
||||||
msgstr "Fragebogen auswerten"
|
msgstr "Fragebogen auswerten"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue