Skip to content

Commit 7a9cf29

Browse files
author
tsoganov
committed
Updated test pages
1 parent a22fe84 commit 7a9cf29

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1861
-845
lines changed

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,5 @@ gem 'ransack'
8383
# gem 'surveyor', path: 'vendor/gems/surveyor'
8484

8585
gem 'positioning'
86+
87+
gem 'friendly_id', '~> 5.4.0'

Gemfile.lock

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ GEM
135135
thor (>= 0.14.0, < 2)
136136
font-awesome-sass (5.15.1)
137137
sassc (>= 1.11)
138+
friendly_id (5.4.2)
139+
activerecord (>= 4.0.0)
138140
fugit (1.11.1)
139141
et-orbi (~> 1, >= 1.2.11)
140142
raabro (~> 1.4)
@@ -385,6 +387,7 @@ DEPENDENCIES
385387
faraday
386388
figaro
387389
font-awesome-sass (~> 5.15.1)
390+
friendly_id (~> 5.4.0)
388391
importmap-rails
389392
jbuilder
390393
kamal

app/assets/stylesheets/application.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
// Views
5252
@use "views/admin_test_show";
5353
@use "views/admin_test_attempts";
54+
@use "views/test_question";
5455

5556
// Font-awesome
5657
@use "font-awesome" with (

app/assets/stylesheets/components/button.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343
&--default {
4444
background: variables.$white;
4545
color: variables.$black;
46+
&:hover {
47+
background: variables.$grey2;
48+
color: variables.$grey;
49+
}
4650
}
4751
&--primary {
4852
background: variables.$base-blue;

app/assets/stylesheets/form/form.scss

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,3 +244,32 @@
244244
}
245245
}
246246

