File tree Expand file tree Collapse file tree 5 files changed +47
-13
lines changed Expand file tree Collapse file tree 5 files changed +47
-13
lines changed Original file line number Diff line number Diff line change
1
+ import { contactEmailValid } from '/lib/helperFunctions/validateSettings' ;
2
+
3
+ Template . homeBody . onCreated ( function ( ) {
4
+
5
+ // Subscribe to settings publication
6
+ this . subscribe ( 'settings' ) ;
7
+ } ) ;
8
+
1
9
Template . homeBody . rendered = function ( ) {
2
10
$ ( ".contact-us-link" ) . click ( function ( ) {
3
11
document . getElementById ( "contact-us" ) . scrollIntoView ( ) ;
4
12
} ) ;
5
13
} ;
14
+
15
+ Template . homeBody . helpers ( {
16
+ contactDetailsValid ( ) {
17
+
18
+ const settings = Settings . findOne ( ) ;
19
+
20
+ return contactEmailValid ( settings ) ;
21
+ }
22
+ } )
Original file line number Diff line number Diff line change @@ -134,18 +134,20 @@ <h2 class="section-heading">{{_ "section3_Heading"}}</h2>
134
134
</ div >
135
135
</ div >
136
136
</ div >
137
- < div id ="contact-us " class ="container ">
138
- < div class ="row ">
139
- < div class ="col-lg-12 text-center ">
140
- < h2 class ="feature-section-heading "> {{_ "section_ContactUs"}}</ h2 >
141
- < hr class ="primary ">
142
- < h4 class ="text-muted "> {{_ "section_ContactUs_Text"}}</ h4 >
137
+ {{ # if contactDetailsValid }}
138
+ < div id ="contact-us " class ="container ">
139
+ < div class ="row ">
140
+ < div class ="col-lg-12 text-center ">
141
+ < h2 class ="feature-section-heading "> {{_ "section_ContactUs"}}</ h2 >
142
+ < hr class ="primary ">
143
+ < h4 class ="text-muted "> {{_ "section_ContactUs_Text"}}</ h4 >
144
+ </ div >
143
145
</ div >
144
- </ div >
145
- < div class ="row ">
146
- < div class =" col-lg-6 col-lg-push-3 " >
147
- {{ > contactForm}}
146
+ < div class =" row " >
147
+ < div class ="col-lg-6 col-lg-push-3 ">
148
+ {{ > contactForm}}
149
+ </ div >
148
150
</ div >
149
151
</ div >
150
- </ div >
152
+ {{ / if }}
151
153
</ template >
Original file line number Diff line number Diff line change 107
107
.features {
108
108
margin-bottom : 3.5em ;
109
109
}
110
+
111
+ #contact-us {
112
+ margin-bottom : 4.37em ;
113
+ }
110
114
}
Original file line number Diff line number Diff line change 6
6
/* Footer */
7
7
footer {
8
8
background-color : #333 ;
9
- margin-top : 4.37em ;
10
9
padding-bottom : 1em ;
11
10
padding-top : 2em ;
12
11
Original file line number Diff line number Diff line change @@ -32,7 +32,6 @@ export function apiUmbrellaSettingsValid (settings) {
32
32
// Validates mail configuration settings
33
33
export function mailSettingsValid ( settings ) {
34
34
35
-
36
35
if ( ( typeof settings !== 'undefined' ) && settings . mail ) {
37
36
38
37
if ( settings . mail . username && settings . mail . password ) {
@@ -43,3 +42,16 @@ export function mailSettingsValid (settings) {
43
42
44
43
return false ;
45
44
}
45
+
46
+ // Validate email address setting
47
+ export function contactEmailValid ( settings ) {
48
+ // Check all properties in nested structure
49
+ if ( ( typeof settings !== 'undefined' ) && settings . contactForm ) {
50
+ if ( settings . contactForm . toEmail ) {
51
+ // Finally return true
52
+ return true ;
53
+ }
54
+ }
55
+
56
+ return false ;
57
+ }
You can’t perform that action at this time.
0 commit comments