summaryrefslogtreecommitdiffstats
path: root/src/demos/twitter_bootstrap.html
blob: eca1583eb6d68b1ca1cd74bb0e01365b4773cf67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8" />

		<title>jQuery Impromptu with Twitter Bootstrap</title>

		<meta name="Description" content="jQuery Impromptu theme with twitter bootstrap." />
		<meta name="Keywords" content="jquery, impromptu, prompt, twitter, bootstrap" />
		
		<link rel="stylesheet" media="all" type="text/css" href="../themes/base.css" />		
		<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet">
		
		<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
		<script type="text/javascript" src="../jquery-impromptu.js"></script>

		<script type="text/javascript">
			function openprompt(){
			
				var temp = {
					state0: {
						title: 'Content Rating',
						html:'<label class="radio" for="rate_content_poor"><input type="radio" name="rate_content" id="rate_content_poor" value="Poor" class="radioinput" />Poor</label>'+
								'<label class="radio" for="rate_content_ok"><input type="radio" name="rate_content" id="rate_content_ok" value="Ok" class="radioinput" />Ok</label>'+
								'<label class="radio" for="rate_content_good"><input type="radio" name="rate_content" id="rate_content_good" value="Good" class="radioinput" />Good</label>'+
								'<label class="radio" for="rate_content_excellent"><input type="radio" name="rate_content" id="rate_content_excellent" value="Excellent" class="radioinput" />Excellent!</label>',
						buttons: { Cancel: false, Next: true },
						focus: 1,
						submit:function(e,v,m,f){ 
							if(!v)
								$.prompt.close()
							else $.prompt.goToState('state1');//go forward
							return false; 
						}
					},
					state1: {
						title: 'Needs Improvement',
						html:'<p>Check all which need improvement:</p>'+
								'<label class="checkbox" for="rate_improve_colors"><input type="checkbox" name="rate_improve" id="rate_improve_colors" value="Color Scheme" class="radioinput" />Color Scheme</label>'+
								'<label class="checkbox" for="rate_improve_graphics"><input type="checkbox" name="rate_improve" id="rate_improve_graphics" value="Graphics" class="radioinput" />Graphics</label>'+
								'<label class="checkbox" for="rate_improve_readability"><input type="checkbox" name="rate_improve" id="rate_improve_readability" value="readability" class="radioinput" />Readability</label>'+
								'<label class="checkbox" for="rate_improve_content"><input type="checkbox" name="rate_improve" id="rate_improve_content" value="Content" class="radioinput" />Content</label>'+
								'<label class="checkbox" for="rate_improve_other"><input type="checkbox" name="rate_improve" id="rate_improve_other" value="Other" class="radioinput" />Other</label>'+
								'<input type="text" name="rate_improve_other_txt" id="rate_improve_other_txt" value="" placeholder="Other Description" />',
						buttons: { Back: -1, Cancel: 0, Next: 1 },
						focus: 2,
						submit:function(e,v,m,f){
							if(v==0)
								$.prompt.close()
							else if(v==1)
								$.prompt.goToState('state2');//go forward
							else if(v=-1)
								$.prompt.goToState('state0');//go back
							return false; 
						}
					},
					state2: {
						title: 'How did you find this site?',
						html:'<select name="rate_find" id="rate_find"><option value="Search">Search</option><option value="Online Publication">Online Publication</option><option value="friend">A Friend</option><option value="No Clue">No Clue</option></select>',
						buttons: { Back: -1, Cancel: 0, Next: 1 },
						focus: 2,
						submit: function(e, v, m, f){
							if (v == 0) 
								$.prompt.close()
							else 
								if (v == 1) 
									$.prompt.goToState('state3');//go forward
								else 
									if (v = -1) 
										$.prompt.goToState('state1');//go back
							return false;
						}
					},
					state3: {
						title: 'Additional Comments',
						html:'<p>Please leave any other comments you have about this site:</p><div class="field"><textarea id="rate_comments" name="rate_comments"></textarea></div>',
						buttons: { Back: -1, Cancel: 0, Finish: 1 },
						focus: 2,
						submit:function(e,v,m,f){ 
							if(v==0) 
								$.prompt.close()
							else if(v==1)								
								return true; //we're done
							else if(v=-1)
								$.prompt.goToState('state2');//go back
							return false; 
						}
					}
				}
				
				$.prompt(temp,{
					close: function(e,v,m,f){
						if(v !== undefined){
							var str = "You can now process with this given information:<br />";
							$.each(f,function(i,obj){
								str += i + " - <em>" + obj + "</em><br />";
							});	
							$('#results').html(str);
						}
					},
					classes: {
						box: '',
						fade: '',
						prompt: '',
						close: '',
						title: 'lead',
						message: '',
						buttons: '',
						button: 'btn',
						defaultButton: 'btn-primary'
					}
				});
			}
		</script>
	</head>

	<body>
		<a href="javascript:openprompt()">Test Impromptu States Survey</a>
		<div id="results"></div>
	</body>
</html>