Skip to content

Commit

Permalink
Reformated error message
Browse files Browse the repository at this point in the history
  • Loading branch information
grafitto committed Feb 11, 2022
1 parent 7b28485 commit 17702ef
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/react/Settings/components/CollectionSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const CollectionSettings = ({
register('newNameGeneration');
register('ocrServiceEnabled');
register('home_page', {
validate: (val: string) => validateHomePageRoute(val) || 'Invalid route',
validate: (val: string) => validateHomePageRoute(val) || val === '',
});

const save = async (newCollectionSettings: Settings) => {
Expand Down Expand Up @@ -112,15 +112,17 @@ const CollectionSettings = ({
setValue('home_page', '');
}}
>
<div className="input-group">
<div className={`input-group ${errors.home_page ? 'has-error' : ''}`}>
<span className="input-group-addon" id="basic-addon1">
<Translate>https://yourdomain</Translate>
</span>
<input type="text" className="form-control" name="home_page" ref={register} />
</div>
<div className="has-error">
{errors.home_page && <div style={{ color: '#D9534F' }}>Invalid home page url</div>}
</div>
</ToggleChildren>
</SettingsFormElement>
{errors.home_page && <p className="alert alert-danger">Invalid home page url value</p>}
<SettingsFormElement label="Default view">
<div className="col-xs-12 col-lg-3 col-no-gutters">
<select name="defaultLibraryView" className="form-control" ref={register}>
Expand Down

0 comments on commit 17702ef

Please sign in to comment.