Commit b08c156e by Braden MacDonald Committed by GitHub

Merge pull request #38 from murad-hubib/surveryResponseLable

Survery response lable
parents fbb41118 e37ca68f
...@@ -302,6 +302,16 @@ th.survey-answer { ...@@ -302,6 +302,16 @@ th.survey-answer {
visibility: visible; visibility: visible;
} }
.survey-percentage span{
display: inline-block;
}
.survey-percentage .percentage{
width: 50px;
text-align: right;
float: right;
}
.survey-table .survey-question{ .survey-table .survey-question{
display: block; display: block;
border: 0; border: 0;
...@@ -316,6 +326,11 @@ th.survey-answer { ...@@ -316,6 +326,11 @@ th.survey-answer {
.survey-table .survey-option .visible-mobile-only{ .survey-table .survey-option .visible-mobile-only{
width: calc(100% - 20px); width: calc(100% - 20px);
} }
.survey-table .survey-percentage .visible-mobile-only{
width: calc(100% - 60px);
}
.survey-table .survey-option{ .survey-table .survey-option{
display: block; display: block;
border: 1px solid #ccc; border: 1px solid #ccc;
......
...@@ -22,7 +22,16 @@ ...@@ -22,7 +22,16 @@
{{{label}}} {{{label}}}
</th> </th>
{{#each answers}} {{#each answers}}
<td class="survey-percentage survey-option{{#if choice}} survey-choice{{/if}}{{#if top}} poll-top-choice{{/if}}" aria-labelledby="answer-{{key}}-{{../../block_id}}">{{percent}}%</td> <td class="survey-percentage survey-option{{#if choice}} survey-choice{{/if}}{{#if top}} poll-top-choice{{/if}}" aria-labelledby="answer-{{key}}-{{../../block_id}}">
<span class="visible-mobile-only">
{{#each ../../answers}}
{{#if_eq key ../key}}
{{label}}
{{/if_eq}}
{{/each}}
</span>
<span class="percentage">{{percent}}%</span>
</td>
{{/each}} {{/each}}
</tr> </tr>
{{/each}} {{/each}}
......
...@@ -37,6 +37,15 @@ function PollUtil (runtime, element, pollType) { ...@@ -37,6 +37,15 @@ function PollUtil (runtime, element, pollType) {
}); });
}); });
// Add helper for equality check
Handlebars.registerHelper('if_eq', function(a, b, opts) {
if(a == b)
return opts.fn(this);
else
return opts.inverse(this);
});
this.resultsTemplate = Handlebars.compile($("." + pollType + "-results-template", element).html()); this.resultsTemplate = Handlebars.compile($("." + pollType + "-results-template", element).html());
this.viewResultsButton = $('.view-results-button', element); this.viewResultsButton = $('.view-results-button', element);
......
...@@ -44,7 +44,7 @@ def package_data(pkg, roots): ...@@ -44,7 +44,7 @@ def package_data(pkg, roots):
setup( setup(
name='xblock-poll', name='xblock-poll',
version='1.3.4', version='1.3.5',
description='An XBlock for polling users.', description='An XBlock for polling users.',
packages=[ packages=[
'poll', 'poll',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment