Commit 50c1d944 by Jonathan Piacenti

Several appearance tweaks.

parent 1b9c44da
......@@ -375,6 +375,9 @@ class PollBlock(PollBase):
class SurveyBlock(PollBase):
display_name = String(default='Survey')
# The display name affects how the block is labeled in the studio,
# but either way we want it to say 'Poll' by default on the page.
block_name = String(default='Poll')
answers = List(
default=(
('Y', 'Yes'), ('N', 'No'),
......@@ -424,7 +427,7 @@ class SurveyBlock(PollBase):
'feedback': markdown(self.feedback) or False,
# The SDK doesn't set url_name.
'url_name': getattr(self, 'url_name', ''),
"display_name": self.display_name,
"block_name": self.block_name,
})
return self.create_fragment(
......@@ -438,7 +441,7 @@ class SurveyBlock(PollBase):
js_template = self.resource_string('/public/handlebars/poll_studio.handlebars')
context.update({
'feedback': self.feedback,
'display_name': self.display_name,
'display_name': self.block_name,
'js_template': js_template,
'multiquestion': True,
})
......@@ -567,7 +570,7 @@ class SurveyBlock(PollBase):
'answers': [
value for value in OrderedDict(self.answers).values()],
'tally': detail, 'total': total, 'feedback': markdown(self.feedback),
'plural': total > 1, 'display_name': self.display_name,
'plural': total > 1, 'block_name': self.block_name,
}
@XBlock.json_handler
......@@ -639,7 +642,7 @@ class SurveyBlock(PollBase):
result = {'success': True, 'errors': []}
feedback = data.get('feedback', '').strip()
display_name = data.get('display_name', '').strip()
block_name = data.get('display_name', '').strip()
answers = self.gather_items(data, result, 'Answer', 'answers', image=False)
questions = self.gather_items(data, result, 'Question', 'questions')
......@@ -650,7 +653,7 @@ class SurveyBlock(PollBase):
self.answers = answers
self.questions = questions
self.feedback = feedback
self.display_name = display_name
self.block_name = block_name
# Tally will not be updated until the next attempt to use it, per
# scoping limitations.
......
......@@ -110,6 +110,7 @@ li.poll-result .poll-image {
margin-top: 1em;
margin-bottom: 1em;
font-size: smaller;
font-weight: bold;
}
.survey-table {
......@@ -143,7 +144,7 @@ li.poll-result .poll-image {
}
.survey-table thead tr th {
font-weight: normal;
font-weight: bold;
font-size: .8rem;
}
......
<script id="survey-results-template" type="text/html">
<h3 class="poll-header">{{display_name}}</h3>
<h3 class="poll-header">{{block_name}}</h3>
<table class="survey-table">
<thead>
<tr>
......
......@@ -2,7 +2,7 @@
<div class="poll-block">
{# If no form is present, the Javascript will load the results instead. #}
{% if not choice %}
<h2 class="poll-header">{{display_name}}</h2>
<h3 class="poll-header">{{display_name}}</h3>
<form>
<div class="poll-question-container">
{{question|safe}}
......
......@@ -5,6 +5,7 @@
<li class="field comp-setting-entry is-set">
<div class="wrapper-comp-setting">
<label class="label setting-label poll-setting-label" for="display_name">Display Name</label>
<!-- In the case of surveys, this field will actually be used for block_name. -->
<input class="input setting-input" name="display_name" id="poll-display-name" value="{{ display_name }}" type="text" />
</div>
</li>
......
......@@ -2,7 +2,7 @@
<div class="poll-block">
{# If no form is present, the Javascript will load the results instead. #}
{% if not choices %}
<h3 class="poll-header">{{display_name}}</h3>
<h3 class="poll-header">{{block_name}}</h3>
<form>
<table class="survey-table">
<thead>
......
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