Skip to content

Commit

Permalink
Amend with latest requests
Browse files Browse the repository at this point in the history
  • Loading branch information
MuriloDalRi committed Jun 12, 2023
1 parent 1602cc7 commit 59b387d
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 30 deletions.
1 change: 0 additions & 1 deletion app/controllers/content_change_requests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def content_change_request_params
:reason_for_change,
:subject_area,
:details_of_change,
:why_is_change_needed,
:url,
:related_urls,
requester_attributes: %i[email name collaborator_emails],
Expand Down
2 changes: 1 addition & 1 deletion app/models/support/requests/content_change_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Requests
class ContentChangeRequest < Request
include WithTimeConstraint

attr_accessor :title, :reason_for_change, :subject_area, :details_of_change, :why_is_change_needed, :url, :related_urls
attr_accessor :title, :reason_for_change, :subject_area, :details_of_change, :url, :related_urls

validates :details_of_change, presence: true

Expand Down
5 changes: 0 additions & 5 deletions app/models/zendesk/ticket/content_change_request_ticket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ def comment_snippets
field: :details_of_change,
label: "Details of what should be added, amended or removed",
),
Zendesk::LabelledSnippet.new(
on: @request,
field: :why_is_change_needed,
label: "Why is this change needed",
),
]
end
end
Expand Down
14 changes: 14 additions & 0 deletions app/models/zendesk/zendesk_ticket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ def needed_by_date
end
end

def not_before_time
if value?(:time_constraint) && value?(:not_before_time, @request.time_constraint)
@request.time_constraint.not_before_time
end
end

def needed_by_time
if value?(:time_constraint) && value?(:needed_by_time, @request.time_constraint)
@request.time_constraint.needed_by_time
end
end

def tags
%w[govt_form]
end
Expand All @@ -49,7 +61,9 @@ def base_comment_snippets
if value?(:time_constraint)
[
Zendesk::LabelledSnippet.new(on: self, field: :needed_by_date, label: "Needed by date"),
Zendesk::LabelledSnippet.new(on: self, field: :needed_by_time, label: "Needed by time"),
Zendesk::LabelledSnippet.new(on: self, field: :not_before_date, label: "Not before date"),
Zendesk::LabelledSnippet.new(on: self, field: :not_before_time, label: "Not before time"),
Zendesk::LabelledSnippet.new(on: @request.time_constraint, field: :time_constraint_reason, label: "Reason for time constraint"),
]
else
Expand Down
18 changes: 1 addition & 17 deletions app/views/content_change_requests/_request_details.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
<div class="help-block hint-block--md-6" id="details-of-change-hint">
<p>Make sure you:</p>
<ul>
<li>Include evidence of why this is a problem, for example, user feedback or call centre data</li>
<li>include evidence of why this is a problem, for example, user feedback or call centre data</li>
<li>give sufficient detail</li>
<li>use plain English</li>
<li>explain any acronyms, jargon or legal language</li>
Expand All @@ -136,23 +136,7 @@
</span>
</div>

<div class="form-group">
<span class="form-label">
<%= f.label :why_is_change_needed do %>
Why is this change needed? <abbr title="required">*</abbr>
<% end %>
</span>
<div class="help-block hint-block--md-6" id="why-is-change-needed-hint">
<p>Explain why users need new or different information, including any problems with existing content.</p>

<p>Provide evidence to support the changes, such as user feedback, user research, analytics, call centre feedback or policy change.</p>
</div>
<span class="form-wrapper">
<%= f.text_area :why_is_change_needed, required: true, class: "input-md-6 form-control", rows: 16, cols: 50, aria: {
describedby: "why-is-change-needed-hint"
} %>
</span>
</div>

<%= render partial: "support/attachment_instructions" %>
Expand Down
13 changes: 7 additions & 6 deletions spec/features/content_change_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@
"[Needed by date]
31-12-#{next_year}
[Needed by time]
13:00
[Not before date]
01-12-#{next_year}
[Not before time]
18:00
[Reason for time constraint]
New law
Expand All @@ -39,10 +45,7 @@
http://gov.uk/X
[Details of what should be added, amended or removed]
Out of date XX YY
[Why is this change needed]
Because of XX YY",
Out of date XX YY",
},
)

Expand All @@ -51,7 +54,6 @@
reason_for_change: "Factual inaccuracy",
subject_area: "Benefits",
details_of_change: "Out of date XX YY",
why_is_change_needed: "Because of XX YY",
url: "http://gov.uk/X",
related_urls: "http://gov.uk/welsh",
needed_by_date: "31-12-#{next_year}",
Expand Down Expand Up @@ -93,7 +95,6 @@ def user_makes_a_content_change_request(details)
select details[:subject_area], from: "What’s the subject area?" unless details[:subject_area].nil?
fill_in "Which URLs are affected?", with: details[:url]
fill_in "Tell us about the content that needs to be created, updated or is causing a problem for users?", with: details[:details_of_change]
fill_in "Why is this change needed?", with: details[:why_is_change_needed]

user_fills_out_time_constraints(details)

Expand Down

0 comments on commit 59b387d

Please sign in to comment.