Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xblock-activetable
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-activetable
Commits
b11d2bfc
Commit
b11d2bfc
authored
Oct 20, 2015
by
Sven Marnach
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add status image indicating answer correctness.
parent
d14ad362
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
6 deletions
+16
-6
activetable/static/css/activetable.css
+10
-3
activetable/static/js/src/activetable.js
+6
-3
No files found.
activetable/static/css/activetable.css
View file @
b11d2bfc
...
@@ -85,15 +85,22 @@
...
@@ -85,15 +85,22 @@
.activetable_block
#activetable-help-button
:hover
{
.activetable_block
#activetable-help-button
:hover
{
color
:
#bd9730
;
color
:
#bd9730
;
}
}
.activetable_block
.status
,
.activetable_block
.status-message
{
margin
:
2em
0
;
}
.activetable_block
.status
{
.activetable_block
.status
{
margin
:
1.5em
0
0.5em
;
display
:
inline-block
;
display
:
inline-block
;
width
:
20px
;
width
:
20px
;
height
:
20px
;
height
:
20px
;
background
:
url("/static/images/unanswered-icon.png")
center
no-repeat
;
background
:
url("/static/images/unanswered-icon.png")
center
no-repeat
;
}
}
.activetable_block
.status.correct
{
background-image
:
url("/static/images/correct-icon.png")
;
}
.activetable_block
.status.incorrect
{
background-image
:
url("/static/images/incorrect-icon.png")
;
}
.activetable_block
.status-message
{
margin
:
0.5em
0
1.5em
;
}
.activetable_block
.action
.check
{
.activetable_block
.action
.check
{
height
:
40px
;
height
:
40px
;
font-weight
:
600
;
font-weight
:
600
;
...
...
activetable/static/js/src/activetable.js
View file @
b11d2bfc
...
@@ -3,11 +3,14 @@ function ActiveTableXBlock(runtime, element, init_args) {
...
@@ -3,11 +3,14 @@ function ActiveTableXBlock(runtime, element, init_args) {
var
checkHandlerUrl
=
runtime
.
handlerUrl
(
element
,
'check_answers'
);
var
checkHandlerUrl
=
runtime
.
handlerUrl
(
element
,
'check_answers'
);
function
updateStatusMessage
(
num_total
,
num_correct
)
{
function
updateStatus
(
num_total
,
num_correct
)
{
var
$status
=
$
(
'.status'
,
element
);
var
$status_message
=
$
(
'.status-message'
,
element
);
var
$status_message
=
$
(
'.status-message'
,
element
);
if
(
num_total
==
num_correct
)
{
if
(
num_total
==
num_correct
)
{
$status
.
removeClass
(
'incorrect'
).
addClass
(
'correct'
);
$status_message
.
text
(
'Great job!'
);
$status_message
.
text
(
'Great job!'
);
}
else
{
}
else
{
$status
.
removeClass
(
'correct'
).
addClass
(
'incorrect'
);
$status_message
.
text
(
$status_message
.
text
(
'You have '
+
num_correct
+
' out of '
+
num_total
+
' cells correct.'
'You have '
+
num_correct
+
' out of '
+
num_total
+
' cells correct.'
);
);
...
@@ -24,7 +27,7 @@ function ActiveTableXBlock(runtime, element, init_args) {
...
@@ -24,7 +27,7 @@ function ActiveTableXBlock(runtime, element, init_args) {
num_total
+=
1
;
num_total
+=
1
;
num_correct
+=
correct
;
num_correct
+=
correct
;
});
});
updateStatus
Message
(
num_total
,
num_correct
);
updateStatus
(
num_total
,
num_correct
);
}
}
function
checkAnswers
(
e
)
{
function
checkAnswers
(
e
)
{
...
@@ -49,6 +52,6 @@ function ActiveTableXBlock(runtime, element, init_args) {
...
@@ -49,6 +52,6 @@ function ActiveTableXBlock(runtime, element, init_args) {
$
(
'#activetable-help-button'
,
element
).
click
(
toggleHelp
);
$
(
'#activetable-help-button'
,
element
).
click
(
toggleHelp
);
$
(
'.action .check'
,
element
).
click
(
checkAnswers
);
$
(
'.action .check'
,
element
).
click
(
checkAnswers
);
if
(
init_args
.
num_total_answers
)
{
if
(
init_args
.
num_total_answers
)
{
updateStatus
Message
(
init_args
.
num_total_answers
,
init_args
.
num_correct_answers
);
updateStatus
(
init_args
.
num_total_answers
,
init_args
.
num_correct_answers
);
}
}
}
}
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