Commit ce7280bd by Valera Rozuvan

Added short style. Fixing minor bugs.

parent 2d32b847
...@@ -17,6 +17,7 @@ section.poll_question { ...@@ -17,6 +17,7 @@ section.poll_question {
margin-top: 0; margin-top: 0;
margin-bottom: 15px; margin-bottom: 15px;
color: #fe57a1; color: #fe57a1;
font-size: 1.9em;
&.problem-header { &.problem-header {
section.staff { section.staff {
...@@ -40,10 +41,21 @@ section.poll_question { ...@@ -40,10 +41,21 @@ section.poll_question {
.poll_answer { .poll_answer {
margin-bottom: 20px; margin-bottom: 20px;
&.short {
clear: both;
}
.question { .question {
height: auto; height: auto;
clear: both; clear: both;
min-height: 60px; min-height: 30px;
&.short {
clear: none;
width: 30%;
display: inline;
float: left;
}
.button { .button {
-webkit-appearance: none; -webkit-appearance: none;
...@@ -102,8 +114,8 @@ section.poll_question { ...@@ -102,8 +114,8 @@ section.poll_question {
vertical-align: top; vertical-align: top;
white-space: pre-line; white-space: pre-line;
width: 60px; width: 25px;
height: 60px; height: 25px;
word-spacing: 0px; word-spacing: 0px;
writing-mode: lr-tb; writing-mode: lr-tb;
...@@ -126,10 +138,14 @@ section.poll_question { ...@@ -126,10 +138,14 @@ section.poll_question {
float: left; float: left;
width: 80%; width: 80%;
text-align: left; text-align: left;
min-height: 60px; min-height: 30px;
margin-left: 20px; margin-left: 20px;
height: auto; height: auto;
margin-bottom: 20px; margin-bottom: 20px;
&.short {
width: 100px;
}
} }
} }
...@@ -138,18 +154,35 @@ section.poll_question { ...@@ -138,18 +154,35 @@ section.poll_question {
margin-top: 20px; margin-top: 20px;
clear: both; clear: both;
&.short {
margin-top: 0;
clear: none;
display: inline;
float: right;
width: 70%;
}
.bar { .bar {
width: 85%; width: 75%;
height: 28px; height: 28px;
border: 1px solid black; border: 1px solid black;
display: inline; display: inline;
float: left; float: left;
margin-right: 10px; margin-right: 10px;
&.short {
height: 20px;
margin-top: 3px;
}
.percent { .percent {
background-color: gray; background-color: gray;
width: 300px; width: 0px;
height: 28px; height: 28px;
&.short {
height: 20px;
}
} }
} }
...@@ -159,14 +192,15 @@ section.poll_question { ...@@ -159,14 +192,15 @@ section.poll_question {
float: right; float: right;
height: 28px; height: 28px;
text-align: right; text-align: right;
&.short {
width: 120px;
height: auto;
}
} }
} }
} }
.poll_answer {
}
.poll_answer.answered { .poll_answer.answered {
-webkit-box-shadow: rgb(97, 184, 225) 0px 1px 0px 0px inset; -webkit-box-shadow: rgb(97, 184, 225) 0px 1px 0px 0px inset;
background-color: rgb(29, 157, 217); background-color: rgb(29, 157, 217);
......
...@@ -13,13 +13,19 @@ class @Conditional ...@@ -13,13 +13,19 @@ class @Conditional
@passed = null @passed = null
@url = @el.data('url') @url = @el.data('url')
@render() @render(element)
render: () -> render: (element) ->
$.postWithPrefix "#{@url}/conditional_get", (response) => $.postWithPrefix "#{@url}/conditional_get", (response) =>
if (((response.passed is true) && (@passed is false)) || (@passed is null)) if (((response.passed is true) && (@passed is false)) || (@passed is null))
@el.data 'passed', response.passed @el.data 'passed', response.passed
@el.html '' @el.html ''
@el.append(i) for i in response.html @el.append(i) for i in response.html
if @el.html().length < 5
$(element).hide()
else
$(element).show()
XModule.loadModules @el XModule.loadModules @el
...@@ -114,6 +114,13 @@ PollMain.prototype = { ...@@ -114,6 +114,13 @@ PollMain.prototype = {
this.questionAnswered = false; this.questionAnswered = false;
this.answersObj = {}; this.answersObj = {};
this.shortVersion = true;
$.each(this.jsonConfig.answers, function (index, value) {
if (value.length >= 18) {
_this.shortVersion = false;
}
});
$.each(this.jsonConfig.answers, function (index, value) { $.each(this.jsonConfig.answers, function (index, value) {
var answer; var answer;
...@@ -146,6 +153,14 @@ PollMain.prototype = { ...@@ -146,6 +153,14 @@ PollMain.prototype = {
answer.textEl.html(value); answer.textEl.html(value);
if (_this.shortVersion === true) {
$.each(answer, function (index, value) {
if (value instanceof jQuery) {
value.addClass('short');
}
});
}
answer.el.appendTo(_this.questionEl); answer.el.appendTo(_this.questionEl);
answer.buttonEl.on('click', function () { answer.buttonEl.on('click', function () {
...@@ -156,20 +171,6 @@ PollMain.prototype = { ...@@ -156,20 +171,6 @@ PollMain.prototype = {
answer.buttonEl.addClass('answered'); answer.buttonEl.addClass('answered');
_this.questionAnswered = true; _this.questionAnswered = true;
} }
/*
answerEl = $('<li class="poll_answer">' + value + '</li>');
answerEl.on('click', function () {
_this.submitAnswer(index, answerEl);
});
if (index === _this.jsonConfig.poll_answer) {
answerEl.addClass('answered');
_this.questionAnswered = true;
}
answerEl.appendTo(_this.questionEl);
*/
}); });
this.graphAnswerEl = $('<div class="graph_answer"></div>'); this.graphAnswerEl = $('<div class="graph_answer"></div>');
......
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