Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[162] Build UI - Eval Form Step 2 - Evaluation Criteria Add/Remove Criteria #219

Merged
merged 31 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
64b9841
162 Initial eval criteria commit for eval form
cpreisinger Oct 18, 2024
16ed9dc
162 Initial temp styling for eval criteria
cpreisinger Oct 18, 2024
13c836e
Merge branch 'dev' of github.com:GSA/Challenge_platform into 162/eval…
cpreisinger Oct 18, 2024
9ade174
164 Add support for binary scale to eval criteria
cpreisinger Oct 22, 2024
765ae15
165 Add support for rating scale to eval criteria
cpreisinger Oct 22, 2024
a22b0e8
165 Fix bug with new criteria option labels
cpreisinger Oct 22, 2024
d77a3cc
165 Option label bug with form validation error
cpreisinger Oct 22, 2024
38d8f2c
165 Fix bug with rating options on new criteria
cpreisinger Oct 22, 2024
2af7b30
61 Accordion titles and collapse validity check
cpreisinger Oct 28, 2024
e55b445
Merge branch 'dev' of github.com:GSA/Challenge_platform into 162/eval…
cpreisinger Oct 28, 2024
ef80db5
Merge branch '165/evaluation-criteria-rating-scale' into 162/eval-for…
cpreisinger Oct 28, 2024
c23e016
61 Fix rspec failure with criteria option labels
cpreisinger Oct 28, 2024
eea695f
162 Initial eval criteria stimulus port
cpreisinger Oct 29, 2024
85725f6
Merge branch 'dev' of github.com:GSA/Challenge_platform into 162/eval…
cpreisinger Oct 29, 2024
db83008
update yarn.lock
stepchud Oct 29, 2024
3394377
61 Update dependency versions
cpreisinger Oct 29, 2024
1f1716f
Merge branch '162/eval-form-evaluation-criteria' of github.com:GSA/Ch…
cpreisinger Oct 29, 2024
027e1c4
set node-version for circleci
stepchud Oct 29, 2024
d3fb1be
61 Make eval criteria respect eval form disabled
cpreisinger Oct 29, 2024
7a7307f
61 Simplify eval criteria js for code climate1
cpreisinger Oct 29, 2024
9e04a71
61 Styling and add max length for eval criteria
cpreisinger Oct 30, 2024
a8afc05
61 Styled add another criteria button
cpreisinger Oct 30, 2024
2ac908c
61 Temp darker accordion styling for criteria
cpreisinger Oct 30, 2024
9d0f5b5
Merge branch 'dev' into 162/eval-form-evaluation-criteria
stepchud Oct 30, 2024
a631c66
Update .circleci/config.yml
stepchud Oct 30, 2024
a2e5321
revert structure.sql
stepchud Oct 30, 2024
ac91b8e
61 Remove unsued targets and code readability
cpreisinger Oct 31, 2024
6e2e07a
Merge branch '162/eval-form-evaluation-criteria' of github.com:GSA/Ch…
cpreisinger Oct 31, 2024
cfeb931
Merge branch 'dev' of github.com:GSA/Challenge_platform into 162/eval…
cpreisinger Oct 31, 2024
2d05253
61 Add the confirmation screen for eval form save
cpreisinger Oct 31, 2024
aba2de0
grammar
stepchud Oct 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions app/assets/stylesheets/application.sass.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,3 @@ dialog::backdrop {
#add-criteria-button.usa-button {
background-color: #4d8055;
}

// #criteria-list .usa-accordion__button {
// background-color: #162e51;
// background-image: url(asset-path('../builds/images/usa-icons-bg/add--white.svg', image)),linear-gradient(transparent,transparent);
// }

// #criteria-list .usa-accordion__button {
// background-color: #162e51;
// }

// #criteria-list .usa-accordion__button[aria-expanded=true] {
// background-image: url(assets/images/usa-icons-bg/remove-white.svg),linear-gradient(transparent,transparent);
// }
7 changes: 5 additions & 2 deletions app/controllers/evaluation_forms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def create
respond_to do |format|
if @evaluation_form.save
format.html do
redirect_to evaluation_forms_url, notice: I18n.t("evaluation_form_saved")
redirect_to evaluation_forms_confirmation_path, notice: I18n.t("evaluation_form_saved")
end
format.json { render :show, status: :created, location: @evaluation_form }
else
Expand All @@ -41,7 +41,7 @@ def update
respond_to do |format|
if @evaluation_form.update(evaluation_form_params)
format.html do
redirect_to evaluation_forms_url, notice: I18n.t("evaluation_form_saved")
redirect_to evaluation_forms_confirmation_path, notice: I18n.t("evaluation_form_saved")
end
format.json { render :show, status: :ok, location: @evaluation_form }
else
Expand All @@ -61,6 +61,9 @@ def destroy
end
end

# GET /evaluation_forms/confirmation
def confirmation; end

private

# Use callbacks to share common setup or constraints between actions.
Expand Down
22 changes: 3 additions & 19 deletions app/javascript/controllers/evaluation_criteria_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,7 @@
import { Controller } from "@hotwired/stimulus";

