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']
|
||||
|
||||
def results(self):
|
||||
result = []
|
||||
response = None
|
||||
form = self.request.form
|
||||
if 'submit' in form:
|
||||
self.data = {}
|
||||
|
@ -53,15 +55,19 @@ class SurveyView(ConceptView):
|
|||
value = int(value)
|
||||
self.data[uid] = value
|
||||
response.values[question] = value
|
||||
# TODO: store self.data in track
|
||||
# else:
|
||||
# get response from track
|
||||
if response is not None:
|
||||
result = response.getGroupedResult()
|
||||
return [dict(category=r[0].title, text=r[1].text) for r in result]
|
||||
#return [{'category': 'foo', 'text': 'bar'}]
|
||||
return []
|
||||
return [dict(category=r[0].title, text=r[1].text,
|
||||
score=int(round(r[2] * 100)))
|
||||
for r in result]
|
||||
|
||||
def isChecked(self, question, value):
|
||||
def getValues(self, question):
|
||||
setting = 0
|
||||
if self.data is not None:
|
||||
setting = self.data.get(question.uid)
|
||||
if setting is not None:
|
||||
return value == setting
|
||||
return value == 0
|
||||
setting = self.data.get(question.uid) or 0
|
||||
return [dict(value=i, checked=(i == setting))
|
||||
for i in range(question.answerRange)]
|
||||
|
||||
|
|
|
@ -11,10 +11,12 @@
|
|||
<tr>
|
||||
<th i18n:translate="">Category</th>
|
||||
<th i18n:translate="">Response</th>
|
||||
<th i18n:translate="">%</th>
|
||||
</tr>
|
||||
<tr tal:repeat="fbitem feedback">
|
||||
<td tal:content="fbitem/category" />
|
||||
<td tal:content="fbitem/text" />
|
||||
<td tal:content="fbitem/score" />
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
|
@ -37,12 +39,14 @@
|
|||
<tr tal:repeat="question item/adapted/questions">
|
||||
<td tal:content="question/text" />
|
||||
<td style="white-space: nowrap">
|
||||
<span tal:repeat="value python:range(question.answerRange)">
|
||||
<input type="radio"
|
||||
<span tal:repeat="value python:item.getValues(question)">
|
||||
<input type="radio"
|
||||
i18n:attributes="title"
|
||||
tal:attributes="
|
||||
name string:question_${question/uid};
|
||||
value value;
|
||||
checked python:item.isChecked(question, value)" />
|
||||
value value/value;
|
||||
checked value/checked;
|
||||
title string:survey_value_${value/value}" />
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
Binary file not shown.
|
@ -202,6 +202,18 @@ msgstr "Trifft nicht zu"
|
|||
msgid "Fully applies"
|
||||
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"
|
||||
msgstr "Fragebogen auswerten"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue