Permalink
Browse files

Addded europe question

  • Loading branch information...
1 parent 01b1a06 commit fb80896a04d9303e90256aa9c209f4cd4b6c010b @ddayan committed Dec 8, 2011
@@ -1,62 +1,58 @@
-<div id="gumball-machine" class="question-graphic">
- <div id="ball-1" class="ball"></div>
- <div id="ball-2" class="ball"></div>
- <div id="ball-3" class="ball"></div>
- <div id="ball-4" class="ball"></div>
- <div id="ball-5" class="ball"></div>
- <div id="ball-6" class="ball"></div>
- <div id="ball-7" class="ball"></div>
- <div id="ball-8" class="ball"></div>
- <div id="ball-9" class="ball"></div>
- <div id="ball-10" class="ball"></div>
- <div id="ball-11" class="ball"></div>
- <div id="ball-12" class="ball"></div>
-</div>
-
-
+<div id="multi-choice" class="question-graphic">
+ <%= image_tag("Assets/Game_page/Game_Illustrations/lev1.png", :style => "padding-top: 50px;") %>
+ <table id="yes-no-question" class="game-font">
+ <tr>
+ <td> <span id="yes"> <h1> Yes </h1> <span> </td>
+ <td> <span id="no"> <h1> Na! </h1> <span> </td>
+ </tr>
+ </table>
+</div>
<script type="text/javascript">
-$(document).ready(function() {
- var ballCount=0;
- var colors = new Array();
- var checked = new Array();
-
- var flag=false;
- colors[0]="#FF1D25";
- colors[1]="#3FA8F4";
- colors[2]="#00A14F";
- colors[3]="#FEC01E";
-
- $('.ball').click(function() {
- var id = this.id;
- var ballNum = id.split('-')[1];
- if (checked[ballNum] != true) {
- checked[ballNum] = true;
- $(this).css("background-color", colors[ballNum % colors.length]);
- ballCount++;
- } else {
- checked[ballNum] = false;
- $(this).css("background-color", "");
- ballCount--;
- }
+var answer = 0;
+
+function switchImg(img){
+ if (img.src.match(/_on/)) {
+ answer = 0;
+ switchAllOff();
+ }else {
+ switchAllOff();
+ img.src = img.src.replace(/_off/, "_on");
+ answer = img.id.split('-')[1];
+ }
+}
+
+function switchAllOff() {
+ $("#multi-choice img").each(function() {
+ this.src = this.src.replace(/_on/, "_off");
});
+}
+$(document).ready(function(){
+ $("#multi-choice img").click(function(){
+ switchImg(this);
+ });
+
+ var flag=false;
+
$('#next-button').click(function() {
if (flag==false) {
flag=true;
$("#game-graphic").hide();
$("#answer").show();
- if (ballCount == <%= @question.answer%>) {
- $("#aaaa").append("That is the right answer!!!");
- $("#answer").append('<img id="theImg" src="/images/Assets/Success_Page/' + <%= session[:level] + 1 %> + '.png" />')
+ if (answer == <%= @question.answer%>) {
+ $("#aaaa").append("That is the right answer, you got the stamp!!!");
+ $("#answer img").attr("src","/images/Assets/Success_Page/" + <%= session[:level] + 1 %> + ".png");
} else {
- $("#aaaa").append("Wrong answer, please try again later.");
+ $("#aaaa").append("Wrong answer, you got a stinky fish.");
+ $("#answer img").attr("src","/images/Assets/Success_Page/Fish.png");
}
}else {
- window.location = window.location.pathname + "/answer?answer="+ballCount;
+ window.location = window.location.pathname + "/answer?answer="+answer;
}
});
+
});
</script>
@@ -42,10 +42,11 @@ $(document).ready(function(){
$("#game-graphic").hide();
$("#answer").show();
if (answer == <%= @question.answer%>) {
- $("#aaaa").append("That is the right answer!!!");
- $("#answer").append('<img id="theImg" src="/images/Assets/Success_Page/' + <%= session[:level] + 1 %> + '.png" />')
+ $("#aaaa").append("That is the right answer, you got the stamp!!!");
+ $("#answer img").attr("src","/images/Assets/Success_Page/" + <%= session[:level] + 1 %> + ".png");
} else {
- $("#aaaa").append("Wrong answer, please try again later.");
+ $("#aaaa").append("Wrong answer, you got a stinky fish.");
+ $("#answer img").attr("src","/images/Assets/Success_Page/Fish.png");
}
}else {
window.location = window.location.pathname + "/answer?answer="+answer;
@@ -42,10 +42,11 @@ $(document).ready(function(){
$("#game-graphic").hide();
$("#answer").show();
if (answer == <%= @question.answer%>) {
- $("#aaaa").append("That is the right answer!!!");
- $("#answer").append('<img id="theImg" src="/images/Assets/Success_Page/' + <%= @level.id %> + '.png" />')
+ $("#aaaa").append("That is the right answer, you got the stamp!!!");
+ $("#answer img").attr("src","/images/Assets/Success_Page/" + <%= session[:level] + 1 %> + ".png");
} else {
- $("#aaaa").append("Wrong answer, please try again later.");
+ $("#aaaa").append("Wrong answer, you got a stinky fish.");
+ $("#answer img").attr("src","/images/Assets/Success_Page/Fish.png");
}
}else {
window.location = window.location.pathname + "/answer?answer="+answer;
@@ -42,10 +42,11 @@ $(document).ready(function(){
$("#game-graphic").hide();
$("#answer").show();
if (answer == <%= @question.answer%>) {
- $("#aaaa").append("That is the right answer!!!");
- $("#answer").append('<img id="theImg" src="/images/Assets/Success_Page/' + <%= @level.id %> + '.png" />')
+ $("#aaaa").append("That is the right answer, you got the stamp!!!");
+ $("#answer img").attr("src","/images/Assets/Success_Page/" + <%= session[:level] + 1 %> + ".png");
} else {
- $("#aaaa").append("Wrong answer, please try again later.");
+ $("#aaaa").append("Wrong answer, you got a stinky fish.");
+ $("#answer img").attr("src","/images/Assets/Success_Page/Fish.png");
}
}else {
window.location = window.location.pathname + "/answer?answer="+answer;
@@ -0,0 +1,63 @@
+<div id="gumball-machine" class="question-graphic">
+ <div id="ball-1" class="ball"></div>
+ <div id="ball-2" class="ball"></div>
+ <div id="ball-3" class="ball"></div>
+ <div id="ball-4" class="ball"></div>
+ <div id="ball-5" class="ball"></div>
+ <div id="ball-6" class="ball"></div>
+ <div id="ball-7" class="ball"></div>
+ <div id="ball-8" class="ball"></div>
+ <div id="ball-9" class="ball"></div>
+ <div id="ball-10" class="ball"></div>
+ <div id="ball-11" class="ball"></div>
+ <div id="ball-12" class="ball"></div>
+</div>
+
+
+
+<script type="text/javascript">
+$(document).ready(function() {
+ var ballCount=0;
+ var colors = new Array();
+ var checked = new Array();
+
+ var flag=false;
+
+ colors[0]="#FF1D25";
+ colors[1]="#3FA8F4";
+ colors[2]="#00A14F";
+ colors[3]="#FEC01E";
+
+ $('.ball').click(function() {
+ var id = this.id;
+ var ballNum = id.split('-')[1];
+ if (checked[ballNum] != true) {
+ checked[ballNum] = true;
+ $(this).css("background-color", colors[ballNum % colors.length]);
+ ballCount++;
+ } else {
+ checked[ballNum] = false;
+ $(this).css("background-color", "");
+ ballCount--;
+ }
+ });
+
+ $('#next-button').click(function() {
+ if (flag==false) {
+ flag=true;
+ $("#game-graphic").hide();
+ $("#answer").show();
+ if (ballCount == <%= @question.answer%>) {
+ $("#aaaa").append("That is the right answer, you got the stamp!!!");
+ $("#answer img").attr("src","/images/Assets/Success_Page/" + <%= session[:level] + 1 %> + ".png");
+ } else {
+ $("#aaaa").append("Wrong answer, you got a stinky fish.");
+ $("#answer img").attr("src","/images/Assets/Success_Page/Fish.png");
+ }
+ }else {
+ window.location = window.location.pathname + "/answer?answer="+ballCount;
+ }
+
+ });
+});
+</script>
@@ -1,11 +1,10 @@
-<div id="answer" class="game-font center" style="display:none;">
- <span style="padding:50%">
- <h1 id="aaaa"> </h1>
- </span>
+<div id="answer" class="game-font center" style="display:none; width: 50%; padding: 20px;">
+ <h1 id="aaaa" style="width:200px"> </h1>
+ <%= image_tag("", :id => "level-prize") %>
</div>
<div id="game-graphic" class="center">
- <div id="q-headline" class="game-font" style="float: left; width: 50%; padding: 20px;">
+ <div id="q-headline" class="game-font" style="float: left; width: 25%; padding: 50px 20px 20px 100px;">
<h1> <%= @question.description %> </h1>
</div>
<%= render "level_#{@level.id}" %>
@@ -19,4 +18,5 @@
<span>£1 = <%= "#{@level.currency}" %></span>
<b></b>
</div>
-</div>
+</div>
+
View
@@ -22,7 +22,7 @@
end
end
- resources :questions, :only => [:index, :new]
+ resources :questions, :only => [:index, :new, :create]
# Sample resource route with options:
# resources :products do
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -162,6 +162,15 @@ height: 100px;
margin-top:5%;
}
+#level-prize {
+ float: left;
+ margin-left: 30%;
+}
+
+#yes-no-question td {
+ padding-left: 50px;
+}
+
#play-button {
/* width:145px;*/
/* height:165px;*/

0 comments on commit fb80896

Please sign in to comment.