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
a7a501ce
Commit
a7a501ce
authored
Dec 14, 2015
by
Piotr Mitros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New eventing
parent
8eca3f26
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
23 deletions
+6
-23
rate/rate.py
+3
-20
rate/static/js/src/rate.js
+3
-3
No files found.
rate/rate.py
View file @
a7a501ce
...
@@ -12,26 +12,6 @@ from xblock.core import XBlock
...
@@ -12,26 +12,6 @@ from xblock.core import XBlock
from
xblock.fields
import
Scope
,
Integer
,
String
,
List
,
Float
from
xblock.fields
import
Scope
,
Integer
,
String
,
List
,
Float
from
xblock.fragment
import
Fragment
from
xblock.fragment
import
Fragment
try
:
from
eventtracking
import
tracker
except
ImportError
:
class
tracker
(
object
):
# pylint: disable=invalid-name
"""
Define tracker if eventtracking cannot be imported. This is a
workaround so that the code works in both edx-platform and
XBlock workbench (the latter of which does not support event
emission). This should be replaced with XBlock's emit(), but
at present, emit() is broken.
"""
def
__init__
(
self
):
""" Do nothing """
pass
@staticmethod
def
emit
(
param1
,
param2
):
""" In workbench, do nothing for event emission """
pass
@XBlock.needs
(
'i18n'
)
@XBlock.needs
(
'i18n'
)
class
RateXBlock
(
XBlock
):
class
RateXBlock
(
XBlock
):
...
@@ -243,6 +223,9 @@ class RateXBlock(XBlock):
...
@@ -243,6 +223,9 @@ class RateXBlock(XBlock):
if
'freeform'
not
in
data
and
'vote'
not
in
data
:
if
'freeform'
not
in
data
and
'vote'
not
in
data
:
response
=
{
"success"
:
False
,
response
=
{
"success"
:
False
,
"response"
:
_
(
"Please vote!"
)}
"response"
:
_
(
"Please vote!"
)}
self
.
runtime
.
publish
(
self
,
'edx.ratexblock.nothing_provided'
,
{})
if
'freeform'
in
data
:
if
'freeform'
in
data
:
response
=
{
"success"
:
True
,
response
=
{
"success"
:
True
,
"response"
:
_
(
"Thank you for your feedback!"
)}
"response"
:
_
(
"Thank you for your feedback!"
)}
...
...
rate/static/js/src/rate.js
View file @
a7a501ce
...
@@ -24,7 +24,7 @@ function RateXBlock(runtime, element) {
...
@@ -24,7 +24,7 @@ function RateXBlock(runtime, element) {
}
}
var
feedback
=
{
"freeform"
:
freeform
,
var
feedback
=
{
"freeform"
:
freeform
,
"vote"
:
vote
};
"vote"
:
vote
};
Logger
.
log
(
"edx.ratexblock.submit"
,
feedback
);
Logger
.
log
(
"edx.ratexblock.submit
ted
"
,
feedback
);
$
.
ajax
({
$
.
ajax
({
type
:
"POST"
,
type
:
"POST"
,
url
:
feedback_handler
,
url
:
feedback_handler
,
...
@@ -36,12 +36,12 @@ function RateXBlock(runtime, element) {
...
@@ -36,12 +36,12 @@ function RateXBlock(runtime, element) {
$
(
'.rate_radio'
,
element
).
change
(
function
(
eventObject
)
{
$
(
'.rate_radio'
,
element
).
change
(
function
(
eventObject
)
{
var
target_id
=
eventObject
.
target
.
id
;
var
target_id
=
eventObject
.
target
.
id
;
var
vote
=
parseInt
(
target_id
.
split
(
'_'
)[
1
]);
var
vote
=
parseInt
(
target_id
.
split
(
'_'
)[
1
]);
Logger
.
log
(
"edx.ratexblock.likert_
rate
"
,
{
"vote"
:
vote
});
Logger
.
log
(
"edx.ratexblock.likert_
clicked
"
,
{
"vote"
:
vote
});
});
});
$
(
'.rate_freeform_area'
,
element
).
change
(
function
(
eventObject
)
{
$
(
'.rate_freeform_area'
,
element
).
change
(
function
(
eventObject
)
{
var
freeform
=
eventObject
.
currentTarget
.
value
;
var
freeform
=
eventObject
.
currentTarget
.
value
;
Logger
.
log
(
"edx.ratexblock.freeform_
feedback
"
,
{
"freeform"
:
freeform
});
Logger
.
log
(
"edx.ratexblock.freeform_
changed
"
,
{
"freeform"
:
freeform
});
});
});
}
}
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