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

update CX Collections #1310

Merged
merged 3 commits into from
Dec 15, 2023
Merged
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
5 changes: 5 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ def format_time(time, timezone)
I18n.l time.to_time.in_time_zone(timezone), format: :long
end

def timezone_abbreviation(timezone)
zone = ActiveSupport::TimeZone.new(timezone)
zone.now.strftime('%Z')
end

def form_integrity_checksum(form:)
data_to_encode = render(partial: 'components/widget/fba', formats: :js, locals: { form: })
Digest::SHA256.base64digest(data_to_encode)
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/cx_collection_details/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

<div class="field">
<%= form.label :service_stage_id, "Stage of Service Journey", class: "usa-label" %>
<% if cx_collection_detail.service %>
<% if cx_collection_detail.cx_collection.service %>
<%= form.select :service_stage_id, options_for_select(cx_collection_detail.cx_collection.service.service_stages.map { |stage| [stage.name, stage.id]}),
{ include_blank: true },
{ class: "usa-select" } %>
Expand Down
10 changes: 8 additions & 2 deletions app/views/admin/cx_collections/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@
<table class="usa-table usa-table--striped width-full">
<thead>
<tr>
<th>Service</th>
<th>Survey title</th>
<th>Stage</th>
<th>Transaction point</th>
<th>Channel</th>
</tr>
Expand All @@ -117,7 +118,12 @@
<% @cx_collection.cx_collection_details.order(:channel).each do |cx_collection| %>
<tr>
<td>
<%= cx_collection.try(:service).try(:name) %>
<%= cx_collection.survey_title %>
</td>
<td>
<% if cx_collection.service_stage %>
<%= cx_collection.service_stage.name %>
<% end %>
</td>
<td>
<%= link_to cx_collection.transaction_point, admin_cx_collection_detail_path(cx_collection) %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/admin/forms/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@
<%= form.questions_count %>
</td>
<td>
<%= form.survey_form_activations %>
<%= number_with_delimiter(form.survey_form_activations) %>
</td>
<td>
<%= form.response_count %>
<%= number_with_delimiter(form.response_count) %>
</td>
<td>
<%= form.completion_rate %>
Expand Down
11 changes: 7 additions & 4 deletions app/views/admin/forms/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,25 @@
<% if is_at_least_form_manager?(user: current_user, form: @form) %>
<div class="grid-row grid-gap-lg">
<div class="desktop:grid-col-8">
<p>
<div class="margin-bottom-3">
<strong class="font-sans-3xl">
<%= pluralize @form.response_count, "response" %>
<%= pluralize number_with_delimiter(@form.response_count), "response" %>
</strong>
<br>
<% if @form.last_response_created_at.present? %>
<small>
Latest response:
<span class="text-base">
Latest response
</span>
<br>
<%= time_ago_in_words(@form.last_response_created_at) %> ago
at <span class="form-created-at">
<%= format_time(@form.last_response_created_at, current_user.time_zone) %>
<%= timezone_abbreviation(current_user.time_zone) %>
</span>
</small>
<% end %>
<p>
</div>

<div class="well">
<div class="grid-row grid-gap-md">
Expand Down