Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Adding non static content #9

Merged
merged 16 commits into from

2 participants

@jackfranklin

This is the content for the legalisation pages, plus some small tweaks I had to do to allow us to use the content we need on the pages we need them to.

@jackfranklin

Added the foreign marriage certificate transaction.

Now left: death, birth, depositing certificates

@JordanHatch JordanHatch was assigned
@jackfranklin

@JordanHatch I think this is now ready for checking & then merging.

@JordanHatch

I think you'll need to update the tests - I get 15 failures when I run them with these changes.

@jackfranklin

Pfft...tests are overrated.

Updated them with the new content - unbelievably slipped my mind to do it previously slap. Now all green.

app/views/partials/questions/_document_type.html.erb
@@ -3,7 +3,11 @@
<% @transaction.document_types.each do |value,label| %>
<li>
<%= label_tag "transaction_document_type_#{value}" do %>
- <%= radio_button_tag "transaction[document_type]", value %> <%= label %>
+ <%
+ formatted_label = label
+ formatted_label[0] = formatted_label[0].capitalize
+ %>

Is this not the same as label.capitalize?

Not quite.

The issue is that "Nulla Osta".capitalize == "Nulla osta", but I don't want it to lowercase the "o" in Osta. There may well be a better way to do this.

You could use titleize?

But "certificate of no impediment" needs to go to "Certificate of no impediment", it shouldn't have each word capitalised. capitalize would work fine if we didn't have to deal with "Nulla Osta".

Why do we need to modify the cases for these? Can we not just store the string as the correct case in transactions.yml and use it here without modification?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
...ansactions/deposit-foreign-marriage/_confirm.html.erb
@@ -1 +1 @@
-<p>The cost for <%= @calculation.item_list %> is &pound;<%= format_money @calculation.total_cost %>
+<p>The cost to deposit <%= pluralize @calculation.document_count, "certificate" %><% if @calculation.postage %> plus postage<% end %> is &pound;<%= format_money @calculation.total_cost %>.

Why doesn't this use @calculation.item_list here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@JordanHatch JordanHatch commented on the diff
lib/transaction_calculator.rb
@@ -48,7 +48,13 @@ def calculate(values)
item_list_order = [:registration, :document, :postage]
return OpenStruct.new(
:total_cost => total_cost,
- :item_list => item_list_order.map {|key| item_list[key] }.join("")
+ :item_list => item_list_order.map {|key| item_list[key] }.join(""),
+ :postage_option => postage_option,
+ :postage_option_label => postage_method.nil? ? "" : postage_method['label'],
+ :document_count => document_count,
+ :postage => postage,
+ :document_type => document_type,
+ :registration_count => registration_count
)

It would be cleaner to merge the values hash into the response instead.

But then wouldn't we lose the fact that at the beginning of that method we process those values?

document_count = values[:document_count].to_i
postage = values[:postage] == "yes"
etc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@JordanHatch JordanHatch merged commit f557f3b into master
@JordanHatch JordanHatch deleted the adding_non_static_content branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 108 additions and 41 deletions.
  1. +3 −2 app/helpers/epdq_transactions_helper.rb
  2. +2 −1  app/views/partials/questions/_document_type.html.erb
  3. +2 −1  app/views/partials/transactions/deposit-foreign-marriage/_confirm.html.erb
  4. +5 −2 app/views/partials/transactions/deposit-foreign-marriage/_done.html.erb
  5. +2 −1  app/views/partials/transactions/pay-foreign-marriage-certificates/_confirm.html.erb
  6. +1 −1  app/views/partials/transactions/pay-legalisation-drop-off/_confirm.html.erb
  7. +3 −5 app/views/partials/transactions/pay-legalisation-drop-off/_done.html.erb
  8. +1 −1  app/views/partials/transactions/pay-legalisation-post/_confirm.html.erb
  9. +44 −2 app/views/partials/transactions/pay-legalisation-post/_done.html.erb
  10. +1 −1  app/views/partials/transactions/pay-register-birth-abroad/_confirm.html.erb
  11. +6 −0 app/views/partials/transactions/pay-register-birth-abroad/_done.html.erb
  12. +1 −1  app/views/partials/transactions/pay-register-death-abroad/_confirm.html.erb
  13. +6 −1 app/views/partials/transactions/pay-register-death-abroad/_done.html.erb
  14. +12 −4 lib/transaction_calculator.rb
  15. +4 −3 lib/transactions.yml
  16. +3 −3 spec/controllers/epdq_transactions_controller_spec.rb
  17. +7 −7 spec/features/epdq_transactions_spec.rb
  18. +5 −5 spec/lib/transaction_calculator_spec.rb
