@@ -81,78 +81,18 @@ class ProfileFormContainer extends React.Component {
81
81
}
82
82
dispatch ( updateProfile ( username , profile ) ) ;
83
83
this . updateProfileValidation ( this . props , profile , validator ) ;
84
- }
84
+ } ;
85
85
86
86
setProfileStep: Function = ( step : string ) : void => {
87
87
const { dispatch } = this . props ;
88
88
dispatch ( setProfileStep ( step ) ) ;
89
89
} ;
90
90
91
- setDeletionIndex: Function = ( index : number ) : void => {
92
- const { dispatch } = this . props ;
93
- dispatch ( setDeletionIndex ( index ) ) ;
94
- }
95
-
96
- setShowEducationDeleteDialog: Function = ( bool : boolean ) : void => {
97
- const { dispatch } = this . props ;
98
- dispatch ( setShowEducationDeleteDialog ( bool ) ) ;
99
- }
100
-
101
- setShowWorkDeleteDialog: Function = ( bool : boolean ) : void => {
102
- const { dispatch } = this . props ;
103
- dispatch ( setShowWorkDeleteDialog ( bool ) ) ;
104
- }
105
-
106
- setShowWorkDeleteAllDialog: Function = ( bool : boolean ) : void => {
107
- const { dispatch } = this . props ;
108
- dispatch ( setShowWorkDeleteAllDialog ( bool ) ) ;
109
- } ;
110
-
111
- setShowEducationDeleteAllDialog: Function = ( bool : boolean ) : void => {
112
- const { dispatch } = this . props ;
113
- dispatch ( setShowEducationDeleteAllDialog ( bool ) ) ;
114
- } ;
115
-
116
- setUserPageDialogVisibility: Function = ( bool : boolean ) : void => {
117
- const { dispatch } = this . props ;
118
- dispatch ( setUserPageDialogVisibility ( bool ) ) ;
119
- } ;
120
-
121
91
setWorkHistoryEdit: AsyncActionHelper = ( bool : boolean ) => {
122
92
const { dispatch } = this . props ;
123
93
return dispatch ( setWorkHistoryEdit ( bool ) ) ;
124
94
}
125
95
126
- setWorkDialogVisibility: Function = ( bool : boolean ) : void => {
127
- const { dispatch } = this . props ;
128
- dispatch ( setWorkDialogVisibility ( bool ) ) ;
129
- }
130
-
131
- setWorkDialogIndex: Function = ( index : number ) : void => {
132
- const { dispatch } = this . props ;
133
- dispatch ( setWorkDialogIndex ( index ) ) ;
134
- }
135
-
136
- clearProfileEdit: Function = ( ) : void => {
137
- const { dispatch } = this . props ;
138
- dispatch ( clearProfileEdit ( SETTINGS . username ) ) ;
139
- }
140
-
141
- setEducationDialogVisibility: Function = ( bool : boolean ) : void => {
142
- const { dispatch } = this . props ;
143
- dispatch ( setEducationDialogVisibility ( bool ) ) ;
144
- }
145
-
146
- setEducationDialogIndex: Function = ( index : number ) : void => {
147
- const { dispatch } = this . props ;
148
- dispatch ( setEducationDialogIndex ( index ) ) ;
149
- }
150
-
151
- setEducationDegreeLevel: Function = ( level : string ) : void => {
152
- const { dispatch } = this . props ;
153
- dispatch ( setEducationDegreeLevel ( level ) ) ;
154
- } ;
155
-
156
96
setEducationDegreeInclusions: AsyncActionHelper = ( inclusions : Object ) => {
157
97
const { dispatch } = this . props ;
158
98
return dispatch ( setEducationDegreeInclusions ( inclusions ) ) ;
@@ -177,6 +117,28 @@ class ProfileFormContainer extends React.Component {
177
117
}
178
118
}
179
119
120
+ createActionHelper: Function = ( actionCreator : Function ) : ( ...args : any ) = > void => {
121
+ const { dispatch } = this . props ;
122
+ return ( ...args ) => dispatch ( actionCreator ( ...args ) ) ;
123
+ } ;
124
+
125
+ simpleActionHelpers: Function = ( ) : { [ k : string ] : ( ...args : any ) => void } [ ] = > [
126
+ [ setWorkDialogVisibility , "setWorkDialogVisibility" ] ,
127
+ [ setWorkDialogIndex , "setWorkDialogIndex" ] ,
128
+ [ clearProfileEdit , "clearProfileEdit" ] ,
129
+ [ setEducationDialogVisibility , "setEducationDialogVisibility" ] ,
130
+ [ setEducationDialogIndex , "setEducationDialogIndex" ] ,
131
+ [ setEducationDegreeLevel , "setEducationDegreeLevel" ] ,
132
+ [ setUserPageDialogVisibility , "setUserPageDialogVisibility" ] ,
133
+ [ setShowEducationDeleteDialog , "setShowEducationDeleteDialog" ] ,
134
+ [ setShowWorkDeleteDialog , "setShowWorkDeleteDialog" ] ,
135
+ [ setDeletionIndex , "setDeletionIndex" ] ,
136
+ [ setShowWorkDeleteAllDialog , "setShowWorkDeleteAllDialog" ] ,
137
+ [ setShowEducationDeleteAllDialog , "setShowEducationDeleteAllDialog" ] ,
138
+ ] . map ( ( [ actionCreator , actionCreatorName ] ) => (
139
+ { [ actionCreatorName ] : this . createActionHelper ( actionCreator ) }
140
+ ) ) ;
141
+
180
142
profileProps: Function = ( profileFromStore : ProfileGetResult ) => {
181
143
let { ui } = this . props ;
182
144
let errors , isEdit , profile ;
@@ -204,21 +166,9 @@ class ProfileFormContainer extends React.Component {
204
166
updateProfile : this . updateProfile . bind ( this , isEdit ) ,
205
167
saveProfile : this . saveProfile . bind ( this , isEdit ) ,
206
168
setWorkHistoryEdit : this . setWorkHistoryEdit ,
207
- setWorkDialogVisibility : this . setWorkDialogVisibility ,
208
- setWorkDialogIndex : this . setWorkDialogIndex ,
209
- clearProfileEdit : this . clearProfileEdit ,
210
- setEducationDialogVisibility : this . setEducationDialogVisibility ,
211
- setEducationDialogIndex : this . setEducationDialogIndex ,
212
- setEducationDegreeLevel : this . setEducationDegreeLevel ,
213
169
setEducationDegreeInclusions : this . setEducationDegreeInclusions ,
214
170
fetchProfile : this . fetchProfile ,
215
- setUserPageDialogVisibility : this . setUserPageDialogVisibility ,
216
- setShowEducationDeleteDialog : this . setShowEducationDeleteDialog ,
217
- setShowWorkDeleteDialog : this . setShowWorkDeleteDialog ,
218
- setDeletionIndex : this . setDeletionIndex ,
219
- setShowWorkDeleteAllDialog : this . setShowWorkDeleteAllDialog ,
220
- setShowEducationDeleteAllDialog : this . setShowEducationDeleteAllDialog
221
- } ) ;
171
+ } , ...this . simpleActionHelpers ( ) ) ;
222
172
} ;
223
173
224
174
childrenWithProps: Function = ( profileFromStore : ProfileGetResult ) => {
0 commit comments