Skip to content

Commit

Permalink
Merge pull request #1207 from alphagov/add-fields
Browse files Browse the repository at this point in the history
Add fields to the 'Request a new campaign' form
  • Loading branch information
MuriloDalRi authored Oct 20, 2023
2 parents 1655ec7 + 61521fb commit 9fc8a33
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/controllers/campaign_requests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ def campaign_request_params
site_tagline
site_metadescription
cost_of_campaign
hmg_code
strategic_planning_code
ga_contact_email
],
).to_h
Expand Down
4 changes: 4 additions & 0 deletions app/models/support/gds/campaign.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class Campaign
:site_tagline,
:site_metadescription,
:cost_of_campaign,
:hmg_code,
:strategic_planning_code,
:ga_contact_email

validates :signed_campaign,
Expand All @@ -37,6 +39,8 @@ class Campaign
:site_tagline,
:site_metadescription,
:cost_of_campaign,
:hmg_code,
:strategic_planning_code,
:ga_contact_email,
presence: true

Expand Down
10 changes: 10 additions & 0 deletions app/models/zendesk/ticket/campaign_request_ticket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ def comment_snippets
field: :cost_of_campaign,
label: "Site build budget / costs (and overall campaign cost, if applicable)",
),
Zendesk::LabelledSnippet.new(
on: @request.campaign,
field: :hmg_code,
label: "HMG code: from approved AMC technical cases. Format: HMGXX-XXX (If not applicable enter n/a)",
),
Zendesk::LabelledSnippet.new(
on: @request.campaign,
field: :strategic_planning_code,
label: "Strategic Planning Code: from strategic planning phase. Format: CSBXX-XXX (If not applicable enter n/a)",
),
Zendesk::LabelledSnippet.new(
on: @request.campaign,
field: :ga_contact_email,
Expand Down
22 changes: 22 additions & 0 deletions app/views/campaign_requests/_request_details.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,28 @@
</span>
</div>

<div class="form-group">
<span class="form-label">
<%= r.label :hmg_code do %>
HMG code: from approved AMC technical cases. Format: HMGXX-XXX (If not applicable enter n/a)
<% end %>
</span>
<span class="form-wrapper">
<%= r.text_field :hmg_code, required: false, aria: { required: false }, class: "input-md-6 form-control" %>
</span>
</div>

<div class="form-group">
<span class="form-label">
<%= r.label :strategic_planning_code do %>
Strategic Planning Code: from strategic planning phase. Format: CSBXX-XXX (If not applicable enter n/a)
<% end %>
</span>
<span class="form-wrapper">
<%= r.text_field :strategic_planning_code, required: false, aria: { required: false }, class: "input-md-6 form-control" %>
</span>
</div>

<div class="form-group">
<span class="form-label">
<%= r.label :ga_contact_email do %>
Expand Down
10 changes: 10 additions & 0 deletions spec/features/campaign_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@
[Site build budget / costs (and overall campaign cost, if applicable)]
£1200 and tuppence
[HMG code: from approved AMC technical cases. Format: HMGXX-XXX (If not applicable enter n/a)]
HMGXX-XXX
[Strategic Planning Code: from strategic planning phase. Format: CSBXX-XXX (If not applicable enter n/a)]
CSBXX-XXX
[Contact details for Google Analytics leads (Gmail accounts only)]
[email protected]
Expand Down Expand Up @@ -101,6 +107,8 @@
site_tagline: "A new one about a new thing",
site_metadescription: "pensions, campaign, newcampaign",
cost_of_campaign: "£1200 and tuppence",
hmg_code: "HMGXX-XXX",
strategic_planning_code: "CSBXX-XXX",
ga_contact_email: "[email protected]",
additional_comments: "Some comment",
)
Expand Down Expand Up @@ -136,6 +144,8 @@ def user_makes_a_campaign_request(details)
fill_in "Site tagline*", with: details[:site_tagline]
fill_in "Site metadescription (appears in search results)*", with: details[:site_metadescription]
fill_in "Site build budget / costs (and overall campaign cost, if applicable)*", with: details[:cost_of_campaign]
fill_in "HMG code: from approved AMC technical cases. Format: HMGXX-XXX (If not applicable enter n/a)", with: details[:hmg_code]
fill_in "Strategic Planning Code: from strategic planning phase. Format: CSBXX-XXX (If not applicable enter n/a)", with: details[:strategic_planning_code]
fill_in "Cabinet Office/No10 only : Contact details for Google Analytics leads (Gmail accounts only)", with: details[:ga_contact_email]
fill_in "Additional comments", with: details[:additional_comments]

Expand Down
4 changes: 4 additions & 0 deletions spec/models/support/gds/campaign_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def as_str(date)
proposed_url: "example.campaign.gov.uk",
site_metadescription: "tag1, tag2",
cost_of_campaign: 1200,
hmg_code: "HMGXX-XXX",
strategic_planning_code: "CSBXX-XXX",
ga_contact_email: "[email protected]",
)
end
Expand All @@ -42,6 +44,8 @@ def as_str(date)
it { should validate_presence_of(:site_tagline) }
it { should validate_presence_of(:site_metadescription) }
it { should validate_presence_of(:cost_of_campaign) }
it { should validate_presence_of(:hmg_code) }
it { should validate_presence_of(:strategic_planning_code) }
it { should validate_presence_of(:ga_contact_email) }

it { should validate_acceptance_of(:has_read_guidance_confirmation) }
Expand Down

0 comments on commit 9fc8a33

Please sign in to comment.