From 8f96901a3b60bbe14e9dc5c0ca9b099771b68d52 Mon Sep 17 00:00:00 2001
From: Todd Dembrey <todd.dembrey@torchbox.com>
Date: Wed, 8 Aug 2018 10:37:41 +0100
Subject: [PATCH] add the address to the details page

---
 opentech/apply/funds/blocks.py                            | 6 ++++++
 .../funds/templates/funds/includes/rendered_answers.html  | 4 ++++
 opentech/static_src/src/sass/apply/components/_grid.scss  | 8 ++++++++
 3 files changed, 18 insertions(+)

diff --git a/opentech/apply/funds/blocks.py b/opentech/apply/funds/blocks.py
index 695792121..a2e55732d 100644
--- a/opentech/apply/funds/blocks.py
+++ b/opentech/apply/funds/blocks.py
@@ -1,3 +1,5 @@
+import json
+
 from django import forms
 from django.utils.translation import ugettext_lazy as _
 
@@ -44,6 +46,10 @@ class AddressFieldBlock(ApplicationMustIncludeFieldBlock):
         label = _('Address')
         icon = 'home'
 
+    def format_data(self, data):
+        address = json.loads(data)
+        return ', '.join(address.values())
+
 
 class FullNameBlock(ApplicationMustIncludeFieldBlock):
     name = 'full_name'
diff --git a/opentech/apply/funds/templates/funds/includes/rendered_answers.html b/opentech/apply/funds/templates/funds/includes/rendered_answers.html
index b6d461a85..e056156ba 100644
--- a/opentech/apply/funds/templates/funds/includes/rendered_answers.html
+++ b/opentech/apply/funds/templates/funds/includes/rendered_answers.html
@@ -20,6 +20,10 @@
         <h5>Email</h5>
         <p>{{ object.email }}</p>
     </div>
+    <div class="grid__cell--span-two">
+        <h5>Address</h5>
+        <p>{{ object.get_address_display }}</p>
+    </div>
 </div>
 <div class="rich-text rich-text--answers">
     {{ object.render_answers }}
diff --git a/opentech/static_src/src/sass/apply/components/_grid.scss b/opentech/static_src/src/sass/apply/components/_grid.scss
index 3a633983b..7756eedd4 100644
--- a/opentech/static_src/src/sass/apply/components/_grid.scss
+++ b/opentech/static_src/src/sass/apply/components/_grid.scss
@@ -86,5 +86,13 @@
                 margin: 0;
             }
         }
+
+        &__cell {
+            &--span-two{
+                @include media-query(mob-landscape) {
+                    grid-column: auto / span 2;
+                }
+            }
+        }
     }
 }
-- 
GitLab