Skip to content

Commit

Permalink
0.269.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanwoldatwork authored Oct 20, 2023
2 parents c2beb24 + 1cc3be8 commit 777eedd
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ GEM
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.3.0)
net-imap (0.4.1)
net-imap (0.4.2)
date
net-protocol
net-pop (0.1.2)
Expand Down
9 changes: 9 additions & 0 deletions app/assets/stylesheets/site.scss
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,15 @@ span.usa-hint.save-notice {
.question-options.big-thumbs .usa-radio__label::before {
display: none;
}

// Same max-width as texarea
.question-options.big-thumbs {
max-width: 30rem;
}
.question-options.big-thumbs .usa-radio__input--tile+.usa-radio__label {
color: #005ea2;
padding-left: 1rem;
}
// end A-11 V2 customizations
}

Expand Down
8 changes: 0 additions & 8 deletions app/views/admin/cx_collections/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,4 @@
<% end %>
</p>


<%= render @cx_collection %>

<div>
<%= link_to "Edit this cx collection", edit_admin_cx_collection_path(@cx_collection) %> |
<%= link_to "Back to cx collections", admin_cx_collections_path %>
<%= button_to "Destroy this cx collection", admin_cx_collection_path(@cx_collection), method: :delete %>
</div>
4 changes: 2 additions & 2 deletions app/views/admin/forms/responses.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<h3>
Customer Feedback Analysis
</h3>
<% if admin_permissions? %>
<% if admin_permissions? && @form.kind == "a11" %>
<div class="a11-analysis-widget"><span class="usa-label">Loading A11 Analysis...</span></div>
<% end %>
<% if @form.kind == "a11" %>
Expand All @@ -30,7 +30,7 @@
<script>
$(function() {
<% if @form.kind == "a11" %>

$.ajax({
url: "/admin/submissions/a11_analysis?form_id=<%= @form.short_uuid %>",
type: 'get'
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/questions/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<br>
<% end %>
<% else %>
<%= f.select :question_type, Question::QUESTION_TYPES - ["big_thumbs_up_down_buttons", "thumbs_up_down_buttons", "custom_text_display", "yes_no_buttons"], { selected: question.question_type, include_blank: true }, { class: "usa-select" } %>
<%= f.select :question_type, Question::QUESTION_TYPES - ["thumbs_up_down_buttons", "custom_text_display", "yes_no_buttons"], { selected: question.question_type, include_blank: true }, { class: "usa-select" } %>
<% end %>
</div>

Expand Down
12 changes: 7 additions & 5 deletions app/views/components/forms/_custom_layout.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<div class="grid-row">
<div class="grid-col-12">
<h2 class="justify-vertical word-break">
<% if form.display_header_logo && form.logo.present? %>
<%- if form.display_header_logo && form.logo.present? %>
<%= image_tag(form.logo.tag.url, alt: "Organization logo", class: "form-header-logo") %>
<% end %>
<% if form.display_header_square_logo && form.logo.present? %>
<%- if form.display_header_square_logo && form.logo.present? %>
<%= image_tag(form.logo.logo_square.url, alt: "Organization logo", class: "form-header-logo-square") %>
<% end %>
<%= form.title %>
Expand All @@ -15,9 +15,11 @@
<%= sanitize(form.instructions) %>
</p>
<% end %>
<p>
<%= t('form.required_field_html') %>
</p>
<%- if form.questions.any?(&:is_required?) %>
<p>
<%= t('form.required_field_html') %>
</p>
<% end %>
<%= render 'components/forms/flash', form: form %>
<%= render partial: "components/forms/custom", locals: { form: form, questions: form.questions } %>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,24 @@

<div class="question-options big-thumbs" id="<%= question.answer_field.to_sym %>">
<div class="grid-row grid-gap-lg">
<% question.question_options.each_with_index do |option, index| %>
<% question_options = [{ text: 'yes', value: 1 }, { text: 'no', value: 0 }] %>
<% question_options.each_with_index do |option, index| %>
<% option_id = "question_option_#{question.id}_#{option[:text]}" %>
<div class="grid-col-6">
<div class="radio-button usa-radio"
id="<%= dom_id(option) %>"
data-id="<%= option.id %>"
<% if question.help_text.present? %>
id="<%= question.id %>_<%= question.answer_field %>_<%= option[:text] %>"
data-id="<%= question.id %>_<%= question.answer_field %>_<%= option[:text] %>"
<%- if question.help_text.present? %>
aria-describedby="<%= "question-id-#{question.id}-help-text" %>"
<% end %>
>
<% @option_id = "#{question.answer_field}_#{(index + 1).to_s}" %>
<%= radio_button_tag(@option_id, option.value, nil, { id: @option_id, name: question.answer_field, class: "usa-radio__input usa-radio__input--tile", required: question.is_required }) %>
<%= label_tag(@option_id, nil, class: "usa-radio__label font-sans-3xl text-center") do %>
<% if option.text == "👍" || option.text.downcase == "yes" %>
<%= radio_button_tag(option_id, option[:value], nil, { id: option_id, name: question.answer_field, class: "usa-radio__input usa-radio__input--tile", required: question.is_required }) %>
<%= label_tag(option_id, nil, class: "usa-radio__label font-sans-3xl text-center") do %>
<%- if option[:value] == 1 %>
<svg class="usa-icon margin-top-2" aria-hidden="true" focusable="false" role="img">
<use xlink:href="<%= asset_path "sprite.svg#thumb_up_alt" %>"></use>
</svg>
<% elsif option.text == "👎" || option.text.downcase == "no" %>
<% elsif option[:value] == 0 %>
<svg class="usa-icon margin-top-2" aria-hidden="true" focusable="false" role="img">
<use xlink:href="<%= asset_path "sprite.svg#thumb_down_alt" %>"></use>
</svg>
Expand Down
10 changes: 10 additions & 0 deletions app/views/components/widget/_widget.css.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4079,3 +4079,13 @@
.fba-modal-dialog .question-options.big-thumbs .usa-radio__label::before {
display: none;
}

/* Same max-width as texarea */
.touchpoints-form-body .big-thumbs {
max-width: 30rem;
}

.question-options.big-thumbs .usa-radio__input--tile+.usa-radio__label {
color: #005ea2;
padding-left: 1rem;
}
27 changes: 27 additions & 0 deletions spec/views/components/forms/_custom_layout.html.erb_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe 'components/forms/_custom_layout.html.erb' do
let(:form) { create(:form) }

subject(:rendered) do
render partial: 'components/forms/custom_layout', locals: { form: }
end

context 'with required fields' do
let(:form) { create(:form, :a11) }

it 'displays required field label' do
expect(rendered).to have_content(strip_tags(t('form.required_field_html')))
end
end

context 'without required fields' do
let(:form) { create(:form, :star_ratings) }

it 'does not display required field label' do
expect(rendered).not_to have_content(strip_tags(t('form.required_field_html')))
end
end
end

0 comments on commit 777eedd

Please sign in to comment.