Skip to content

Commit f6f2646

Browse files
add final project submissions
1 parent 9af9e5c commit f6f2646

File tree

27 files changed

+389
-142
lines changed

27 files changed

+389
-142
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ group :test do
6363
gem "selenium-webdriver"
6464
end
6565

66-
gem "plutonium"
66+
gem "plutonium" # , path: "/Users/stefan/Documents/plutonium/plutonium-core"
6767

6868
gem "annotated", "~> 0.1.1", group: :development
6969

Gemfile.lock

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ GEM
100100
aws-eventstream (~> 1, >= 1.0.2)
101101
base64 (0.3.0)
102102
bcrypt (3.1.20)
103-
bcrypt_pbkdf (1.1.1)
104103
bcrypt_pbkdf (1.1.1-arm64-darwin)
105104
benchmark (0.5.0)
106105
bigdecimal (3.3.1)
@@ -150,7 +149,6 @@ GEM
150149
faraday-net_http (3.4.1)
151150
net-http (>= 0.5.0)
152151
ffi (1.17.2-arm64-darwin)
153-
ffi (1.17.2-x86_64-linux-gnu)
154152
fiber-local (1.1.0)
155153
fiber-storage
156154
fiber-storage (1.0.1)
@@ -218,13 +216,6 @@ GEM
218216
activesupport (>= 7.0)
219217
railties (>= 7.0)
220218
sqlite3
221-
litestream (0.14.0-x86_64-linux)
222-
actionpack (>= 7.0)
223-
actionview (>= 7.0)
224-
activejob (>= 7.0)
225-
activesupport (>= 7.0)
226-
railties (>= 7.0)
227-
sqlite3
228219
logger (1.7.0)
229220
loofah (2.24.1)
230221
crass (~> 1.0.2)
@@ -271,8 +262,6 @@ GEM
271262
nio4r (2.7.5)
272263
nokogiri (1.18.10-arm64-darwin)
273264
racc (~> 1.4)
274-
nokogiri (1.18.10-x86_64-linux-gnu)
275-
racc (~> 1.4)
276265
oauth2 (2.0.12)
277266
faraday (>= 0.17.3, < 4.0)
278267
jwt (>= 1.0, < 4.0)
@@ -305,7 +294,6 @@ GEM
305294
pastel (0.8.0)
306295
tty-color (~> 0.5)
307296
pg (1.6.2-arm64-darwin)
308-
pg (1.6.2-x86_64-linux)
309297
phlex (2.3.1)
310298
zeitwerk (~> 2.7)
311299
phlex-rails (2.3.1)
@@ -341,7 +329,7 @@ GEM
341329
phlexi-field (~> 0.2.0)
342330
zeitwerk
343331
phonelib (0.10.12)
344-
plutonium (0.27.0)
332+
plutonium (0.28.0)
345333
action_policy (~> 0.7.0)
346334
listen (~> 3.8)
347335
pagy (~> 9.0)
@@ -521,7 +509,6 @@ GEM
521509
railties (>= 7.1)
522510
thor (>= 1.3.1)
523511
sqlite3 (2.7.3-arm64-darwin)
524-
sqlite3 (2.7.3-x86_64-linux-gnu)
525512
sshkit (1.24.0)
526513
base64
527514
logger
@@ -548,7 +535,6 @@ GEM
548535
sin_lru_redux (~> 2.5)
549536
thor (1.4.0)
550537
thruster (0.1.15-arm64-darwin)
551-
thruster (0.1.15-x86_64-linux)
552538
tilt (2.6.1)
553539
timeout (0.4.4)
554540
tsort (0.2.0)
@@ -590,7 +576,6 @@ GEM
590576

591577
PLATFORMS
592578
arm64-darwin
593-
x86_64-linux
594579

595580
DEPENDENCIES
596581
annotated (~> 0.1.1)

app/views/rodauth/hacker/_login_form.html.erb

Lines changed: 0 additions & 81 deletions
This file was deleted.

app/views/rodauth/hacker/create_account.html.erb

