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
0f7db9e5
Commit
0f7db9e5
authored
Feb 25, 2013
by
Alexander Kryklia
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/alex/poll-merged' of github.com:MITx/mitx into feature/alex/poll-merged
parents
f5dc0afa
653154f1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
29 deletions
+37
-29
common/lib/xmodule/xmodule/css/poll/display.scss
+2
-7
common/lib/xmodule/xmodule/js/src/conditional/display.coffee
+10
-6
common/lib/xmodule/xmodule/js/src/poll/poll_main.js
+25
-16
No files found.
common/lib/xmodule/xmodule/css/poll/display.scss
View file @
0f7db9e5
...
...
@@ -214,13 +214,8 @@ section.poll_question {
text-shadow
:
rgb
(
7
,
103
,
148
)
0px
1px
0px
;
}
.graph_answer
{
display
:
none
;
.button.reset-button
{
clear
:
both
;
width
:
400px
;
height
:
400px
;
margin-top
:
30px
;
margin-left
:
auto
;
margin-right
:
auto
;
float
:
right
;
}
}
common/lib/xmodule/xmodule/js/src/conditional/display.coffee
View file @
0f7db9e5
class
@
Conditional
constructor
:
(
element
,
callerElId
)
->
constructor
:
(
element
,
callerElId
,
reset
)
->
@
el
=
$
(
element
).
find
(
'.conditional-wrapper'
)
@
callerElId
=
callerElId
if
@
el
.
data
(
'passed'
)
is
true
return
else
if
@
el
.
data
(
'passed'
)
is
false
@
passed
=
false
else
if
reset
is
true
@
el
.
data
(
'passed'
,
null
)
@
passed
=
null
else
if
@
el
.
data
(
'passed'
)
is
true
return
else
if
@
el
.
data
(
'passed'
)
is
false
@
passed
=
false
else
@
passed
=
null
if
callerElId
isnt
undefined
and
@
passed
isnt
null
dependencies
=
@
el
.
data
(
'depends'
)
...
...
common/lib/xmodule/xmodule/js/src/poll/poll_main.js
View file @
0f7db9e5
...
...
@@ -50,7 +50,10 @@ PollMain.prototype = {
_this
.
ajax_url
+
'/'
+
answer
,
{},
function
(
response
)
{
_this
.
showAnswerGraph
(
response
.
poll_answers
,
response
.
total
);
_this
.
resetButton
.
show
();
// Initialize Conditional constructors.
if
(
_this
.
wrapperSectionEl
!==
null
)
{
$
(
_this
.
wrapperSectionEl
).
find
(
'.xmodule_ConditionalModule'
).
each
(
function
(
index
,
value
)
{
new
window
.
Conditional
(
value
,
_this
.
id
.
replace
(
/^poll_/
,
''
));
...
...
@@ -65,20 +68,25 @@ PollMain.prototype = {
'submitReset'
:
function
()
{
var
_this
;
_this
=
this
;
// Send the data to the server as an AJAX request. Attach a callback that will
// be fired on server's response.
$
.
postWithPrefix
(
_this
.
ajax_url
+
'/'
+
'reset'
,
{},
this
.
ajax_url
+
'/'
+
'reset_poll'
,
{},
function
(
response
)
{
_this
.
questionAnswered
=
false
;
$
(
_this
.
questionEl
).
find
(
'.button'
).
removeClass
(
'answered'
);
_this
.
graphAnswerEl
.
hide
();
$
(
_this
.
questionEl
).
find
(
'.stats'
).
hide
();
_this
.
questionEl
.
find
(
'.button.answered'
).
removeClass
(
'answered'
);
_this
.
questionEl
.
find
(
'.stats'
).
hide
();
_this
.
resetButton
.
hide
();
// Initialize Conditional constructors. We will specify the third parameter as 'true'
// notifying the constructor that this is a reset operation.
if
(
_this
.
wrapperSectionEl
!==
null
)
{
$
(
_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_/
,
''
)
,
true
);
});
}
}
...
...
@@ -179,19 +187,20 @@ PollMain.prototype = {
}
});
this
.
graphAnswerEl
=
$
(
'<div class="graph_answer"></div>'
);
this
.
graphAnswerEl
.
hide
();
this
.
graphAnswerEl
.
appendTo
(
this
.
questionEl
);
if
(
this
.
jsonConfig
.
reset
===
"True"
){
this
.
resetButton
=
$
(
'<div class="button reset-button">Reset</div>'
);
if
(
_this
.
jsonConfig
.
reset
===
"True"
)
{
_this
.
resetButton
=
$
(
'<div class="button reset-button">Reset</div>'
);
_this
.
resetButton
.
appendTo
(
_this
.
questionEl
);
_this
.
resetButton
.
hide
();
_this
.
resetButton
.
on
(
'click'
,
function
()
{
_this
.
submitReset
();
});
if
(
this
.
questionAnswered
===
false
)
{
this
.
resetButton
.
hide
();
}
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
(
this
.
questionAnswered
===
true
)
{
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