247+
// Info box styling for forms
248+
.info-box {
249+
background-color: #f8f9fa;
250+
border: 1px solid #e9ecef;
251+
border-radius: 4px;
252+
padding: 15px;
253+
margin: 10px 0;
254+
255+
p {
256+
margin: 0 0 10px 0;
257+
font-weight: 500;
258+
color: variables.$black;
259+
}
260+
261+
ul {
262+
margin: 0;
263+
padding-left: 20px;
264+
265+
li {
266+
margin-bottom: 5px;
267+
color: #6c757d;
268+
269+
&:last-child {
270+
margin-bottom: 0;
271+
}
272+
}
273+
}
274+
}
275+
Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
.question-nav-circle {
2+
display: flex;
3+
align-items: center;
4+
justify-content: center;
5+
width: 40px;
6+
height: 40px;
7+
border-radius: 50%;
8+
text-decoration: none;
9+
font-weight: 600;
10+
font-size: 14px;
11+
transition: all 0.2s ease;
12+
border: 2px solid transparent;
13+
}
14+
15+
.question-nav-circle.unanswered {
16+
background: #f1f3f5;
17+
color: #6c757d;
18+
border-color: #e9ecef;
19+
}
20+
21+
.question-nav-circle.answered {
22+
background: #6c757d;
23+
color: #fff;
24+
border-color: #6c757d;
25+
}
26+
27+
.question-nav-circle.marked_for_later {
28+
background: repeating-linear-gradient(
29+
135deg,
30+
#a3aab1,
31+
#a3aab1 6px,
32+
#28a745 6px,
33+
#28a745 12px
34+
);
35+
color: #ffffff;
36+
border-color: #28a745;
37+
}
38+
39+
.question-nav-circle.correct {
40+
background: #28a745;
41+
color: white;
42+
}
43+
44+
.question-nav-circle.incorrect {
45+
background: #dc3545;
46+
color: white;
47+
}
48+
49+
.question-nav-circle.current {
50+
border-color: #000;
51+
}
52+
53+
/* Hover and disabled states */
54+
.question-nav-circle:not(.disabled):hover {
55+
transform: scale(1.05);
56+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
57+
}
58+
59+
.question-nav-circle.disabled {
60+
background: #f8f9fa;
61+
color: #adb5bd;
62+
border-color: #e9ecef;
63+
cursor: not-allowed;
64+
opacity: 0.7;
65+
}
66+
67+
.question-header {
68+
margin-bottom: 30px;
69+
}
70+
71+
.question-context {
72+
color: #666;
73+
font-size: 14px;
74+
margin-bottom: 10px;
75+
}
76+
77+
.question-text {
78+
font-size: 20px;
79+
font-weight: 600;
80+
color: #333;
81+
line-height: 1.4;
82+
margin: 0;
83+
}
84+
85+
/* Answer Options */
86+
.answer-options {
87+
margin-bottom: 30px;
88+
}
89+
90+
.answer-option {
91+
display: flex;
92+
align-items: center;
93+
padding: 15px;
94+
margin-bottom: 10px;
95+
border: 2px solid #e9ecef;
96+
border-radius: 8px;
97+
transition: all 0.2s ease;
98+
position: relative;
99+
}
100+
101+
.answer-option:hover {
102+
border-color: #007bff;
103+
}
104+
105+
.answer-option.selected {
106+
border-color: #007bff;
107+
background: #f8f9ff;
108+
}
109+
110+
.answer-option.correct {
111+
border-color: #28a745;
112+
background: #f8fff9;
113+
}
114+
115+
.answer-option.incorrect {
116+
border-color: #dc3545;
117+
background: #fff8f8;
118+
}
119+
120+
.answer-radio {
121+
margin-right: 15px;
122+
}
123+
124+
.answer-label {
125+
display: flex;
126+
align-items: center;
127+
width: 100%;
128+
cursor: pointer;
129+
font-size: 16px;
130+
}
131+
132+
.answer-letter {
133+
font-weight: 600;
134+
margin-right: 10px;
135+
color: #007bff;
136+
min-width: 20px;
137+
}
138+
139+
.answer-text {
140+
flex: 1;
141+
}
142+
143+
.correct-icon {
144+
color: #28a745;
145+
margin-left: 10px;
146+
font-size: 18px;
147+
}
148+
149+
.incorrect-icon {
150+
color: #dc3545;
151+
margin-left: 10px;
152+
font-size: 18px;
153+
}
154+
155+
/* Correct Answer Display */
156+
.correct-answer-display {
157+
display: flex;
158+
align-items: center;
159+
margin: 20px 0;
160+
padding: 15px;
161+
background: #f8f9fa;
162+
border-radius: 8px;
163+
}
164+
165+
.correct-answer-label {
166+
font-weight: 600;
167+
margin-right: 15px;
168+
color: #333;
169+
}
170+
171+
.correct-answer-circle {
172+
display: flex;
173+
align-items: center;
174+
justify-content: center;
175+
width: 30px;
176+
height: 30px;
177+
background: #6c757d;
178+
color: white;
179+
border-radius: 50%;
180+
font-weight: 600;
181+
}
182+
183+
/* Explanation */
184+
.explanation-section {
185+
margin: 20px 0;
186+
padding: 20px;
187+
background: #f8f9fa;
188+
border-radius: 8px;
189+
border-left: 4px solid #007bff;
190+
}
191+
192+
.explanation-section h4 {
193+
margin: 0 0 10px 0;
194+
color: #333;
195+
font-size: 16px;
196+
font-weight: 600;
197+
}
198+
199+
.explanation-section p {
200+
margin: 0;
201+
color: #666;
202+
line-height: 1.5;
203+
}
204+
205+
/* Action Buttons */
206+
.question-actions {
207+
display: flex;
208+
justify-content: space-between;
209+
align-items: center;
210+
margin-top: 30px;
211+
padding-top: 20px;
212+
border-top: 1px solid #e9ecef;
213+
}
214+
215+
.primary-actions {
216+
display: flex;
217+
gap: 10px;
218+
}
219+
220+
.navigation-actions {
221+
display: flex;
222+
gap: 10px;
223+
}
224+
225+
226+
/* Time Display */
227+
.time-display {
228+
text-align: center;
229+
margin: 20px 0;
230+
}
231+
232+
.time-remaining {
233+
display: inline-flex;
234+
align-items: center;
235+
gap: 10px;
236+
padding: 10px 20px;
237+
background: #f8f9fa;
238+
border-radius: 20px;
239+
font-weight: 600;
240+
color: #333;
241+
}
242+
243+
.time-remaining.warning {
244+
background: #fff3cd;
245+
color: #856404;
246+
}

app/controllers/admin/base_controller.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
class Admin::BaseController < ApplicationController
2-
before_action :authenticate_user!
32
before_action :ensure_admin!
43

54
private

app/controllers/admin/dashboard_controller.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
class Admin::DashboardController < Admin::BaseController
22
def index
3-
# Dashboard data is loaded in the view for simplicity
4-
# In a production app, you might want to load this data in the controller
3+
@recent_activity = TestAttempt.includes(:user, :test).order(created_at: :desc).limit(5)
4+
@expiring_accreditations = User.joins(:test_attempts).where(test_attempts: { passed: true })
5+
.where('test_attempts.created_at < ?', 11.months.ago)
6+
.distinct.limit(5)
57
end
68
end
7-

0 commit comments

Comments
 (0)