From eca2e46d23c5873f63979646849bc565374044ab Mon Sep 17 00:00:00 2001 From: sto Date: Sat, 15 Mar 2025 13:36:02 +0100 Subject: [PATCH] Add contest badges --- app/controllers/contests_controller.rb | 7 +++++++ app/views/contests/show.html.slim | 12 ++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/controllers/contests_controller.rb b/app/controllers/contests_controller.rb index 0798be3..72c28be 100644 --- a/app/controllers/contests_controller.rb +++ b/app/controllers/contests_controller.rb @@ -8,6 +8,7 @@ class ContestsController < ApplicationController def show @title = @contest.name + set_badges end def edit @@ -42,6 +43,12 @@ class ContestsController < ApplicationController private + def set_badges + @badges = [] + @badges.push("team") if @contest.team + @badges.push("registration") if @contest.allow_registration + end + def set_contest @contest = Contest.find(params[:id]) end diff --git a/app/views/contests/show.html.slim b/app/views/contests/show.html.slim index 7b403b1..d6cf88f 100644 --- a/app/views/contests/show.html.slim +++ b/app/views/contests/show.html.slim @@ -1,2 +1,10 @@ -a.btn.btn-primary href=edit_contest_path(@contest) - | Edit \ No newline at end of file +.row.mb-4 + .col + - @badges.each do |badge| + span.badge.text-bg-info.me-2 + = badge + +.row + .col + a.btn.btn-primary href=edit_contest_path(@contest) + | Edit \ No newline at end of file