+ toolBar={secondaryToolbarWidgets.length === 0 ? null : (
+
+
+ )}
+ headerPadding={{
+ top: 8,
+ bottom: state.profile.header.count() < 1 ? 8 : undefined,
+ }}
+ authoringHeader={(
+
+ {this.props.headerToolbar != null && (
+
+ )}
{
const ids = [
'categories',
+ 'default_categories',
+ 'languages',
'genre',
- 'locators',
- 'priority',
'urgency',
+ 'priority',
+ 'signal',
+ 'rightsinfo',
+ 'crop_sizes',
+ 'desk_types',
+ 'replace_words',
+ 'locators',
+ 'product_types',
+ 'annotation_types',
+ 'author_roles',
+ 'job_titles',
+ 'package-story-labels',
+ 'usageterms',
+ 'contact_mobile_usage',
+ 'contact_phone_usage',
+ 'countries',
+ 'regions',
+ 'type',
+ 'subscriber_types',
+ 'g2_content_type',
+ 'eventoccurstatus',
+ 'newscoveragestatus',
+ 'event_calendars',
+ 'assignment_priority',
+ 'camera',
+ 'custom-sorting',
];
for (const id of ids) {
@@ -36,6 +62,7 @@ describe('field adapters', () => {
return testVocabularies;
},
+ getCustomFieldVocabularies: () => [],
getVocabularyItemLabel: (term) => term.name,
};
diff --git a/scripts/apps/authoring-react/subcomponents/authoring-toolbar.tsx b/scripts/apps/authoring-react/subcomponents/authoring-toolbar.tsx
index ccdd8e4854..70eaa7b12d 100644
--- a/scripts/apps/authoring-react/subcomponents/authoring-toolbar.tsx
+++ b/scripts/apps/authoring-react/subcomponents/authoring-toolbar.tsx
@@ -3,24 +3,23 @@ import {ITopBarWidget} from 'superdesk-api';
interface IProps {
entity: T;
- coreWidgets?: Array>;
- extraWidgets?: Array>;
+ widgets?: Array>;
backgroundColor?: React.CSSProperties['backgroundColor'];
}
export class AuthoringToolbar extends React.PureComponent> {
render() {
- const topbarWidgets = (this.props.coreWidgets ?? []).concat(this.props.extraWidgets ?? []);
+ const {widgets} = this.props;
- const topbarWidgetsStart = topbarWidgets
+ const topbarWidgetsStart = widgets
.filter(({group}) => group === 'start')
.sort((a, b) => a.priority - b.priority);
- const topbarWidgetsMiddle = topbarWidgets
+ const topbarWidgetsMiddle = widgets
.filter(({group}) => group === 'middle')
.sort((a, b) => a.priority - b.priority);
- const topbarWidgetsEnd = topbarWidgets
+ const topbarWidgetsEnd = widgets
.filter(({group}) => group === 'end')
.sort((a, b) => a.priority - b.priority);
diff --git a/scripts/apps/authoring-react/subcomponents/created-modified-info.tsx b/scripts/apps/authoring-react/subcomponents/created-modified-info.tsx
index b63743c6a4..43539b2600 100644
--- a/scripts/apps/authoring-react/subcomponents/created-modified-info.tsx
+++ b/scripts/apps/authoring-react/subcomponents/created-modified-info.tsx
@@ -5,16 +5,15 @@ import {ModifiedInfo} from 'apps/authoring/authoring/modified-info';
interface IProps {
article: IArticle;
- reinitialize: () => void;
}
export class CreatedModifiedInfo extends React.PureComponent {
render() {
return (
-
+
-
+
);
}
diff --git a/scripts/apps/authoring/authoring/authoring-topbar-react.tsx b/scripts/apps/authoring/authoring/authoring-topbar-react.tsx
index 1d2ec72db0..3d64548765 100644
--- a/scripts/apps/authoring/authoring/authoring-topbar-react.tsx
+++ b/scripts/apps/authoring/authoring/authoring-topbar-react.tsx
@@ -84,7 +84,7 @@ export class AuthoringTopbarReact extends React.PureComponent {
return (
> = [CreatedInfo, ModifiedInfo];
+const getDefaultToolbarItems = (item: IArticle): Array> => [{
+ availableOffline: true,
+ component: () => (
+
+ ),
+ group: 'start',
+ priority: 1,
+}, {
+ availableOffline: true,
+ component: () => (
+
+ ),
+ group: 'start',
+ priority: 2,
+}];
interface IProps {
article: IArticle;
@@ -56,7 +77,7 @@ export class AuthoringTopbar2React extends React.PureComponent {
return null; // fetching article from the server
}
- const articleDisplayWidgets = defaultToolbarItems.concat(
+ const articleDisplayWidgets = getDefaultToolbarItems(this.props.article).concat(
flatMap(
Object.values(extensions),
(extension) => extension.activationResult?.contributions?.authoringTopbar2Widgets ?? [],
@@ -67,19 +88,10 @@ export class AuthoringTopbar2React extends React.PureComponent {
const articleUpdatedReference = {...this.props.article};
return (
-
- {articleDisplayWidgets.map(
- (Component, i) => (
-
-
-
- ),
- )}
-
+
);
}
}
diff --git a/scripts/apps/authoring/authoring/created-info.tsx b/scripts/apps/authoring/authoring/created-info.tsx
index fd89b287da..d5399d1ebc 100644
--- a/scripts/apps/authoring/authoring/created-info.tsx
+++ b/scripts/apps/authoring/authoring/created-info.tsx
@@ -5,7 +5,7 @@ import {TimeElem} from 'apps/search/components/TimeElem';
import {dataApi} from 'core/helpers/CrudManager';
interface IProps {
- article: IArticle;
+ entity: IArticle;
}
interface IState {
@@ -27,7 +27,7 @@ export class CreatedInfo extends React.PureComponent {
componentDidMount() {
this._mounted = true;
- dataApi.findOne('users', this.props.article.original_creator).then((user) => {
+ dataApi.findOne('users', this.props.entity.original_creator).then((user) => {
if (this._mounted) {
this.setState({user});
}
@@ -37,7 +37,7 @@ export class CreatedInfo extends React.PureComponent {
this._mounted = false;
}
render() {
- const {article} = this.props;
+ const {entity} = this.props;
const {user} = this.state;
if (user == null) {
@@ -48,7 +48,7 @@ export class CreatedInfo extends React.PureComponent {
- {gettext('Created')}
{' '}
-
+
{' '}
- {gettext('by')}
{' '}
diff --git a/scripts/apps/authoring/authoring/modified-info.tsx b/scripts/apps/authoring/authoring/modified-info.tsx
index 9a095a5a39..e9ba87e194 100644
--- a/scripts/apps/authoring/authoring/modified-info.tsx
+++ b/scripts/apps/authoring/authoring/modified-info.tsx
@@ -4,14 +4,14 @@ import {gettext} from 'core/utils';
import {TimeElem} from 'apps/search/components/TimeElem';
interface IProps {
- article: IArticle;
+ entity: IArticle;
}
export class ModifiedInfo extends React.PureComponent {
render() {
- const {article} = this.props;
+ const {entity} = this.props;
- if (article.versioncreated == null) {
+ if (entity.versioncreated == null) {
return null;
}
@@ -19,7 +19,7 @@ export class ModifiedInfo extends React.PureComponent {
- {gettext('Modified')}
{' '}
-
+
);
}
diff --git a/scripts/apps/authoring/tests/authoring.spec.ts b/scripts/apps/authoring/tests/authoring.spec.ts
index 8971537ff5..95d7fc6e41 100644
--- a/scripts/apps/authoring/tests/authoring.spec.ts
+++ b/scripts/apps/authoring/tests/authoring.spec.ts
@@ -1857,8 +1857,9 @@ describe('authoring container directive', () => {
}));
describe('authoring embed directive', () => {
- beforeEach(inject(($templateCache) => {
+ beforeEach(inject(($templateCache, preferencesService) => {
$templateCache.put('scripts/apps/authoring/views/authoring.html', '');
+ spyOn(preferencesService, 'getSync').and.returnValue(null);
}));
it('applies kill template',
diff --git a/scripts/apps/dictionaries/views/settings.html b/scripts/apps/dictionaries/views/settings.html
index 8eea373caf..65ba04fdb8 100644
--- a/scripts/apps/dictionaries/views/settings.html
+++ b/scripts/apps/dictionaries/views/settings.html
@@ -5,10 +5,10 @@ Dictionary management
-
+
-
diff --git a/scripts/apps/ingest/views/dashboard/dashboard.html b/scripts/apps/ingest/views/dashboard/dashboard.html
index 9d14f68ec1..c5854105dd 100644
--- a/scripts/apps/ingest/views/dashboard/dashboard.html
+++ b/scripts/apps/ingest/views/dashboard/dashboard.html
@@ -11,4 +11,4 @@
Ingest Dashboard
\ No newline at end of file
+
diff --git a/scripts/apps/search/components/ListItemInfo.tsx b/scripts/apps/search/components/ListItemInfo.tsx
index a8599928ff..660491d822 100644
--- a/scripts/apps/search/components/ListItemInfo.tsx
+++ b/scripts/apps/search/components/ListItemInfo.tsx
@@ -76,11 +76,9 @@ export class ListItemInfo extends React.PureComponent {
{
articleDisplayWidgets.length < 1 ? null : (
- {
- articleDisplayWidgets.map((Component, i) =>
- ,
- )
- }
+ {articleDisplayWidgets.map((Component, i) =>
+ ,
+ )}
)
}
diff --git a/scripts/apps/search/components/PhotoDeskInfo.tsx b/scripts/apps/search/components/PhotoDeskInfo.tsx
index d728aba908..158651396b 100644
--- a/scripts/apps/search/components/PhotoDeskInfo.tsx
+++ b/scripts/apps/search/components/PhotoDeskInfo.tsx
@@ -45,7 +45,7 @@ export const PhotoDeskInfo: React.StatelessComponent = (props) => {
{
articleDisplayWidgets.map((Component, i) =>
- ,
+ ,
)
}
diff --git a/scripts/core/superdesk-api.d.ts b/scripts/core/superdesk-api.d.ts
index 5db1c728d8..05a9e7db57 100644
--- a/scripts/core/superdesk-api.d.ts
+++ b/scripts/core/superdesk-api.d.ts
@@ -147,6 +147,9 @@ declare module 'superdesk-api' {
* we are passing a function instead.
*/
getLatestItem(options?: {preferIncomplete?: IStoreValueIncomplete}): T;
+ toggleTheme: () => void;
+ printPreview: () => void;
+ configureTheme: () => void;
toggleSideWidget(id: string | null): void;
contentProfile: IContentProfileV2;
fieldsData: IFieldsData;
@@ -161,7 +164,7 @@ declare module 'superdesk-api' {
initiateClosing(): void;
keepChangesAndClose(): void;
stealLock(): void;
- reinitialize: (item: T, profile?: IContentProfileV2) => void;
+ reinitialize(item: T, profile?: IContentProfileV2): void;
addValidationErrors(validationErrors: IAuthoringValidationErrors): void;
}
@@ -188,8 +191,6 @@ declare module 'superdesk-api' {
*/
resourceNames: Array;
- // Hides the toolbar which includes the "Print Preview" button.
- hideSecondaryToolbar?: boolean;
getLanguage(entity: T): string;
onClose(): void;
authoringStorage: IAuthoringStorage;
@@ -197,9 +198,10 @@ declare module 'superdesk-api' {
fieldsAdapter: IFieldsAdapter;
getActions?(options: IExposedFromAuthoring): Array; // three dots menu actions
getInlineToolbarActions?(options: IExposedFromAuthoring): IAuthoringOptions;
- getAuthoringPrimaryToolbarWidgets?(
- options: IExposedFromAuthoring,
- ): Array>;
+
+ getAuthoringPrimaryToolbarWidgets?(options: IExposedFromAuthoring): Array>;
+ getSecondaryToolbarWidgets?: (exposed: IExposedFromAuthoring) => Array>;
+
onEditingStart?(item: T): void;
onEditingEnd?(item: T): void;
@@ -211,10 +213,6 @@ declare module 'superdesk-api' {
// used for side widgets
getSidePanel?(options: IExposedFromAuthoring, readOnly: boolean): React.ReactNode;
- secondaryToolbarWidgets: Array>;
headerToolbar?: (options: IExposedFromAuthoring) => Array>;
@@ -238,11 +236,7 @@ declare module 'superdesk-api' {
): IFieldsData;
validateBeforeSaving?: boolean; // will block saving if invalid. defaults to true
-
headerCollapsed?: boolean; // initial value
-
- themingEnabled?: boolean; // only works with article; default false
-
autoFocus?: boolean; // defaults to true; will focus first input
}
@@ -759,26 +753,18 @@ declare module 'superdesk-api' {
editor3?: {
annotationInputTabs?: Array;
}
- articleListItemWidgets?: Array>;
- articleGridItemWidgets?: Array>;
+ articleListItemWidgets?: Array['component']>;
+ articleGridItemWidgets?: Array['component']>;
/**
- * Display custom components at the top of authoring panel
+ * First toolbar of authoring panel
*/
- authoringTopbarWidgets?: Array<{
- component: React.ComponentType<{article: IArticle}>;
- availableOffline: boolean;
- priority: IDisplayPriority;
- group: 'start' | 'middle' | 'end';
- }>;
+ authoringTopbarWidgets?: Array>;
/**
- * Display custom components in the second toolbar in authoring panel
+ * Second toolbar of authoring panel
*/
- authoringTopbar2Widgets?: Array void;
- }>>;
+ authoringTopbar2Widgets?: Array>;
authoringSideWidgets?: Array;
diff --git a/scripts/extensions/broadcasting/src/rundown-templates/template-edit.tsx b/scripts/extensions/broadcasting/src/rundown-templates/template-edit.tsx
index 377f9de1c9..7bcaf7a146 100644
--- a/scripts/extensions/broadcasting/src/rundown-templates/template-edit.tsx
+++ b/scripts/extensions/broadcasting/src/rundown-templates/template-edit.tsx
@@ -600,7 +600,6 @@ export class RundownTemplateViewEdit extends React.PureComponent
}}
getSideWidgetIdAtIndex={() => ''}
getAuthoringPrimaryToolbarWidgets={() => []}
- secondaryToolbarWidgets={[]}
disableWidgetPinning
/>
)
diff --git a/scripts/extensions/broadcasting/src/rundowns/rundown-view-edit.tsx b/scripts/extensions/broadcasting/src/rundowns/rundown-view-edit.tsx
index 8d8ebd4967..03b74eba49 100644
--- a/scripts/extensions/broadcasting/src/rundowns/rundown-view-edit.tsx
+++ b/scripts/extensions/broadcasting/src/rundowns/rundown-view-edit.tsx
@@ -665,7 +665,6 @@ export class RundownViewEditComponent extends React.PureComponent []}
- secondaryToolbarWidgets={[]}
getSidebarWidgetsCount={({item}) => {
return getAvailableSideWidgets(item).length;
}}
diff --git a/scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx b/scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx
index 173165d616..e63608d6a2 100644
--- a/scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx
+++ b/scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx
@@ -306,9 +306,7 @@ export class RundownsList extends React.PureComponent {
};
return (
-
+
{
+ return class DisplayMarkedUser extends React.PureComponent<{entity: IArticle}> {
render() {
- if (this.props.article.marked_for_user == null) {
+ if (this.props.entity.marked_for_user == null) {
return null;
} else {
return (
);
}