Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xblock-poll
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
xblock-poll
Commits
50c1d944
Commit
50c1d944
authored
Jan 20, 2015
by
Jonathan Piacenti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Several appearance tweaks.
parent
1b9c44da
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
9 deletions
+14
-9
poll/poll.py
+8
-5
poll/public/css/poll.css
+2
-1
poll/public/handlebars/survey_results.handlebars
+1
-1
poll/public/html/poll.html
+1
-1
poll/public/html/poll_edit.html
+1
-0
poll/public/html/survey.html
+1
-1
No files found.
poll/poll.py
View file @
50c1d944
...
...
@@ -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.
...
...
poll/public/css/poll.css
View file @
50c1d944
...
...
@@ -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
;
}
...
...
poll/public/handlebars/survey_results.handlebars
View file @
50c1d944
<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
>
...
...
poll/public/html/poll.html
View file @
50c1d944
...
...
@@ -2,7 +2,7 @@
<div
class=
"poll-block"
>
{# If no form is present, the Javascript will load the results instead. #}
{% if not choice %}
<h
2
class=
"poll-header"
>
{{display_name}}
</h2
>
<h
3
class=
"poll-header"
>
{{display_name}}
</h3
>
<form>
<div
class=
"poll-question-container"
>
{{question|safe}}
...
...
poll/public/html/poll_edit.html
View file @
50c1d944
...
...
@@ -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>
...
...
poll/public/html/survey.html
View file @
50c1d944
...
...
@@ -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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment