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