Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
AnimationXBlock
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
AnimationXBlock
Commits
e17e5d9e
Commit
e17e5d9e
authored
Jun 04, 2014
by
Piotr Mitros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Grading, etc.
parent
de846cc3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
5 deletions
+48
-5
README.md
+2
-3
animation/animation.py
+41
-2
animation/static/js/src/animation.js
+5
-0
No files found.
README.md
View file @
e17e5d9e
...
...
@@ -9,7 +9,7 @@ Next steps:
*
Discoverability is poor. The tool should either have instructions
the first time it pops up, fade-in/fade-out text explaining slider,
or at the very least, a tooltip.
*
The slider knob should turn green when done.
*
The slider knob should turn green when done. We add an animation_done
class when this happens; the CSS just needs to use it.
*
There should be an option for no text (if text is e.g. in the image)
*
Nicer styling
*
Grading/progress
\ No newline at end of file
animation/animation.py
View file @
e17e5d9e
...
...
@@ -5,7 +5,7 @@ import json
import
pkg_resources
from
xblock.core
import
XBlock
from
xblock.fields
import
Scope
,
Integer
,
List
from
xblock.fields
import
Scope
,
Integer
,
List
,
String
,
DateTime
,
Float
from
xblock.fragment
import
Fragment
class
AnimationXBlock
(
XBlock
):
...
...
@@ -57,6 +57,8 @@ class AnimationXBlock(XBlock):
self
.
position
=
data
[
'position'
]
if
'max_position'
in
data
:
self
.
max_position
=
data
[
'max_position'
]
grade
=
self
.
max_position
/
float
(
len
(
self
.
animation
))
self
.
runtime
.
publish
(
self
,
'grade'
,
{
'value'
:
grade
,
'max_value'
:
1
})
return
{
"status"
:
"success"
}
def
resource_string
(
self
,
path
):
...
...
@@ -115,7 +117,6 @@ class AnimationXBlock(XBlock):
return
block
# TO-DO: change this to create the scenarios you'd like to see in the
# workbench while developing your XBlock.
@staticmethod
...
...
@@ -137,3 +138,41 @@ With the gaps between the pins aligned with the shear line, the plug (yellow) ca
</vertical_demo>
"""
),
]
## Everything below is stolen from https://github.com/edx/edx-ora2/blob/master/apps/openassessment/xblock/lms_mixin.py
## It's needed to keep the LMS+Studio happy.
## It should be included as a mixin.
display_name
=
String
(
default
=
"Completion"
,
scope
=
Scope
.
settings
,
help
=
"Display name"
)
start
=
DateTime
(
default
=
None
,
scope
=
Scope
.
settings
,
help
=
"ISO-8601 formatted string representing the start date of this assignment. We ignore this."
)
due
=
DateTime
(
default
=
None
,
scope
=
Scope
.
settings
,
help
=
"ISO-8601 formatted string representing the due date of this assignment. We ignore this."
)
weight
=
Float
(
display_name
=
"Problem Weight"
,
help
=
(
"Defines the number of points each problem is worth. "
"If the value is not set, the problem is worth the sum of the "
"option point values."
),
values
=
{
"min"
:
0
,
"step"
:
.
1
},
scope
=
Scope
.
settings
)
def
has_dynamic_children
(
self
):
"""Do we dynamically determine our children? No, we don't have any.
"""
return
False
def
max_score
(
self
):
"""The maximum raw score of our problem.
"""
return
1
animation/static/js/src/animation.js
View file @
e17e5d9e
...
...
@@ -20,6 +20,11 @@ function AnimationXBlock(runtime, element) {
$
(
".animation_image"
).
attr
(
"src"
,
animation
[
position
].
src
);
$
(
".animation_text"
).
html
(
animation
[
position
].
desc
);
if
(
position
>
max_position
)
{
max_position
=
position
;
}
console
.
log
(
"Update"
);
if
(
max_position
==
animation
.
length
-
1
)
{
console
.
log
(
"Done"
);
$
(
'.animation_wrapper'
,
element
).
addClass
(
"animation_done"
);
}
$
.
ajax
({
type
:
"POST"
,
url
:
handlerUrl
,
...
...
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