Compare commits
No commits in common. "570e517c28a2c353cc48350ddf4a4185031883cc" and "ea7cdcf6082897008a277e51135254ec7df4c03c" have entirely different histories.
570e517c28
...
ea7cdcf608
@ -1,7 +1,3 @@
|
|||||||
// Sassy
|
// Sassy
|
||||||
|
|
||||||
@import "bootstrap";
|
@import "bootstrap";
|
||||||
|
|
||||||
.error-message {
|
|
||||||
color: var(--bs-danger)
|
|
||||||
}
|
|
@ -22,7 +22,7 @@ class CompletionsController < ApplicationController
|
|||||||
redirect_to contest_path(@contest)
|
redirect_to contest_path(@contest)
|
||||||
else
|
else
|
||||||
logger = Logger.new(STDOUT)
|
logger = Logger.new(STDOUT)
|
||||||
logger.info(@completion.errors)
|
logger.info(@completion.errors.full_messages)
|
||||||
@title = "New completion"
|
@title = "New completion"
|
||||||
render :new, status: :unprocessable_entity
|
render :new, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
@ -42,11 +42,7 @@ class CompletionsController < ApplicationController
|
|||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@completion.destroy
|
@completion.destroy
|
||||||
if params[:contestant_id]
|
redirect_to contest_path(@contest)
|
||||||
redirect_to contest_contestant_path(@contest, params[:contestant_id])
|
|
||||||
else
|
|
||||||
redirect_to contest_path(@contest)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -6,6 +6,4 @@ class Completion < ApplicationRecord
|
|||||||
attr_accessor :display_time_from_start, :display_relative_time
|
attr_accessor :display_time_from_start, :display_relative_time
|
||||||
|
|
||||||
validates :time_seconds, presence: true
|
validates :time_seconds, presence: true
|
||||||
validates_numericality_of :time_seconds
|
|
||||||
validates :puzzle_id, uniqueness: { score: :contestant }
|
|
||||||
end
|
end
|
||||||
|
@ -43,10 +43,8 @@
|
|||||||
td
|
td
|
||||||
| #{completion.puzzle.name} - #{completion.puzzle.brand}
|
| #{completion.puzzle.name} - #{completion.puzzle.brand}
|
||||||
td
|
td
|
||||||
a.btn.btn-sm.btn-secondary.me-2 href=edit_contest_completion_path(@contest, completion, contestant.id)
|
a.btn.btn-sm.btn-secondary href=edit_contest_completion_path(@contest, completion, contestant.id)
|
||||||
| Edit
|
| Edit
|
||||||
= link_to "Delete", contest_completion_path(contest, completion, contestant_id: contestant.id),
|
|
||||||
data: { turbo_method: :delete }, class: "btn btn-sm btn-secondary"
|
|
||||||
.row
|
.row
|
||||||
.col
|
.col
|
||||||
a.btn.btn-primary href=new_contest_completion_path(@contest, contestant_id: contestant.id)
|
a.btn.btn-primary href=new_contest_completion_path(@contest, contestant_id: contestant.id)
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
ActionView::Base.field_error_proc = proc do |html_tag, instance|
|
|
||||||
if html_tag.include? "<label"
|
|
||||||
appended_html = ""
|
|
||||||
if instance.error_message.is_a?(Array)
|
|
||||||
appended_html = "<div class='error-message form-text'>#{instance.error_message.map(&:humanize).uniq.join(", ")}</div>"
|
|
||||||
else
|
|
||||||
appended_html = "<div class='error-message form-text'>#{instance.error_message.humanize}</div>"
|
|
||||||
end
|
|
||||||
html_tag + appended_html.html_safe
|
|
||||||
else
|
|
||||||
html_tag
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
x
Reference in New Issue
Block a user