File tree 3 files changed +18
-13
lines changed
3 files changed +18
-13
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ PostEditorController.$inject = [
22
22
'$filter' ,
23
23
'$location' ,
24
24
'$translate' ,
25
+ '$timeout' ,
25
26
'moment' ,
26
27
'PostEntity' ,
27
28
'PostEndpoint' ,
@@ -43,6 +44,7 @@ function PostEditorController(
43
44
$filter ,
44
45
$location ,
45
46
$translate ,
47
+ $timeout ,
46
48
moment ,
47
49
postEntity ,
48
50
PostEndpoint ,
@@ -87,11 +89,14 @@ function PostEditorController(
87
89
$scope . post . form = $scope . form ;
88
90
$scope . fetchAttributesAndTasks ( $scope . post . form . id )
89
91
. then ( function ( ) {
90
- // If the post in marked as 'Published' but it is not in
91
- // a valid state to be saved as 'Published' warn the user
92
- if ( $scope . post . status === 'published' && ! canSavePost ( ) ) {
93
- Notify . error ( 'post.valid.invalid_state' ) ;
94
- }
92
+ // Use $timeout to delay this check till after form fields are rendered.
93
+ $timeout ( ( ) => {
94
+ // If the post in marked as 'Published' but it is not in
95
+ // a valid state to be saved as 'Published' warn the user
96
+ if ( $scope . post . status === 'published' && ! canSavePost ( ) ) {
97
+ Notify . error ( 'post.valid.invalid_state' ) ;
98
+ }
99
+ } ) ;
95
100
} ) ;
96
101
97
102
$scope . medias = { } ;
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ <h1 class="mode-context-title">{{post.form.name}}</h1>
107
107
<!-- End post stage default fields -->
108
108
109
109
<!-- Start Post custom fields -->
110
-
110
+
111
111
< post-value-edit
112
112
ng-repeat ="attribute in tasks[0].attributes | orderBy: 'priority' as filtered_result track by attribute.id "
113
113
post ="post "
Original file line number Diff line number Diff line change 201
201
202
202
<!-- type: categories -->
203
203
< div ng-switch-when ="tags ">
204
- < div
204
+ < div
205
205
class ="form-field checkbox "
206
206
ng-repeat ="option in attribute.options "
207
207
ng-if ="option.parent_id === null "
208
208
>
209
209
< label >
210
- < input
210
+ < input
211
211
type ="checkbox "
212
212
checklist-model ="post.values[attribute.key] "
213
- name ="values_{{attribute.id}}_{{option}} "
213
+ name ="values_{{attribute.id}}_{{option.id }} "
214
214
checklist-value ="option.id "
215
215
value ="option.id "
216
216
ng-click ="selectParent(option, attribute.key) "
217
217
>
218
218
{{option.tag}}
219
219
</ label >
220
- < div
220
+ < div
221
221
class ="form-field checkbox "
222
222
ng-if ="option.children "
223
223
ng-repeat ="child in option.children "
224
224
>
225
225
< label >
226
- < input
226
+ < input
227
227
type ="checkbox "
228
228
checklist-model ="post.values[attribute.key] "
229
- name ="values_{{attribute.id}}_{{child}} "
229
+ name ="values_{{attribute.id}}_{{child.id }} "
230
230
checklist-value ="child.id "
231
231
value ="child.id "
232
232
ng-click ="selectChild(child, attribute.key) "
233
233
>
234
234
{{child.tag}}
235
235
</ label >
236
- </ div >
236
+ </ div >
237
237
</ div >
238
238
239
239
< add-category
You can’t perform that action at this time.
0 commit comments