Lines changed: 0 additions & 19 deletions
This file was deleted.

db/schema.rb

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class AdminDashboardPortal::Hackathon::FinalSubmissionsController < ::Hackathon::FinalSubmissionsController
2+
include AdminDashboardPortal::Concerns::Controller
3+
end
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
class AdminDashboardPortal::Hackathon::FinalSubmissionDefinition < ::Hackathon::FinalSubmissionDefinition
2+
class IndexPage < IndexPage
3+
private
4+
5+
def render_after_toolbar
6+
# Calculate vote tallies
7+
vote_counts = Hackathon::FinalSubmission
8+
.group(:peoples_choice_vote_id)
9+
.count
10+
.sort_by { |_team_id, count| -count }
11+
12+
winner_team_id, winner_votes = vote_counts.first
13+
winner_team = Hackathon::Team.find_by(id: winner_team_id) if winner_team_id
14+
15+
div class: "mb-4 p-6 bg-gradient-to-r from-yellow-50 to-amber-50 dark:from-yellow-900/20 dark:to-amber-900/20 rounded-xl shadow-md border-2 border-yellow-200 dark:border-yellow-800" do
16+
div class: "flex items-start gap-4" do
17+
div class: "flex-shrink-0" do
18+
div class: "w-14 h-14 bg-yellow-500 dark:bg-yellow-600 rounded-full flex items-center justify-center" do
19+
svg class: "w-8 h-8 text-white", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24" do |s|
20+
s.path stroke_linecap: "round", stroke_linejoin: "round", stroke_width: "2", d: "M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z"
21+
end
22+
end
23+
end
24+
div class: "flex-1" do
25+
h3 class: "text-xl font-bold text-yellow-900 dark:text-yellow-100 mb-2" do
26+
"🏆 People's Choice Winner"
27+
end
28+
if winner_team
29+
p class: "text-lg font-semibold text-yellow-800 dark:text-yellow-200 mb-1" do
30+
winner_team.name
31+
end
32+
p class: "text-sm text-yellow-700 dark:text-yellow-300" do
33+
"#{winner_votes} #{winner_votes == 1 ? 'vote' : 'votes'} received"
34+
end
35+
else
36+
p class: "text-yellow-800 dark:text-yellow-200" do
37+
"No votes cast yet"
38+
end
39+
end
40+
end
41+
end
42+
end
43+
end
44+
end
45+
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class AdminDashboardPortal::Hackathon::FinalSubmissionPolicy < ::Hackathon::FinalSubmissionPolicy
2+
def create?
3+
false
4+
end
5+
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class AdminDashboardPortal::Hackathon::ProjectSubmissionPolicy < ::Hackathon::ProjectSubmissionPolicy
2+
def create?
3+
false
4+
end
5+
end
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<%= render Plutonium::UI::Layout::Sidebar.new do %>
2-
<%=
3-
render Plutonium::UI::SidebarMenu.new(
2+
<%= render Plutonium::UI::SidebarMenu.new(
43
Phlexi::Menu::Builder.new do |m|
54
m.item "Dashboard",
65
url: root_path,
@@ -11,13 +10,14 @@
1110
[Hacker, Phlex::TablerIcons::User],
1211
[Hackathon::Invitation, Phlex::TablerIcons::MailForward],
1312
[Hackathon::CheckIn, Phlex::TablerIcons::CircleCheck],
14-
[Hackathon::Event, Phlex::TablerIcons::Calendar]
13+
[Hackathon::Event, Phlex::TablerIcons::Calendar],
14+
[Hackathon::ProjectSubmission, Phlex::TablerIcons::RocketOff],
15+
[Hackathon::FinalSubmission, Phlex::TablerIcons::Rocket]
1516
].each do |resource, icon|
1617
m.item resource.model_name.human.pluralize,
1718
url: resource_url_for(resource, parent: nil),
1819
icon: icon
1920
end
2021
end
21-
)
22-
%>
22+
) %>
2323
<% end %>

0 commit comments

Comments
 (0)