Skip to content

Commit

Permalink
Rework boolean field
Browse files Browse the repository at this point in the history
  • Loading branch information
thecalcc committed Dec 17, 2024
1 parent 7d4f943 commit 7ae520a
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 1,580 deletions.
23 changes: 23 additions & 0 deletions scripts/apps/authoring-react/fields/boolean/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import {
ICommonFieldConfig,
ICustomFieldType,
} from 'superdesk-api';
import {gettext} from 'core/utils';
import {Editor} from './editor';
import {IUserPreferences, IValueOperational, IValueStorage} from './interfaces';
import {Preview} from './preview';

type IBooleanField = ICustomFieldType<IValueOperational, IValueStorage, ICommonFieldConfig, IUserPreferences>;

export const getBooleanField = (): IBooleanField => {
return {
id: 'boolean',
generic: true,
label: gettext('Boolean'),
editorComponent: Editor,
previewComponent: Preview,
hasValue: (val) => val != null,
getEmptyValue: () => null,
};
};

2 changes: 2 additions & 0 deletions scripts/apps/authoring-react/fields/register-fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {getArticlesInPackageField} from './package-items';
import {getTagInputField} from './tag-input';
import {getDatelineField} from './dateline';
import {getDatetimeField} from './datetime';
import {getBooleanField} from './boolean';

export const AUTHORING_REACT_FIELDS = 'authoring-react--fields';

Expand Down Expand Up @@ -57,6 +58,7 @@ export function registerAuthoringReactFields() {
getArticlesInPackageField(),
getTagInputField(),
getDatelineField(),
getBooleanField(),
],
},
};
Expand Down
1 change: 0 additions & 1 deletion scripts/extensions/booleanField/.gitignore

This file was deleted.

Loading

0 comments on commit 7ae520a

Please sign in to comment.