Add contestants
This commit is contained in:
17
app/views/contestants/_form.html.slim
Normal file
17
app/views/contestants/_form.html.slim
Normal file
@@ -0,0 +1,17 @@
|
||||
= form_with model: contestant, url: url, method: method do |form|
|
||||
.row.mb-3
|
||||
.col
|
||||
.form-floating
|
||||
= form.text_field :name, autocomplete: "off", class: "form-control"
|
||||
= form.label :name, class: "required"
|
||||
.row.mb-3
|
||||
.col
|
||||
.form-floating
|
||||
= form.text_field :email, autocomplete: "off", class: "form-control"
|
||||
= form.label :email
|
||||
.form-text Optional. Fill this only if you intend to send emails through this app.
|
||||
.row.mt-4
|
||||
.col
|
||||
- if method == :patch
|
||||
= link_to "Delete", contest_contestant_path(contest, contestant), data: { turbo_method: :delete }, class: "btn btn-danger me-2"
|
||||
= form.submit submit_text, class: "btn btn-primary"
|
1
app/views/contestants/edit.html.slim
Normal file
1
app/views/contestants/edit.html.slim
Normal file
@@ -0,0 +1 @@
|
||||
= render "form", contest: @contest, contestant: @contestant, submit_text: "Save", method: :patch, url: "/contests/#{@contest.id}/contestants/#{@contestant.id}"
|
1
app/views/contestants/new.html.slim
Normal file
1
app/views/contestants/new.html.slim
Normal file
@@ -0,0 +1 @@
|
||||
= render "form", contest: @contest, contestant: @contestant, submit_text: "Add", method: :post, url: "/contests/#{@contest.id}/contestants"
|
@@ -34,4 +34,21 @@
|
||||
a.btn.btn-primary href=new_contest_puzzle_path(@contest)
|
||||
| Add puzzle
|
||||
.col-sm-6
|
||||
h4 Teams
|
||||
.row
|
||||
.col
|
||||
h4
|
||||
| Contestants
|
||||
.row.row-cols-1.row-cols-md-3.g-4.mb-4
|
||||
- @contestants.each do |contestant|
|
||||
.col
|
||||
css:
|
||||
.card:hover { background-color: lightblue; }
|
||||
.card.h-100
|
||||
.card-header
|
||||
= contestant.name
|
||||
.card-body
|
||||
a.stretched-link href=edit_contest_contestant_path(@contest, contestant)
|
||||
.row
|
||||
.col
|
||||
a.btn.btn-primary href=new_contest_contestant_path(@contest)
|
||||
| Add contestant
|
||||
|
@@ -1,8 +0,0 @@
|
||||
h1 Puzzles
|
||||
|
||||
= link_to "New puzzle", new_puzzle_path
|
||||
|
||||
div
|
||||
- @puzzles.each do |puzzle|
|
||||
div
|
||||
= link_to puzzle.name, puzzle
|
@@ -1,7 +0,0 @@
|
||||
h1 = @puzzle.name
|
||||
|
||||
= link_to "Back", puzzles_path
|
||||
|
||||
= image_tag @puzzle.image if @puzzle.image.attached?
|
||||
|
||||
= button_to "Delete", @puzzle, method: :delete, data: { turbo_confirm: "Are you suuure??" }
|
Reference in New Issue
Block a user