Fix completion form bugs
This commit is contained in:
@@ -19,6 +19,7 @@ class CompletionsController < ApplicationController
|
|||||||
if params[:contestant_id]
|
if params[:contestant_id]
|
||||||
@completion.contestant_id = params[:contestant_id]
|
@completion.contestant_id = params[:contestant_id]
|
||||||
end
|
end
|
||||||
|
@completion.contest = @contest
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ class MessagesController < ApplicationController
|
|||||||
@completion = Completion.new()
|
@completion = Completion.new()
|
||||||
@completion.display_time_from_start = @message.display_time
|
@completion.display_time_from_start = @message.display_time
|
||||||
@completion.completed = true
|
@completion.completed = true
|
||||||
|
@completion.contest = @contest
|
||||||
|
|
||||||
render "completions/new"
|
render "completions/new"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -118,7 +118,7 @@
|
|||||||
.form-floating
|
.form-floating
|
||||||
= form.text_field :display_time_from_start, autocomplete: "off", class: "form-control", id: "time"
|
= form.text_field :display_time_from_start, autocomplete: "off", class: "form-control", id: "time"
|
||||||
= form.label :display_time_from_start, class: "required"
|
= form.label :display_time_from_start, class: "required"
|
||||||
- unless method == :patch || @contest.start_time == nil
|
- unless method == :patch || @contest.start_time == nil || @message
|
||||||
.col.mt-2
|
.col.mt-2
|
||||||
a.btn.btn-primary id="refresh" style="display: #{@completion.completed ? "" : "none"}"
|
a.btn.btn-primary id="refresh" style="display: #{@completion.completed ? "" : "none"}"
|
||||||
= t("helpers.buttons.refresh")
|
= t("helpers.buttons.refresh")
|
||||||
@@ -126,7 +126,7 @@
|
|||||||
= t("activerecord.attributes.completion.display_time_from_start_description")
|
= t("activerecord.attributes.completion.display_time_from_start_description")
|
||||||
|
|
||||||
/ Refresh logic.
|
/ Refresh logic.
|
||||||
- if @contest.start_time.present? && method != :patch
|
- if @contest.start_time.present? && method != :patch && !@message
|
||||||
javascript:
|
javascript:
|
||||||
startTime = #{@contest.start_time.present? ? @contest.start_time.to_i : "null"};
|
startTime = #{@contest.start_time.present? ? @contest.start_time.to_i : "null"};
|
||||||
pauseTime = #{@contest.pause_time.present? ? @contest.pause_time.to_i : "null"};
|
pauseTime = #{@contest.pause_time.present? ? @contest.pause_time.to_i : "null"};
|
||||||
|
|||||||
Reference in New Issue
Block a user