Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
RateXBlock
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
RateXBlock
Commits
d2f1a64f
Commit
d2f1a64f
authored
Jun 26, 2015
by
Piotr Mitros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prompts is now a list; not fully flushed out
parent
0e4a447a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
11 deletions
+8
-11
rate/rate.py
+6
-9
rate/static/html/rate.html
+2
-2
No files found.
rate/rate.py
View file @
d2f1a64f
...
...
@@ -4,6 +4,7 @@ This is an XBlock designed to allow people to provide feedback on our
course resources.
"""
import
random
import
pkg_resources
...
...
@@ -50,18 +51,13 @@ class RateXBlock(XBlock):
help
=
"Names of ratings for Likert-like scale"
)
string_prompt
=
String
(
default
=
"Please provide us feedback on this section."
,
prompts
=
List
(
default
=
[{
'string'
:
"Please provide us feedback on this section."
,
'likert'
:
"Please rate your overall experience with this section."
}],
scope
=
Scope
.
settings
,
help
=
"Freeform user prompt"
)
likert_prompt
=
String
(
default
=
"Please rate your overall experience with this section."
,
scope
=
Scope
.
settings
,
help
=
"Likert-like scale user prompt"
)
user_vote
=
Integer
(
default
=-
1
,
scope
=
Scope
.
user_state
,
help
=
"How user voted. -1 if didn't vote"
...
...
@@ -90,7 +86,8 @@ class RateXBlock(XBlock):
indexes
=
range
(
len
(
self
.
mouseover_icons
))
active_vote
=
[
" rate_rating_active "
if
i
==
self
.
user_vote
else
""
for
i
in
indexes
]
scale
=
u""
.
join
(
scale_item
.
format
(
level
=
level
,
icon
=
icon
,
i
=
i
,
active
=
active
)
for
(
level
,
icon
,
i
,
active
)
in
zip
(
self
.
mouseover_levels
,
self
.
mouseover_icons
,
indexes
,
active_vote
))
frag
=
Fragment
(
html
.
format
(
self
=
self
,
scale
=
scale
))
prompt
=
random
.
sample
(
self
.
prompts
,
1
)[
0
]
frag
=
Fragment
(
html
.
format
(
self
=
self
,
scale
=
scale
,
string_prompt
=
prompt
[
'string'
],
likert_prompt
=
prompt
[
'likert'
]))
frag
.
add_css
(
self
.
resource_string
(
"static/css/rate.css"
))
frag
.
add_javascript
(
self
.
resource_string
(
"static/js/src/rate.js"
))
frag
.
initialize_js
(
'RateXBlock'
)
...
...
rate/static/html/rate.html
View file @
d2f1a64f
<div
class=
"rate_block"
>
<div
class=
"rate_header"
>
{s
elf.s
tring_prompt}
</div>
<div
class=
"rate_header"
>
{string_prompt}
</div>
<div
class=
"rate_string_input"
>
<textarea
class=
"rate_string_area"
rows=
"4"
cols=
"30"
>
{self.user_feedback}
</textarea>
<div
class=
"rate_thank_you"
>
Thank you!
</div>
</div>
<div
class=
"rate_likert_header"
>
{
self.
likert_prompt}
</div>
<div
class=
"rate_likert_header"
>
{likert_prompt}
</div>
<div
class=
"rate_likert_scale"
>
{scale}
</div>
</div>
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