[Pharo] Personal fitness tracker web app.
Page header and footer.
Changed files
src/MyFitnessTracker/MFTFooterComponent.class.st
@@ -0,0 +1,16 @@
1
Added:
Class {
2
Added:
#name : #MFTFooterComponent,
3
Added:
#superclass : #SBSComponent,
4
Added:
#category : #'MyFitnessTracker-Components'
5
Added:
}
6
Added:
7
Added:
{ #category : #rendering }
8
Added:
MFTFooterComponent >> renderContentOn: html [
9
Added:
10
Added:
html container
11
Added:
marginTop: 3;
12
Added:
with: [
13
Added:
html card: [
14
Added:
html cardHeader:
15
Added:
'Copyright ' , Date today year asString , ' Marius PETER' ] ]
16
Added:
]
src/MyFitnessTracker/MFTHeaderComponent.class.st
@@ -1,11 +1,118 @@
1
1
Class {
2
2
#name : #MFTHeaderComponent,
3
3
#superclass : #SBSComponent,
4
Added:
#instVars : [
5
Added:
'email',
6
Added:
'localPart',
7
Added:
'domain'
8
Added:
],
4
9
#category : #'MyFitnessTracker-Components'
5
10
}
6
11
12
Added:
{ #category : #adding }
13
Added:
MFTHeaderComponent >> addUserEmail [
14
Added:
15
Added:
| emailToCheck emailPattern |
16
Added:
emailToCheck := self call: MFTEmailSignupDialog new.
17
Added:
emailPattern := '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]{3,}\.[a-zA-Z]{2,}$'
18
Added:
asRegex.
19
Added:
(emailToCheck isNil or: [ (emailPattern matches: emailToCheck) not ])
20
Added:
ifTrue: [ ^ nil ].
21
Added:
email := emailToCheck.
22
Added:
self storeEmail: emailToCheck
23
Added:
]
24
Added:
7
25
{ #category : #rendering }
8
26
MFTHeaderComponent >> renderContentOn: html [
9
27
10
Removed:
nil
28
Added:
email
29
Added:
ifNil: [
30
Added:
html alert
31
Added:
beWarning;
32
Added:
beDismissible;
33
Added:
marginBottom: 0;
34
Added:
with: [
35
Added:
html closeButton dataDismiss: 'alert'.
36
Added:
html alertHeading: 'This app is still in beta.'.
37
Added:
html paragraph: [
38
Added:
html
39
Added:
text:
40
Added:
'My Fitness Tracker is still under heavy development, with improvements being made daily.';
41
Added:
space;
42
Added:
text: 'I can''t wait to share the finished product with you!' ].
43
Added:
html
44
Added:
strong: 'Want to know when version 1.0 is out?';
45
Added:
break.
46
Added:
html form: [
47
Added:
html formButton
48
Added:
bePrimary;
49
Added:
callback: [ self addUserEmail ];
50
Added:
with: 'E-mail me!' ] ] ]
51
Added:
ifNotNil: [
52
Added:
html alert
53
Added:
beSuccess;
54
Added:
beDismissible;
55
Added:
marginBottom: 0;
56
Added:
with: [
57
Added:
html closeButton dataDismiss: 'alert'.
58
Added:
html text: email , ' will be notified when v1 is released!' ] ]
59
Added:
]
60
Added:
61
Added:
{ #category : #rendering }
62
Added:
MFTHeaderComponent >> renderEmailInputModalButtonOn: html [
63
Added:
64
Added:
^ html formButton
65
Added:
bePrimary;
66
Added:
beSmall;
67
Added:
dataToggle: 'modal';
68
Added:
dataTarget: '#emailInputModal';
69
Added:
with: 'E-mail me!'
70
Added:
]
71
Added:
72
Added:
{ #category : #rendering }
73
Added:
MFTHeaderComponent >> renderEmailInputModalOn: html [
74
Added:
75
Added:
html modal
76
Added:
id: 'emailInputModal';
77
Added:
fade;
78
Added:
with: [
79
Added:
html modalDialog
80
Added:
beCentered;
81
Added:
with: [
82
Added:
html modalContent: [
83
Added:
html form: [
84
Added:
html modalHeader: [
85
Added:
html modalTitle
86
Added:
level5;
87
Added:
with:
88
Added:
'You''ll be the first to know when My Fitness Tracker is ready to use.'.
89
Added:
html modalCloseButton ].
90
Added:
91
Added:
html modalBody: [
92
Added:
html inputGroup: [
93
Added:
html formTextInput
94
Added:
callback: [ :value | localPart := value ];
95
Added:
placeholder: 'my-user'.
96
Added:
html inputGroupAppend: [ html inputGroupText: '@' ].
97
Added:
html formTextInput
98
Added:
callback: [ :value | domain := value ];
99
Added:
placeholder: 'example.com' ] ].
100
Added:
101
Added:
html modalFooter: [
102
Added:
html paragraph:
103
Added:
'You will receive a single e-mail when the app is ready to use. Your e-mail address shall not be used in any other way.'.
104
Added:
html formButton
105
Added:
bePrimary;
106
Added:
beSubmit;
107
Added:
callback: [ email := localPart , '@' , domain ];
108
Added:
with: 'Confirm' ] ] ] ] ]
109
Added:
]
110
Added:
111
Added:
{ #category : #'as yet unclassified' }
112
Added:
MFTHeaderComponent >> storeEmail: anEmail [
113
Added:
114
Added:
self session dbConnection
115
Added:
execute: 'INSERT INTO prospects(email,date_time) VALUES (?, ?);'
116
Added:
value: anEmail
117
Added:
value: DateAndTime now asUTC rounded asString
11
118
]