View
5 app/helpers/epdq_transactions_helper.rb
@@ -1,5 +1,5 @@
module EpdqTransactionsHelper
-
+
def epdq_params
@epdq_response.parameters
end
@@ -30,6 +30,7 @@ def registration_count
end
def registrations?
- registration_count > 0
+ registration_count > 0
end
+
end
View
3  app/views/partials/questions/_document_type.html.erb
@@ -3,7 +3,8 @@
<% @transaction.document_types.each do |value,label| %>
<li>
<%= label_tag "transaction_document_type_#{value}" do %>
- <%= radio_button_tag "transaction[document_type]", value %> <%= label %>
+ <% formatted_label = label.dup.tap {|l| l[0] = l[0].upcase } %>
+ <%= radio_button_tag "transaction[document_type]", value %> <%= formatted_label %>
<% end %>
</li>
<% end %>
View
3  app/views/partials/transactions/deposit-foreign-marriage/_confirm.html.erb
@@ -1 +1,2 @@
-<p>The cost for <%= @calculation.item_list %> is &pound;<%= format_money @calculation.total_cost %>
+
+<p>The cost to deposit <%= @calculation.item_list %> is &pound;<%= format_money @calculation.total_cost %>.</p>
View
7 app/views/partials/transactions/deposit-foreign-marriage/_done.html.erb
@@ -1,3 +1,6 @@
-<p>Your payment reference is <%= @epdq_response.parameters[:payid] %></p>
+<p>You have paid to deposit <%= pluralize document_count, "certificate" %><% if postage? %> plus postage <% end %>.</p>
-[Print this page] and send it, along with your [certificate / certificates], application form and supporting documents listed on the form, to the Foreign &amp; Commonwealth Office (FCO). The address is on the form.
+<p>Your payment reference is <%= @epdq_response.parameters[:payid] %>.</p>
+
+
+<p>Print this page and send it, along with your <%= pluralize document_count, "certificate" %>, application form and supporting documents listed on the form, to the Foreign &amp; Commonwealth Office (FCO). The address is on the form.</p>
View
3  app/views/partials/transactions/pay-foreign-marriage-certificates/_confirm.html.erb
@@ -1 +1,2 @@
-<p>The cost for <%= @calculation.item_list %> is &pound;<%= format_money @calculation.total_cost %>.</p>
+<p>The cost of <%= @calculation.item_list %> is &pound;<%= format_money @calculation.total_cost %>.</p>
+
View
2  app/views/partials/transactions/pay-legalisation-drop-off/_confirm.html.erb
@@ -1 +1 @@
-<p>The cost for <%= @calculation.item_list %> is &pound;<%= format_money @calculation.total_cost %>.</p>
+<p>It costs &pound;<%= @calculation.total_cost %> for <%= pluralize @calculation.document_count, "document" %><% if @calculation.postage_option_label != "" %> plus <%= @calculation.postage_option_label %> postage<% end %>.</p>
View
8 app/views/partials/transactions/pay-legalisation-drop-off/_done.html.erb
@@ -1,8 +1,6 @@
-<p>Your payment to the Foreign &amp; Commonwealth Office is complete.</p>
-<p>Your payment ID is <strong><%= @epdq_response.parameters[:payid] %></strong>.</p>
<h2>Payment confirmation</h2>
-<p>Your payment of &pound;<%= @transaction.total_cost %> has been received by the Legalisation Office.</p>
+<p>Your payment of &pound;<%= format_money @epdq_response.parameters[:amount] %> has been received by the Legalisation Office.</p>
<p>Your payment number is <%= @epdq_response.parameters[:payid] %>.</p>
@@ -23,6 +21,6 @@
<h2>Opening times</h2>
<p>The opening hours of the drop-off office are:</p>
<ul>
- <li>- 9am to midday (the last drop-off time for pre-lunch pickup is 10:30am)</li>
- <li>- 1pm to 5pm (the last drop-off time for same day collection is 3:30pm)</li>
+ <li>9am to midday (the last drop-off time for pre-lunch pickup is 10:30am)</li>
+ <li>1pm to 5pm (the last drop-off time for same day collection is 3:30pm)</li>
</ul>
View
2  app/views/partials/transactions/pay-legalisation-post/_confirm.html.erb
@@ -1 +1 @@
-<p>The cost for <%= @calculation.item_list %> is &pound;<%= format_money @calculation.total_cost %>.</p>
+<p>It costs &pound;<%= @calculation.total_cost %> for <%= pluralize @calculation.document_count, "document" %> plus <%= @calculation.postage_option_label %> postage.</p>
View
46 app/views/partials/transactions/pay-legalisation-post/_done.html.erb
@@ -1,2 +1,44 @@
-<p>Your payment to the Foreign &amp; Commonwealth Office is complete.</p>
-<p>Your payment ID is <strong><%= @epdq_response.parameters[:payid] %></strong>.</p>
+<h2>Payment confirmation</h2>
+
+<p>Your payment of &pound;<%= @epdq_response.parameters[:amount] %> has been received by the Legalisation Office.</p>
+
+<p>Your payment number is <%= @epdq_response.parameters[:payid] %>.</p>
+
+
+<h2>What to do next</h2>
+
+<p>Send the following items to the Legalisation Office:</p>
+
+<ul>
+ <li>the documents you want legalised</li>
+ <li>a signed <a rel="external" href="http://uk.sitestat.com/fcoweb/fcogov/s?fco.en.about-us.what-we-do.services-we-deliver.legal-services.Legalisation.p.pdf.LO-app-form-Word-2012&amp;ns_type=pdf&amp;ns_url=http://www.fco.gov.uk/resources/en/word/5029385/8400026/LO-app-form-Word-2012">Legalisation application form (DOC, 36KB)</a>(with your payment number added)</li>
+ <li>a printout of this payment confirmation page</li>
+ <% if @epdq_response.parameters[:postage_option] == "courier-or-prepaid" %>
+ <li>an A4-sized prepaid envelope so your documents can be returned</li>
+ <% end %>
+</ul>
+
+<div class="address">
+ <p>Legalisation Office</p>
+ <p>Foreign &amp; Commonwealth Office</p>
+ <p>PO Box 6255</p>
+ <p>Milton Keynes</p>
+ <p>MK10 1XX</p>
+</div>
+
+<div class="application-notice help-notice"><p>You must post your application and documents - you can't go to the legalisation office in person.</p></div>
+
+
+<h2>If you’re abroad or using a courier</h2>
+
+<p>Send your registration to the following address if you’re abroad or using a courier service in the UK:</p>
+
+<div class="address">
+ <p>The Legalisation Office</p>
+ <p>Foreign &amp; Commonwealth Office</p>
+ <p>Hanslope Park</p>
+ <p>Hanslope</p>
+ <p>Milton Keynes</p>
+ <p>MK19 7BH</p>
+</div>
+
View
2  app/views/partials/transactions/pay-register-birth-abroad/_confirm.html.erb
@@ -1 +1 @@
-<p>The cost for <%= @calculation.item_list %> is &pound;<%= format_money @calculation.total_cost %>.</p>
+<p>The cost for <%= pluralize @calculation.registration_count, "registration" %> and <%= pluralize @calculation.document_count, "certificate" %><% if @calculation.postage? %> plus postage<% end %> is &pound;<%= format_money @calculation.total_cost %>.</p>
View
6 app/views/partials/transactions/pay-register-birth-abroad/_done.html.erb
@@ -1,2 +1,8 @@
<p>Your payment to the Foreign &amp; Commonwealth Office is complete.</p>
+
+<p>You have paid for <%= pluralize registration_count, "registration" %> and <%= pluralize document_count, "certificate" %><% if postage? %>, plus postage<% end %>.</p>
+
+<p>Your payment reference is <%= @epdq_response.parameters[:payid] %>.</p>
+
+<p>Print this page and send it, along with your <%= document_count == 1 ? "certificate" : "certificates" %>, application form and supporting documents listed on the form, to the Foreign &amp; Commonwealth Office (FCO). The address is on the form.</p>
<p>Your payment ID is <strong><%= @epdq_response.parameters[:payid] %></strong>.</p>
View
2  app/views/partials/transactions/pay-register-death-abroad/_confirm.html.erb
@@ -1 +1 @@
-<p>The cost for <%= @calculation.item_list %> is &pound;<%= format_money @calculation.total_cost %>.</p>
+<p>The cost for <%= pluralize @calculation.registration_count, "registration" %> and <%= pluralize @calculation.document_count, "certificate" %><% if @calculation.postage %> plus postage<% end %> is &pound;<%= format_money @calculation.total_cost %>.</p>
View
7 app/views/partials/transactions/pay-register-death-abroad/_done.html.erb
@@ -1,2 +1,7 @@
<p>Your payment to the Foreign &amp; Commonwealth Office is complete.</p>
-<p>Your payment ID is <strong><%= @epdq_response.parameters[:payid] %></strong>.</p>
+
+<p>You have paid for <%= pluralize registration_count, "registration" %> and <%= pluralize document_count, "certificate" %><% if postage? %>, plus postage<% end %>.</p>
+
+<p>Your payment reference is <%= @epdq_response.parameters[:payid] %>.</p>
+
+<p>Print this page and send it, along with your <%= document_count == 1 ? "certificate" : "certificates" %>, application form and supporting documents listed on the form, to the Foreign &amp; Commonwealth Office (FCO). The address is on the form.
View
16 lib/transaction_calculator.rb
@@ -21,10 +21,10 @@ def calculate(values)
raise Transaction::InvalidPostageOption unless postage_method
postage_total = postage_method['cost']
- item_list[:postage] = ", plus #{postage_method['label']} postage,"
+ item_list[:postage] = " plus #{postage_method['label']} postage"
elsif postage
postage_total = @transaction.postage_cost
- item_list[:postage] = ", plus postage,"
+ item_list[:postage] = " plus postage"
end
total_cost = document_total + (postage_total || 0)
@@ -42,13 +42,21 @@ def calculate(values)
document_type_label = @transaction.document_types[document_type]
end
raise Transaction::InvalidDocumentType unless document_type_label
+ elsif @transaction.document_type.present?
+ document_type_label = @transaction.document_type
end
item_list[:document] = "#{document_count} " + pluralize_document_type_label(document_count, document_type_label || "document")
item_list_order = [:registration, :document, :postage]
return OpenStruct.new(
:total_cost => total_cost,
- :item_list => item_list_order.map {|key| item_list[key] }.join("")
+ :item_list => item_list_order.map {|key| item_list[key] }.join(""),
+ :postage_option => postage_option,
+ :postage_option_label => postage_method.nil? ? "" : postage_method['label'],
+ :document_count => document_count,
+ :postage => postage,
+ :document_type => document_type,
+ :registration_count => registration_count
)

