Skip to content

Commit

Permalink
imrpvoe panels config
Browse files Browse the repository at this point in the history
  • Loading branch information
dzonidoo committed Dec 12, 2024
1 parent 89997bd commit 597525e
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 26 deletions.
36 changes: 28 additions & 8 deletions scripts/appConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,34 @@ if (appConfig.shortTimeFormat == null) {
appConfig.shortTimeFormat = 'HH:mm'; // 24h format
}

if (appConfig.ui == null) {
appConfig.ui = {};
}

if (appConfig.ui.sendEmbargo == null) {
appConfig.ui.sendEmbargo = false;
}

if (appConfig.ui.italicAbstract == null) {
appConfig.ui.italicAbstract = true;
}

if (appConfig.authoring == null) {
appConfig.authoring = {};
}

if (appConfig.authoring.panels == null) {
appConfig.authoring.panels = {};
}

if (appConfig.authoring.panels.sendTo == null) {
appConfig.authoring.panels.sendTo = {};
}

if (appConfig.authoring.panels.sendTo.publishSchedule == null) {
appConfig.authoring.panels.sendTo.publishSchedule = false;
}

const defaultDateFormat = 'MM/DD';
const defaultTimeFormat = 'hh:mm';

Expand All @@ -34,14 +62,6 @@ if (appConfig.longDateFormat == null) {
appConfig.longDateFormat = 'LLL';
}

if (appConfig.ui == null) {
appConfig.ui = {};

if (appConfig.ui.italicAbstract == null) {
appConfig.ui.italicAbstract = true;
}
}

if (appConfig.features == null) {
appConfig.features = {};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,25 +224,30 @@ export class WithPublishTab extends React.PureComponent<IProps, IState> {
);
}}
allowSettingEmbargo={appConfig.ui.publishEmbargo !== false}
allowSettingPublishSchedule={
appConfig.authoring.panels.publish.publishSchedule !== false
}
/>

<PublishingTargetSelect
value={this.state.publishingTarget}
onChange={(val) => {
this.setState(
{publishingTarget: val},
() => {
this.props.onDataChange?.({
...this.props.item,
...getPublishingTargetPatch(
this.props.item,
this.state.publishingTarget,
),
});
},
);
}}
/>
{appConfig.authoring.panels.publish.publishingTarget !== false && (
<PublishingTargetSelect
value={this.state.publishingTarget}
onChange={(val) => {
this.setState(
{publishingTarget: val},
() => {
this.props.onDataChange?.({
...this.props.item,
...getPublishingTargetPatch(
this.props.item,
this.state.publishingTarget,
),
});
},
);
}}
/>
)}
</div>

{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export class SendToTab extends React.PureComponent<IProps, IState> {
this.setState({publishingDateOptions: val});
}}
allowSettingEmbargo={appConfig.ui.sendEmbargo !== false}
allowSettingPublishSchedule={appConfig.authoring.panels.sendTo.publishSchedule}
/>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ interface IProps {
value: IPublishingDateOptions;
onChange(value: IPublishingDateOptions): void;
allowSettingEmbargo: boolean;
allowSettingPublishSchedule?: boolean;
}

export class PublishingDateOptions extends React.PureComponent<IProps> {
Expand All @@ -76,7 +77,7 @@ export class PublishingDateOptions extends React.PureComponent<IProps> {
&& this.props.allowSettingEmbargo
&& sdApi.user.hasPrivilege('embargo');

const canSetPublishSchedule = embargo == null;
const canSetPublishSchedule = embargo == null && this.props.allowSettingPublishSchedule;

return (
<div>
Expand Down
10 changes: 10 additions & 0 deletions scripts/core/superdesk-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3410,6 +3410,16 @@ declare module 'superdesk-api' {
preview?: {
hideContentLabels: boolean;
};

panels?: {
publish?: {
publishSchedule?: boolean
publishingTarget?: boolean;
}
sendTo?: {
publishSchedule?: boolean;
}
}
};
ui: {
/**
Expand Down

0 comments on commit 597525e

Please sign in to comment.