export default class extends Controller {
static targets = [
"criteriaList",
"template",
"addButton",
"criteriaRow",
"scoringRadio",
"binaryOptions",
"ratingOptions",
"scaleOptions",
"hiddenOptionRangeStart",
"hiddenOptionRangeEnd",
"selectOptionRangeStart",
"selectOptionRangeEnd",
"criteriaLabelRow",
];
static targets = ["criteriaList", "template", "criteriaRow"];

connect() {
this.counter = this.criteriaRowTargets.length;
Expand Down Expand Up @@ -118,8 +104,6 @@ export default class extends Controller {
scaleOptionLabels: row.querySelector(".criteria-scale-option-labels"),
};

console.log(options);

switch (scoringType) {
case "binary":
this.showBinaryOptions(options);
Expand Down Expand Up @@ -173,7 +157,7 @@ export default class extends Controller {
labelRow.style.display =
index >= start && index <= end ? "flex" : "none";
const input = labelRow.querySelector("input");
input.disabled = !(index >= start && index <= end);
input.disabled = index < start || index > end;
});
}

Expand Down Expand Up @@ -215,7 +199,7 @@ export default class extends Controller {

checkRequiredFields(section) {
return Array.from(section.querySelectorAll("[required]")).every((field) =>
field.checkValidity() ? true : field.reportValidity()
field.reportValidity()
);
}
}
19 changes: 6 additions & 13 deletions app/views/evaluation_forms/_evaluation_criterion_fields.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,16 @@
</div>
</div>

<div class="criteria-scale-options usa-form-group" style="<%= f.object.numeric? || !f.object.persisted? || is_template ? 'display: none;' : '' %>" data-evaluation-criteria-target="scaleOptions">
<div class="criteria-scale-options usa-form-group" style="<%= f.object.numeric? || !f.object.persisted? || is_template ? 'display: none;' : '' %>">
<%= f.label :rating_scale_options, "Rating Scale Options", for: criteria_field_id(f, "rating_scale_options", is_template), class: "text-bold" %>

<div class="criteria-binary-options" style="<%= f.object.binary? ? '' : 'display: none;'%>" data-evaluation-criteria-target="binaryOptions">
<div class="criteria-binary-options" style="<%= f.object.binary? ? '' : 'display: none;'%>">
<%= f.hidden_field :option_range_start,
id: criteria_field_id(f, "option_range_start", is_template),
name: criteria_field_name(f, "option_range_start", is_template),
class: "option-range-start",
disabled: !f.object.binary? || form_disabled,
value: 0,
data: {"evaluation-criteria-target": "hiddenOptionRangeStart"}
value: 0
%>
<%= f.hidden_field :option_range_end,
id: criteria_field_id(f, "option_range_end", is_template),
Expand All @@ -132,18 +131,15 @@
%>
</div>

<div class="criteria-rating-options" style="<%= f.object.rating? ? '' : 'display: none;' %>" data-evaluation-criteria-target="ratingOptions">
<div class="criteria-rating-options" style="<%= f.object.rating? ? '' : 'display: none;' %>">
<div class="display-flex flex-align-center margin-top-2">
<%= f.select :option_range_start, options_for_select((0..1).to_a, f.object.option_range_start), {},
id: criteria_field_id(f, "option_range_start", is_template),
name: criteria_field_name(f, "option_range_start", is_template),
class: "usa-select margin-0 height-auto width-auto font-sans-md text-bold option-range-select option-range-start",
disabled: !f.object.rating? || form_disabled,
include_blank: true,
data: {
"evaluation-criteria-target": "selectOptionRangeStart",
action: "change->evaluation-criteria#toggleOptionRange"
}
data: { action: "change->evaluation-criteria#toggleOptionRange" }
%>
<span class="margin-x-2 text-bold font-sans-md">to</span>
<%= f.select :option_range_end, options_for_select((2..10).to_a, f.object.option_range_end), {},
Expand All @@ -152,10 +148,7 @@
class: "usa-select margin-0 height-auto width-auto font-sans-md text-bold option-range-select option-range-end",
disabled: !f.object.rating? || form_disabled,
include_blank: true,
data: {
"evaluation-criteria-target": "selectOptionRangeEnd",
action: "change->evaluation-criteria#toggleOptionRange"
}
data: { action: "change->evaluation-criteria#toggleOptionRange" }
%>
</div>
</div>
Expand Down
15 changes: 15 additions & 0 deletions app/views/evaluation_forms/confirmation.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<div class="usa-card__container col-md-6 margin-y-4">
<div class="usa-card__body">
<h2>
Evaluation Form Saved
</h2>
<p>
Your evaluation form is saved.
You can edit it until the end date of your challenge.
During evaluation period the form will be available to your evaluators
stepchud marked this conversation as resolved.
Show resolved Hide resolved
and you will only be able to edit evaluation period end date if needed.
</p>
<%= link_to "Manage Evaluation Forms", evaluation_forms_path, class: "usa-button" %>
<div></div>
</div>
</div>
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
get '/dashboard', to: "dashboard#index"

resources :evaluations, only: [:index]
get '/evaluation_forms/confirmation', to: 'evaluation_forms#confirmation'
resources :evaluation_forms
post '/evaluation_forms/clone', to: 'evaluation_forms#create_from_existing'
resources :manage_submissions, only: [:index]
Expand Down
Loading