It would be cleaner to merge the values hash into the response instead.

But then wouldn't we lose the fact that at the beginning of that method we process those values?

document_count = values[:document_count].to_i
postage = values[:postage] == "yes"
etc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
end
@@ -59,7 +67,7 @@ def pluralize_document_type_label(quantity, label)
case label
when /\Acertificate/i then label.sub(/\A([cC])ertificate/i, '\1ertificates')
- when "Nulla osta" then "Nulla ostas" # pluralize thinks this is already plural
+ when "Nulla Osta" then "Nulla Ostas" # pluralize thinks this is already plural
else
label.pluralize(quantity)
end
View
7 lib/transactions.yml
@@ -4,9 +4,9 @@ pay-foreign-marriage-certificates:
postage_cost: 10
registration: false
document_types:
- certificate-of-no-impediment: Certificate of no impediment
- nulla-osta: Nulla osta
- certificate-of-custom-law: Certificate of custom law
+ certificate-of-no-impediment: certificate of no impediment
+ nulla-osta: Nulla Osta
+ certificate-of-custom-law: certificate of custom law
account: birth-death-marriage
deposit-foreign-marriage:
title: Deposit foreign marriage or civil partnership certificates
@@ -14,6 +14,7 @@ deposit-foreign-marriage:
postage_cost: 10
registration: false
account: birth-death-marriage
+ document_type: certificate
pay-register-death-abroad:
title: Payment to register a death abroad
document_cost: 65
View
6 spec/controllers/epdq_transactions_controller_spec.rb
@@ -76,7 +76,7 @@
it "should calculate the correct total cost" do
assigns(:calculation).total_cost.should == 335
- assigns(:calculation).item_list.should == "5 Nulla ostas, plus postage,"
+ assigns(:calculation).item_list.should == "5 Nulla Ostas plus postage"
end
it "is successful" do
@@ -147,7 +147,7 @@
it "should calculate the correct total cost" do
assigns(:calculation).total_cost.should == 860
- assigns(:calculation).item_list.should == "5 birth registrations and 5 birth certificates, plus postage,"
+ assigns(:calculation).item_list.should == "5 birth registrations and 5 birth certificates plus postage"
end
it "is successful" do
@@ -182,7 +182,7 @@
it "should calculate the correct total cost" do
assigns(:calculation).total_cost.should == 105
- assigns(:calculation).item_list.should == "3 documents"
+ assigns(:calculation).item_list.should == "3 certificates"
end
it "is successful" do
View
14 spec/features/epdq_transactions_spec.rb
@@ -23,7 +23,7 @@
within(:css, "form") do
page.should have_content("Pay for documents you need from the Foreign & Commonwealth Office (FCO) to prove you’re allowed to get married abroad.")
page.should have_unchecked_field("Certificate of no impediment")
- page.should have_unchecked_field("Nulla osta")
+ page.should have_unchecked_field("Nulla Osta")
page.should have_unchecked_field("Certificate of custom law")
page.should have_content("Each certificate costs £65.")
@@ -50,7 +50,7 @@
end
it "calculates a total" do
- page.should have_content("The cost for 3 Certificates of custom law, plus postage, is £205")
+ page.should have_content("The cost of 3 certificates of custom law plus postage is £205")
end
it "generates an EPDQ form" do
@@ -172,7 +172,7 @@
end
it "calculates a total" do
- page.should have_content("The cost for 2 birth registrations and 3 birth certificates, plus postage, is £415")
+ page.should have_content("The cost for 2 registrations and 3 certificates is £415")
end
it "generates an EPDQ form" do
@@ -232,7 +232,7 @@
end
it "calculates a total" do
- page.should have_content("The cost for 5 death registrations and 1 death certificate, plus postage, is £600")
+ page.should have_content("The cost for 5 registrations and 1 certificate plus postage is £600")
end
it "generates an EPDQ form" do
@@ -288,7 +288,7 @@
end
it "calculates a total" do
- page.should have_content("The cost for 1 document, plus postage, is £45")
+ page.should have_content("The cost to deposit 1 certificate plus postage is £45")
end
it "generates an EPDQ form" do
@@ -348,7 +348,7 @@
end
it "calculates a total" do
- page.should have_content("The cost for 1 document, plus Rest of the World postage, is £55")
+ page.should have_content("It costs £55 for 1 document plus Rest of the World postage")
end
it "generates an EPDQ form" do
@@ -417,7 +417,7 @@
end
it "calculates a total" do
- page.should have_content("The cost for 5 documents is £375.")
+ page.should have_content("It costs £375 for 5 documents")
end
it "generates an EPDQ form" do
View
10 spec/lib/transaction_calculator_spec.rb
@@ -32,7 +32,7 @@
end
it "builds an item list with postage" do
- @calculator.calculate(:document_count => 5, :postage => "yes").item_list.should == "5 documents, plus postage,"
+ @calculator.calculate(:document_count => 5, :postage => "yes").item_list.should == "5 documents plus postage"
end
end
@@ -62,7 +62,7 @@
end
it "builds an item list for multiple documents, plus postage" do
- @calculator.calculate(:document_count => 2, :document_type => "tea-assurance-document", :postage => "yes").item_list.should == "2 Tea assurance documents, plus postage,"
+ @calculator.calculate(:document_count => 2, :document_type => "tea-assurance-document", :postage => "yes").item_list.should == "2 Tea assurance documents plus postage"
end
it "builds an item list for a single certificate" do
@@ -110,7 +110,7 @@
end
it "builds an item list for multiple registrations and documents, with postage" do
- @calculator.calculate(:registration_count => 1, :document_count => 4, :postage => "yes").item_list.should == "1 tea registration and 4 tea certificates, plus postage,"
+ @calculator.calculate(:registration_count => 1, :document_count => 4, :postage => "yes").item_list.should == "1 tea registration and 4 tea certificates plus postage"
end
end
@@ -144,11 +144,11 @@
end
it "builds an item list including the postage type" do
- @calculator.calculate(:postage_option => "horse-and-cart").item_list.should == "0 documents, plus Horse and cart postage,"
+ @calculator.calculate(:postage_option => "horse-and-cart").item_list.should == "0 documents plus Horse and cart postage"
end
it "builds an item list of multiple documents including the postage type" do
- @calculator.calculate(:postage_option => "flying-machine", :document_count => 3).item_list.should == "3 documents, plus Flying machine postage,"
+ @calculator.calculate(:postage_option => "flying-machine", :document_count => 3).item_list.should == "3 documents plus Flying machine postage"
end
it "raises an error if no postage option set" do
Something went wrong with that request. Please try again.