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

0.251.0 #1199

Merged
merged 5 commits into from
Jul 26, 2023
Merged

0.251.0 #1199

Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions app/controllers/admin/services_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ def service_params
:estimated_annual_volume_of_customers,
:hisp,
:justification_text,
:contact_center,

:name,
:non_digital_explanation,
Expand Down
1 change: 1 addition & 0 deletions app/serializers/service_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ServiceSerializer < ActiveModel::Serializer
:service_provider_name,
:service_provider_slug,
:justification_text,
:contact_center,
:kind,
:transactional,
:notes,
Expand Down
6 changes: 5 additions & 1 deletion app/views/admin/service_providers/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@
<div class="grid-col-6">
<div class="field">
<%= form.label :portfolio_manager_email, "Portfolio Manager (Service Manager permissions)", class: "usa-label" %>
<%= select_tag :portfolio_manager_email, options_for_select(User.service_managers.order(:email).map { |user| [user.email, user.email] }), prompt: "Select a user", id: "add-user-id", style: "display: inline-block; margin-right: 1em;", class: "usa-select" %>
<%= form.select :portfolio_manager_email,
options_for_select(User.service_managers.order(:email).map { |user| [user.email, user.email] }, selected: service_provider.portfolio_manager_email ),
{ prompt: "Select a user" },
style: "display: inline-block; margin-right: 1em;",
class: "usa-select" %>
</div>

<div class="field">
Expand Down
9 changes: 9 additions & 0 deletions app/views/admin/services/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@
<%= form.text_area :description, class: "usa-textarea" %>
</div>

<br>
<fieldset class="usa-fieldset margin-bottom-3">
<legend class="usa-sr-only">Contact Center?</legend>
<div class="usa-checkbox">
<%= form.check_box :contact_center, class: "usa-checkbox__input" %>
<%= form.label :contact_center, "Contact Center?", class: "usa-checkbox__label" %>
</div>
</fieldset>

<fieldset class="usa-fieldset">
<%= form.label :multi_agency_service, "Does the public have to perform steps or tasks with multiple agencies for this service?", class: "usa-label" %>
<legend class="usa-legend sr-only">Does the public have to perform steps or tasks with multiple agencies for this service?</legend>
Expand Down
16 changes: 13 additions & 3 deletions app/views/admin/services/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<p>
<strong>Office</strong>
<br>
<%= @service.office %>
<%= @service.office.present? ? @service.office : "---" %>
</p>
<p>
<strong>Service Provider</strong>
Expand All @@ -66,16 +66,20 @@
<p>
<strong>Description</strong>
<br>
<%= @service.description? ? to_markdown(@service.description) : "empty" %>
<%= @service.description? ? to_markdown(@service.description) : "---" %>
</p>

<p>
<strong>Service type</strong>
<br>
<% if @service.kind %>
<% @service.kind.each do |i| %>
<%= i %>
<br>
<br>
<% end if @service.kind.present? %>
<% else %>
---
<% end %>
</p>

<div class="well">
Expand All @@ -85,6 +89,12 @@
<br>
<%= @service.hisp? ? "✅" : "❌" %>
</p>
<div class="contact-center">
<strong>Contact center?</strong>
<p>
<%= @service.contact_center? ? "✅" : "❌" %>
</p>
</div>
<div>
<strong>Transactional service?</strong>
<p>
Expand Down
47 changes: 47 additions & 0 deletions app/views/submissions/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,50 @@
</div>
<% end %>
</div>

<% if @form.kind == "a11_v2" %>
<script>
window.addEventListener('load', function() {

function hideQ2() {
const q2 = document.getElementById("answer_02");
const q2_container = q2.closest(".question");
q2_container.style.display = 'none';
}
function showQ2() {
const q2 = document.getElementById("answer_02");
const q2_container = q2.closest(".question");
q2_container.style.display = 'block';
}

function hideQ3() {
const q3 = document.getElementById("answer_03");
const q3_container = q3.closest(".question");
q3_container.style.display = 'none';
}
function showQ3() {
const q3 = document.getElementById("answer_03");
const q3_container = q3.closest(".question");
q3_container.style.display = 'block';
}

function handleThumbsUpDownClick(a, b, c) {
if(a.currentTarget.value === '1') {
showQ2()
hideQ3()
} else if(a.currentTarget.value === '0') {
hideQ2()
showQ3()
}
}

const radioButtons = document.getElementById("answer_01").getElementsByTagName("input");
for (const radioButton of radioButtons) {
radioButton.addEventListener("click", handleThumbsUpDownClick)
}

hideQ2()
hideQ3()
})
</script>
<% end %>
5 changes: 5 additions & 0 deletions db/migrate/20230726162206_add_contact_center_to_service.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddContactCenterToService < ActiveRecord::Migration[7.0]
def change
add_column "services", :contact_center, :boolean, default: false
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2023_06_08_231430) do
ActiveRecord::Schema[7.0].define(version: 2023_07_26_162206) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

Expand Down Expand Up @@ -626,6 +626,7 @@
t.integer "bureau_id"
t.string "office"
t.boolean "designated_for_improvement_a11_280", default: false
t.boolean "contact_center", default: false
t.index ["organization_id"], name: "index_services_on_organization_id"
end

Expand Down
34 changes: 30 additions & 4 deletions db/seeds/forms/a11_v2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,21 @@ def self.a11_v2
question_01 = Question.create!({
form: a11_v2_form,
form_section: (a11_v2_form.form_sections.first),
text: "Please rate your experience",
question_type: "star_radio_buttons",
text: "Based on my experience Example Agency's Service, I trust Example Agency to deliver on their mission for the American public.",
question_type: "radio_buttons",
position: 1,
answer_field: :answer_01,
is_required: true
})
[["👍", 1], ["👎", 0]].each_with_index do |value, i|
QuestionOption.create!({
question: question_01,
text: value[0],
value: value[1],
position: i + 1
})
end

question_02 = Question.create!({
form: a11_v2_form,
form_section: (a11_v2_form.form_sections.first),
Expand All @@ -47,10 +56,27 @@ def self.a11_v2
question_03 = Question.create!({
form: a11_v2_form,
form_section: (a11_v2_form.form_sections.first),
text: "Additional Comments",
question_type: "textarea",
text: "What went well?",
question_type: "checkbox",
position: 3,
answer_field: :answer_03,
is_required: true
})
["1 down", "2 down", "3 down", "4 down"].each_with_index do |value, i|
QuestionOption.create!({
question: question_03,
text: value.to_s,
value: value,
position: i + 1
})
end
question_03 = Question.create!({
form: a11_v2_form,
form_section: (a11_v2_form.form_sections.first),
text: "Additional Comments",
question_type: "textarea",
position: 4,
answer_field: :answer_04,
})

a11_v2_form
Expand Down
2 changes: 2 additions & 0 deletions spec/features/admin/services_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
select(organization.name, from: 'service[organization_id]')
fill_in :service_name, with: 'New Service Name'
fill_in :service_description, with: "Lots of text\n\n#### Heading\n\n* 1\n* 2\n* 3"
find("[for=service_contact_center]").click

find("label[for='service_hisp']").click
select(service_provider.name, from: 'service[service_provider_id]')
Expand All @@ -55,6 +56,7 @@
# renders markdown
expect(page).to have_css('h4', text: 'Heading')
expect(page).to have_css('ul li', text: '2')
expect(find(".contact-center")).to have_content('✅')
end
end
end
Expand Down