-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into dependabot/bundler/dev/jwt-2.9.3
- Loading branch information
Showing
35 changed files
with
314 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
module EvaluationFormsHelper | ||
def status_colors | ||
{ | ||
draft: "FireBrick", | ||
ready: "DarkGoldenRod", | ||
published: "green" | ||
} | ||
def challenge_with_phase(evaluation_form) | ||
challenge_phase_title(evaluation_form.challenge, evaluation_form.phase) | ||
end | ||
|
||
def challenge_with_phase(evaluation_form) | ||
"#{evaluation_form.challenge.title} - Phase #{evaluation_form.challenge_phase}" | ||
def challenge_phase_title(challenge, phase) | ||
"#{challenge.title} - Phase #{phase_number(phase)}" | ||
end | ||
|
||
def inline_error(evaluation_form, field) | ||
error = evaluation_form.errors[field].present? ? evaluation_form.errors[field].first : "" | ||
tag.span(error, class: "text-secondary font-body-2xs", id: "evaluation_form_#{field}_error") | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
module PhasesHelper | ||
def phase_number(phase) | ||
phase.challenge.phase_ids.index(phase.id) + 1 | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import "./controllers" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Application } from "@hotwired/stimulus" | ||
|
||
const application = Application.start() | ||
|
||
// Configure Stimulus development experience | ||
application.debug = false | ||
window.Stimulus = application | ||
|
||
export { application } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Controller } from "@hotwired/stimulus" | ||
|
||
// Connects to data-controller="evaluation-form" | ||
export default class extends Controller { | ||
static targets = ["challengeID", "phaseID", "startDate", "datePicker"]; | ||
|
||
handleChallengeSelect(e) { | ||
let id, phase_id, end_date | ||
[id, phase_id, end_date] = e.target.value.split(".") | ||
if (id) { | ||
// set values of hidden form fields | ||
this.challengeIDTarget.value = id | ||
this.phaseIDTarget.value = phase_id | ||
|
||
// set the start date of the evaluation form | ||
// to be the challenge's end date | ||
this.startDateTarget.innerHTML = end_date || "mm/dd/yyyy" | ||
let day, month, year | ||
[month, day, year] = end_date.split("/") | ||
this.datePickerTarget.setAttribute("data-min-date", `${year}-${month}-${day}`) | ||
|
||
this.updateErrorMessage("evaluation_form_challenge_id", "") | ||
this.updateErrorMessage("evaluation_form_phase_id", "") | ||
} else { | ||
this.updateErrorMessage("evaluation_form_challenge_id", "can't be blank") | ||
this.startDateTarget.innerHTML = "mm/dd/yyyy" | ||
} | ||
} | ||
|
||
validatePresence(e) { | ||
if (!e.target.value) { | ||
e.target.classList.add("border-secondary") | ||
this.updateErrorMessage(e.target.id, "can't be blank") | ||
|
||
} else { | ||
e.target.classList.remove("border-secondary") | ||
this.updateErrorMessage(e.target.id, "") | ||
} | ||
} | ||
|
||
updateErrorMessage(field, message) { | ||
document.getElementById(field + "_error").innerHTML = message | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// This file is auto-generated by ./bin/rails stimulus:manifest:update | ||
// Run that command whenever you add a new controller or create them with | ||
// ./bin/rails generate stimulus controllerName | ||
|
||
import { application } from "./application" | ||
|
||
import EvaluationFormController from "./evaluation_form_controller" | ||
application.register("evaluation-form", EvaluationFormController) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
json.extract!(evaluation_form, :id, :title, :instructions, :challenge_phase, :status, :comments_required, | ||
json.extract!(evaluation_form, :id, :title, :instructions, :phase_id, :status, :comments_required, | ||
:weighted_scoring, :publication_date, :closing_date, :challenge_id, :created_at, :updated_at) | ||
json.url(evaluation_form_url(evaluation_form, format: :json)) |
Oops, something went wrong.