@@ -70,21 +70,14 @@ export default class AlertEditor extends Component<Props> {
70
70
71
71
validateAndSave = ( ) => {
72
72
const { alert, saveAlert} = this . props
73
- const { affectedEntities, description , end, start, title} = alert
73
+ const { affectedEntities, end, start, title} = alert
74
74
const momentEnd = moment ( end )
75
75
const momentStart = moment ( start )
76
76
77
77
// alert title must not be blank nor just whitespace
78
78
if ( ! title . trim ( ) ) {
79
79
return window . alert ( 'You must specify an alert title' )
80
80
}
81
- // alert title/description must meet character limits (for display purposes)
82
- if ( title . length > ALERT_TITLE_CHAR_LIMIT ) {
83
- return window . alert ( `Alert title must be ${ ALERT_TITLE_CHAR_LIMIT } characters or less` )
84
- }
85
- if ( description && description . length > ALERT_DESCRIPTION_CHAR_LIMIT ) {
86
- return window . alert ( `Alert description must be ${ ALERT_DESCRIPTION_CHAR_LIMIT } characters or less` )
87
- }
88
81
if ( ! end || ! start || ! momentEnd . isValid ( ) || ! momentStart . isValid ( ) ) {
89
82
return window . alert ( 'Alert must have a valid start and end date' )
90
83
}
@@ -146,7 +139,14 @@ export default class AlertEditor extends Component<Props> {
146
139
const descriptionCharactersRemaining = alert . description
147
140
? ALERT_DESCRIPTION_CHAR_LIMIT - alert . description . length
148
141
: ALERT_DESCRIPTION_CHAR_LIMIT
149
- const canPublish = alert . affectedEntities . length &&
142
+ const titleCharacterCount = alert . title
143
+ ? alert . title . length
144
+ : 0
145
+ const descriptionCharactersCount = alert . description
146
+ ? alert . description . length
147
+ : 0
148
+ const canPublish =
149
+ alert . affectedEntities . length &&
150
150
checkEntitiesForFeeds ( alert . affectedEntities , publishableFeeds )
151
151
const canEdit = checkEntitiesForFeeds ( alert . affectedEntities , editableFeeds )
152
152
const editingIsDisabled = alert . published && ! canPublish ? true : ! canEdit
@@ -221,10 +221,17 @@ export default class AlertEditor extends Component<Props> {
221
221
: 'text-danger'
222
222
}
223
223
style = { { fontWeight : 400 } } >
224
- { titleCharactersRemaining }
224
+ { titleCharacterCount }
225
225
</ span >
226
226
< h5 style = { { margin : '0px' } } >
227
227
< small >
228
+ { titleCharacterCount > ALERT_TITLE_CHAR_LIMIT &&
229
+ (
230
+ < span className = 'text-danger' >
231
+ WARNING: Alert title longer than { ALERT_TITLE_CHAR_LIMIT } characters may get truncated in some dissemination channels. < br />
232
+ </ span >
233
+ )
234
+ }
228
235
Note: alert title serves as text for eTID alerts. Use
229
236
descriptive language so it can serve as a standalone
230
237
alert.
@@ -290,7 +297,7 @@ export default class AlertEditor extends Component<Props> {
290
297
</ Col >
291
298
</ Row >
292
299
< Row >
293
- < Col xs = { 12 } sm = { 6 } >
300
+ < Col xs = { 12 } >
294
301
< FormGroup controlId = 'formControlsDescription' >
295
302
< ControlLabel >
296
303
Description
@@ -302,18 +309,28 @@ export default class AlertEditor extends Component<Props> {
302
309
: 'text-danger'
303
310
}
304
311
style = { { fontWeight : 400 } } >
305
- { descriptionCharactersRemaining }
312
+ { descriptionCharactersCount }
306
313
</ span >
314
+ { descriptionCharactersCount > ALERT_DESCRIPTION_CHAR_LIMIT &&
315
+ (
316
+ < h5 style = { { margin : '0px' } } >
317
+ < small className = 'text-danger' >
318
+ WARNING: Alert description longer than { ALERT_DESCRIPTION_CHAR_LIMIT } characters may get truncated in some dissemination channels.
319
+ </ small >
320
+ </ h5 >
321
+ )
322
+ }
307
323
</ ControlLabel >
308
324
< FormControl
309
325
componentClass = 'textarea'
310
326
placeholder = 'Detailed description of alert...'
311
327
defaultValue = { alert . description }
312
328
name = 'description'
313
- onChange = { this . _onChange } />
329
+ onChange = { this . _onChange }
330
+ style = { { minHeight : '89px' } } />
314
331
</ FormGroup >
315
332
</ Col >
316
- < Col xs = { 12 } sm = { 6 } >
333
+ < Col xs = { 12 } >
317
334
< FormGroup controlId = 'formControlsURL' >
318
335
< ControlLabel > URL</ ControlLabel >
319
336
< FormControl
0 commit comments