Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx-platform
Commits
268e5b4b
Commit
268e5b4b
authored
Feb 25, 2013
by
Valera Rozuvan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Front end stuff clean up.
parent
3dae4d29
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
15 deletions
+32
-15
common/lib/xmodule/xmodule/js/src/poll/poll_main.js
+32
-15
No files found.
common/lib/xmodule/xmodule/js/src/poll/poll_main.js
View file @
268e5b4b
...
@@ -42,6 +42,8 @@ PollMain.prototype = {
...
@@ -42,6 +42,8 @@ PollMain.prototype = {
_this
=
this
;
_this
=
this
;
console
.
log
(
'submiting answer'
);
answerObj
.
buttonEl
.
addClass
(
'answered'
);
answerObj
.
buttonEl
.
addClass
(
'answered'
);
// Send the data to the server as an AJAX request. Attach a callback that will
// Send the data to the server as an AJAX request. Attach a callback that will
...
@@ -49,6 +51,9 @@ PollMain.prototype = {
...
@@ -49,6 +51,9 @@ PollMain.prototype = {
$
.
postWithPrefix
(
$
.
postWithPrefix
(
_this
.
ajax_url
+
'/'
+
answer
,
{},
_this
.
ajax_url
+
'/'
+
answer
,
{},
function
(
response
)
{
function
(
response
)
{
console
.
log
(
'success! response = '
);
console
.
log
(
response
);
_this
.
showAnswerGraph
(
response
.
poll_answers
,
response
.
total
);
_this
.
showAnswerGraph
(
response
.
poll_answers
,
response
.
total
);
_this
.
resetButton
.
show
();
_this
.
resetButton
.
show
();
if
(
_this
.
wrapperSectionEl
!==
null
)
{
if
(
_this
.
wrapperSectionEl
!==
null
)
{
...
@@ -65,17 +70,28 @@ PollMain.prototype = {
...
@@ -65,17 +70,28 @@ PollMain.prototype = {
'submitReset'
:
function
()
{
'submitReset'
:
function
()
{
var
_this
;
var
_this
;
_this
=
this
;
_this
=
this
;
console
.
log
(
'submiting rset'
);
// Send the data to the server as an AJAX request. Attach a callback that will
// Send the data to the server as an AJAX request. Attach a callback that will
// be fired on server's response.
// be fired on server's response.
$
.
postWithPrefix
(
$
.
postWithPrefix
(
_this
.
ajax_url
+
'/'
+
'reset'
,
{},
this
.
ajax_url
+
'/'
+
'reset_poll'
,
{},
function
(
response
)
{
function
(
response
)
{
console
.
log
(
'success! response = '
);
console
.
log
(
response
);
_this
.
questionAnswered
=
false
;
_this
.
questionAnswered
=
false
;
$
(
_this
.
questionEl
).
find
(
'.button'
).
removeClass
(
'answered'
);
_this
.
graphAnswerEl
.
hide
();
_this
.
questionEl
.
find
(
'.button.answered'
).
removeClass
(
'answered'
);
$
(
_this
.
questionEl
).
find
(
'.stats'
).
hide
();
_this
.
questionEl
.
find
(
'.stats'
).
hide
();
_this
.
resetButton
.
hide
();
_this
.
resetButton
.
hide
();
if
(
_this
.
wrapperSectionEl
!==
null
)
{
if
(
_this
.
wrapperSectionEl
!==
null
)
{
$
(
_this
.
wrapperSectionEl
).
find
(
'.xmodule_ConditionalModule'
).
each
(
function
(
index
,
value
)
{
$
(
_this
.
wrapperSectionEl
).
find
(
'.xmodule_ConditionalModule'
).
each
(
function
(
index
,
value
)
{
new
window
.
Conditional
(
value
,
_this
.
id
.
replace
(
/^poll_/
,
''
));
new
window
.
Conditional
(
value
,
_this
.
id
.
replace
(
/^poll_/
,
''
));
...
@@ -179,19 +195,20 @@ PollMain.prototype = {
...
@@ -179,19 +195,20 @@ PollMain.prototype = {
}
}
});
});
this
.
graphAnswerEl
=
$
(
'<div class="graph_answer"></div>'
);
if
(
this
.
jsonConfig
.
reset
===
"True"
){
this
.
graphAnswerEl
.
hide
();
this
.
resetButton
=
$
(
'<div class="button reset-button">Reset</div>'
);
this
.
graphAnswerEl
.
appendTo
(
this
.
questionEl
);
if
(
_this
.
jsonConfig
.
reset
===
"True"
)
if
(
this
.
questionAnswered
===
false
)
{
{
this
.
resetButton
.
hide
();
_this
.
resetButton
=
$
(
'<div class="button reset-button">Reset</div>'
);
_this
.
resetButton
.
appendTo
(
_this
.
questionEl
);
_this
.
resetButton
.
hide
();
_this
.
resetButton
.
on
(
'click'
,
function
()
{
_this
.
submitReset
();
});
}
}
this
.
resetButton
.
appendTo
(
this
.
questionEl
);
this
.
resetButton
.
on
(
'click'
,
function
()
{
_this
.
submitReset
();
});
}
// If it turns out that the user already answered the question, show the answers graph.
// If it turns out that the user already answered the question, show the answers graph.
if
(
this
.
questionAnswered
===
true
)
{
if
(
this
.
questionAnswered
===
true
)
{
this
.
showAnswerGraph
(
this
.
jsonConfig
.
poll_answers
,
this
.
jsonConfig
.
total
);
this
.
showAnswerGraph
(
this
.
jsonConfig
.
poll_answers
,
this
.
jsonConfig
.
total
);
...
...
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