No more separate error form.

Error messages are now displayed directly on the faulty form.

Commit
1fcb02188f2e45e509fffd98eac60fcc4f08b201
Author
Marius Peter <marius.peter@tutanota.com>
Author date
Committer
Marius Peter <marius.peter@tutanota.com>
Committer date
Changed files
src/MyFitnessTracker-Components/MFTErrorsForm.class.st
index 4bc0b10f..00000000 100644..000000
@@ -1,53 +0,0 @@
1 Removed: Class {
2 Removed: #name : 'MFTErrorsForm',
3 Removed: #superclass : 'MFTForm',
4 Removed: #instVars : [
5 Removed: 'errors'
6 Removed: ],
7 Removed: #category : 'MyFitnessTracker-Components-Forms',
8 Removed: #package : 'MyFitnessTracker-Components',
9 Removed: #tag : 'Forms'
10 Removed: }
11 Removed:
12 Removed: { #category : 'as yet unclassified' }
13 Removed: MFTErrorsForm >> cancelForm [
14 Removed:
15 Removed: self answer: false
16 Removed: ]
17 Removed:
18 Removed: { #category : 'accessing' }
19 Removed: MFTErrorsForm >> errors: anObject [
20 Removed:
21 Removed: errors := anObject
22 Removed: ]
23 Removed:
24 Removed: { #category : 'initialization' }
25 Removed: MFTErrorsForm >> initialize [
26 Removed:
27 Removed: super initialize .
28 Removed: heading := 'Errors'
29 Removed: ]
30 Removed:
31 Removed: { #category : 'rendering' }
32 Removed: MFTErrorsForm >> renderContentOn: html [
33 Removed:
34 Removed: self renderFormOn: html with: [
35 Removed: html unorderedList: [ errors do: [ :error | html listItem: error ] ].
36 Removed: html text: 'Go back and fix the errors, or abort this process.' ]
37 Removed: ]
38 Removed:
39 Removed: { #category : 'as yet unclassified' }
40 Removed: MFTErrorsForm >> renderSubmitOn: html [
41 Removed:
42 Removed: html buttonGroup: [
43 Removed: html formButton
44 Removed: beSubmit;
45 Removed: beSecondary;
46 Removed: callback: [ self answer: false ];
47 Removed: with: 'Go back'.
48 Removed: html formButton
49 Removed: beSubmit;
50 Removed: beDanger;
51 Removed: callback: [ self answer: true ];
52 Removed: with: 'Abort' ]
53 Removed: ]
src/MyFitnessTracker-Components/MFTForm.class.st
index a4bf98bf..2da294f8 100644..100644
@@ -8,7 +8,8 @@
8 8 #name : 'MFTForm',
9 9 #superclass : 'SBSComponent',
10 10 #instVars : [
11 Removed: 'heading'
11 Added: 'heading',
12 Added: 'errors'
12 13 ],
13 14 #category : 'MyFitnessTracker-Components-Forms',
14 15 #package : 'MyFitnessTracker-Components',
@@ -25,7 +26,8 @@
25 26 MFTForm >> initialize [
26 27
27 28 super initialize.
28 Removed: heading := 'Form heading'
29 Added: heading := 'Form heading'.
30 Added: errors := OrderedCollection new
29 31 ]
30 32
31 33 { #category : 'rendering' }
@@ -34,6 +36,15 @@
34 36 self subclassResponsibility
35 37 ]
36 38
39 Added: { #category : 'rendering' }
40 Added: MFTForm >> renderErrorsOn: html [
41 Added:
42 Added: html listGroup
43 Added: marginBottom: 3;
44 Added: with: [
45 Added: errors do: [ :error | html listGroupItem beDanger with: error ] ]
46 Added: ]
47 Added:
37 48 { #category : 'as yet unclassified' }
38 49 MFTForm >> renderFormOn: html with: aBlock [
39 50
@@ -43,6 +54,7 @@
43 54 html displayHeading
44 55 level: 3;
45 56 with: heading.
57 Added: self renderErrorsOn: html.
46 58 html form: [
47 59 aBlock value.
48 60 html horizontalRule.
src/MyFitnessTracker-Components/MFTUserForm.class.st
index 355c803b..7640969a 100644..100644
@@ -30,7 +30,7 @@
30 30 self renderRealLastNamePickerOn: html ]
31 31 ]
32 32
33 Removed: { #category : 'rendering' }
33 Added: { #category : 'as yet unclassified' }
34 34 MFTUserForm >> renderDateOfBirthPickerOn: html [
35 35
36 36 html formGroup: [
@@ -49,7 +49,7 @@
49 49 html label: 'Date of birth' ] ]
50 50 ]
51 51
52 Removed: { #category : 'rendering' }
52 Added: { #category : 'as yet unclassified' }
53 53 MFTUserForm >> renderPasswordPickerOn: html [
54 54
55 55 html formGroup: [
@@ -72,7 +72,7 @@
72 72 html label: 'Confirm new password' ] ]
73 73 ]
74 74
75 Removed: { #category : 'rendering' }
75 Added: { #category : 'as yet unclassified' }
76 76 MFTUserForm >> renderRealFirstNamePickerOn: html [
77 77
78 78 html formGroup: [
@@ -87,7 +87,7 @@
87 87 html label: 'Real first name' ] ]
88 88 ]
89 89
90 Removed: { #category : 'rendering' }
90 Added: { #category : 'as yet unclassified' }
91 91 MFTUserForm >> renderRealLastNamePickerOn: html [
92 92
93 93 ^ html formGroup: [
@@ -102,7 +102,7 @@
102 102 html label: 'Real last name' ] ]
103 103 ]
104 104
105 Removed: { #category : 'rendering' }
105 Added: { #category : 'as yet unclassified' }
106 106 MFTUserForm >> renderUsernamePickerOn: html [
107 107
108 108 html formGroup: [
@@ -120,20 +120,13 @@
120 120 { #category : 'as yet unclassified' }
121 121 MFTUserForm >> submitForm [
122 122
123 Removed: | errors |
124 Removed: errors := OrderedCollection new.
125 Removed: user username ifEmpty: [ errors add: 'Username is empty' ].
123 Added: errors removeAll.
124 Added: user username ifEmpty: [ errors add: 'Username is empty.' ].
126 125 password = passwordConfirmation ifFalse: [
127 Removed: errors add: 'Password and confirmation don''t match' ].
128 Removed:
129 Removed: errors
130 Removed: ifNotEmpty: [
131 Removed: | abort |
132 Removed: abort := self call: (MFTErrorsForm new errors: errors).
133 Removed: abort ifTrue: [ self answer: nil ] ]
134 Removed: ifEmpty: [
135 Removed: password ifNotNil: [ user passwordHashFromString: password ].
136 Removed: self answer: user ]
126 Added: errors add: 'Password and confirmation don''t match.' ].
127 Added: errors ifNotEmpty: [ ^ self ].
128 Added: password ifNotNil: [ user passwordHashFromString: password ].
129 Added: self answer: user
137 130 ]
138 131
139 132 { #category : 'accessing' }
src/MyFitnessTracker-Components/MFTWorkoutForm.class.st
index 97824386..b0661216 100644..100644
@@ -141,10 +141,10 @@
141 141 { #category : 'as yet unclassified' }
142 142 MFTWorkoutForm >> submitForm [
143 143
144 Added: errors removeAll.
144 145 workout setGroups ifEmpty: [
145 Removed: (self call:
146 Removed: (MFTConfirmForm new message: 'No exercises were specified.'))
147 Removed: ifFalse: [ self answer: nil ] ].
146 Added: errors add: 'Workout contains no exercises.'.
147 Added: ^ self ].
148 148 self answer: workout
149 149 ]
150 150