Commit 653154f1 by Valera Rozuvan

UI changes.

parent d9ad4b57
...@@ -214,13 +214,8 @@ section.poll_question { ...@@ -214,13 +214,8 @@ section.poll_question {
text-shadow: rgb(7, 103, 148) 0px 1px 0px; text-shadow: rgb(7, 103, 148) 0px 1px 0px;
} }
.graph_answer { .button.reset-button {
display: none;
clear: both; clear: both;
width: 400px; float: right;
height: 400px;
margin-top: 30px;
margin-left: auto;
margin-right: auto;
} }
} }
class @Conditional class @Conditional
constructor: (element, callerElId) -> constructor: (element, callerElId, reset) ->
@el = $(element).find('.conditional-wrapper') @el = $(element).find('.conditional-wrapper')
@callerElId = callerElId @callerElId = callerElId
if @el.data('passed') is true if reset is true
return @el.data('passed', null)
else if @el.data('passed') is false
@passed = false
else
@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 if callerElId isnt undefined and @passed isnt null
dependencies = @el.data('depends') dependencies = @el.data('depends')
......
...@@ -42,8 +42,6 @@ PollMain.prototype = { ...@@ -42,8 +42,6 @@ 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
...@@ -51,11 +49,11 @@ PollMain.prototype = { ...@@ -51,11 +49,11 @@ 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();
// Initialize Conditional constructors.
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_/, ''));
...@@ -73,28 +71,22 @@ PollMain.prototype = { ...@@ -73,28 +71,22 @@ PollMain.prototype = {
_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_poll', 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.answered').removeClass('answered'); _this.questionEl.find('.button.answered').removeClass('answered');
_this.questionEl.find('.stats').hide(); _this.questionEl.find('.stats').hide();
_this.resetButton.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) { 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_/, ''), true);
}); });
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment