luulinh90s commited on
Commit
308cd79
·
1 Parent(s): 8b0f70d
Files changed (1) hide show
  1. templates/experiment.html +115 -66
templates/experiment.html CHANGED
@@ -4,52 +4,129 @@
4
  <title>Table QA Experiment</title>
5
  <style>
6
  /* Keep all existing styles */
7
-
8
- /* Add new styles for the dropdown */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  .ranking-item select {
10
- width: 80px;
11
  padding: 8px;
12
  border: 2px solid #ddd;
13
  border-radius: 4px;
14
  text-align: center;
15
  font-size: 1.1em;
16
- background-color: white;
17
- cursor: pointer;
18
- appearance: none; /* Remove default arrow */
19
- -webkit-appearance: none;
20
- -moz-appearance: none;
21
- background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
22
- background-repeat: no-repeat;
23
- background-position: right 8px center;
24
- background-size: 16px;
25
- padding-right: 30px;
26
  }
27
-
28
- .ranking-item select:focus {
29
- outline: none;
30
- border-color: #4CAF50;
31
- box-shadow: 0 0 0 2px rgba(74, 175, 80, 0.2);
 
 
 
 
 
 
32
  }
33
-
34
- .ranking-item select:hover {
35
- border-color: #4CAF50;
36
  }
37
-
38
- /* Style for the selected option */
39
- .ranking-item select option {
40
- padding: 8px;
41
- font-size: 1.1em;
 
42
  }
43
-
44
- /* Highlight used ranks */
45
- .used-rank {
46
- background-color: #e8f5e9 !important;
 
 
 
 
47
  }
48
  </style>
49
  </head>
50
  <body>
51
- <!-- Keep existing container, progress, and instructions -->
52
-
53
  <div class="container">
54
  <div class="progress">Sample {{ sample_id + 1 }} of 10</div>
55
 
@@ -83,12 +160,12 @@
83
  {% for method in methods %}
84
  <div class="ranking-item">
85
  <label for="{{ method }}">{{ method }}</label>
86
- <select id="{{ method }}" name="{{ method }}" required onchange="updateRankings(this)">
87
- <option value="" selected disabled>Select Rank</option>
88
- <option value="1">1 (Best)</option>
89
  <option value="2">2</option>
90
  <option value="3">3</option>
91
- <option value="4">4 (Worst)</option>
92
  </select>
93
  </div>
94
  {% endfor %}
@@ -100,37 +177,15 @@
100
  </div>
101
 
102
  <script>
103
- function updateRankings(changedSelect) {
104
- const allSelects = document.querySelectorAll('select');
105
- const usedRanks = new Set();
106
-
107
- // Collect all currently selected values
108
- allSelects.forEach(select => {
109
- if (select.value) {
110
- usedRanks.add(select.value);
111
- }
112
- });
113
-
114
- // Update all selects to disable used options
115
- allSelects.forEach(select => {
116
- Array.from(select.options).forEach(option => {
117
- if (option.value && option.value !== select.value) {
118
- option.disabled = usedRanks.has(option.value);
119
- }
120
- });
121
- });
122
- }
123
-
124
  function validateRankings() {
125
  const rankings = new Set();
126
  const form = document.getElementById('rankingForm');
127
  const errorMessage = document.getElementById('errorMessage');
128
- const selects = form.getElementsByTagName('select');
129
 
130
- for (const select of selects) {
131
  const value = select.value;
132
  if (!value) {
133
- errorMessage.textContent = 'Please assign a rank to all methods.';
134
  errorMessage.style.display = 'block';
135
  return false;
136
  }
@@ -145,12 +200,6 @@
145
 
146
  return true;
147
  }
148
-
149
- // Initialize dropdowns on page load
150
- document.addEventListener('DOMContentLoaded', function() {
151
- const selects = document.querySelectorAll('select');
152
- selects.forEach(select => updateRankings(select));
153
- });
154
  </script>
155
  </body>
156
  </html>
 
4
  <title>Table QA Experiment</title>
5
  <style>
6
  /* Keep all existing styles */
7
+ body {
8
+ font-family: 'Roboto', sans-serif;
9
+ margin: 0;
10
+ padding: 20px;
11
+ background-color: #f5f5f5;
12
+ }
13
+ .container {
14
+ max-width: 1200px;
15
+ margin: 0 auto;
16
+ background-color: white;
17
+ padding: 20px;
18
+ border-radius: 10px;
19
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
20
+ }
21
+ h1 {
22
+ text-align: center;
23
+ color: #333;
24
+ margin-bottom: 30px;
25
+ }
26
+ .progress {
27
+ text-align: center;
28
+ font-size: 1.2em;
29
+ color: #666;
30
+ margin-bottom: 20px;
31
+ }
32
+ .explanations-grid {
33
+ display: grid;
34
+ grid-template-columns: repeat(2, 1fr);
35
+ gap: 20px;
36
+ margin-bottom: 40px;
37
+ }
38
+ .explanation-card {
39
+ border: 1px solid #ddd;
40
+ border-radius: 8px;
41
+ overflow: hidden;
42
+ }
43
+ .explanation-header {
44
+ background-color: #f8f9fa;
45
+ padding: 15px;
46
+ border-bottom: 1px solid #ddd;
47
+ }
48
+ .explanation-header h2 {
49
+ margin: 0;
50
+ color: #333;
51
+ font-size: 1.2em;
52
+ }
53
+ .explanation-content {
54
+ padding: 0;
55
+ }
56
+ iframe {
57
+ width: 100%;
58
+ height: 500px;
59
+ border: none;
60
+ }
61
+ .ranking-section {
62
+ position: sticky;
63
+ bottom: 0;
64
+ background: white;
65
+ padding: 20px;
66
+ border-top: 3px solid #4CAF50;
67
+ box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
68
+ margin-top: 40px;
69
+ }
70
+ .ranking-grid {
71
+ display: grid;
72
+ grid-template-columns: repeat(4, 1fr);
73
+ gap: 15px;
74
+ margin: 20px 0;
75
+ }
76
+ .ranking-item {
77
+ background: #f8f9fa;
78
+ padding: 15px;
79
+ border-radius: 8px;
80
+ text-align: center;
81
+ }
82
+ .ranking-item label {
83
+ display: block;
84
+ margin-bottom: 10px;
85
+ font-weight: bold;
86
+ color: #333;
87
+ }
88
  .ranking-item select {
89
+ width: 60px;
90
  padding: 8px;
91
  border: 2px solid #ddd;
92
  border-radius: 4px;
93
  text-align: center;
94
  font-size: 1.1em;
 
 
 
 
 
 
 
 
 
 
95
  }
96
+ .submit-button {
97
+ background-color: #4CAF50;
98
+ color: white;
99
+ padding: 15px 30px;
100
+ border: none;
101
+ border-radius: 5px;
102
+ cursor: pointer;
103
+ font-size: 1.1em;
104
+ display: block;
105
+ margin: 20px auto;
106
+ transition: background-color 0.3s;
107
  }
108
+ .submit-button:hover {
109
+ background-color: #45a049;
 
110
  }
111
+ .instructions {
112
+ background-color: #e9f5e9;
113
+ border-left: 4px solid #4CAF50;
114
+ padding: 15px;
115
+ margin-bottom: 20px;
116
+ border-radius: 4px;
117
  }
118
+ .error-message {
119
+ color: #d32f2f;
120
+ text-align: center;
121
+ margin: 10px 0;
122
+ padding: 10px;
123
+ background-color: #fde8e8;
124
+ border-radius: 4px;
125
+ display: none;
126
  }
127
  </style>
128
  </head>
129
  <body>
 
 
130
  <div class="container">
131
  <div class="progress">Sample {{ sample_id + 1 }} of 10</div>
132
 
 
160
  {% for method in methods %}
161
  <div class="ranking-item">
162
  <label for="{{ method }}">{{ method }}</label>
163
+ <select id="{{ method }}" name="{{ method }}" required>
164
+ <option value="" selected disabled>Rank</option>
165
+ <option value="1">1</option>
166
  <option value="2">2</option>
167
  <option value="3">3</option>
168
+ <option value="4">4</option>
169
  </select>
170
  </div>
171
  {% endfor %}
 
177
  </div>
178
 
179
  <script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
  function validateRankings() {
181
  const rankings = new Set();
182
  const form = document.getElementById('rankingForm');
183
  const errorMessage = document.getElementById('errorMessage');
 
184
 
185
+ for (const select of form.getElementsByTagName('select')) {
186
  const value = select.value;
187
  if (!value) {
188
+ errorMessage.textContent = 'Please rank all methods.';
189
  errorMessage.style.display = 'block';
190
  return false;
191
  }
 
200
 
201
  return true;
202
  }
 
 
 
 
 
 
203
  </script>
204
  </body>
205
  </html>