Skip to content

Commit

Permalink
Rework
Browse files Browse the repository at this point in the history
  • Loading branch information
thecalcc committed Dec 4, 2024
1 parent 820cbb5 commit ba00534
Showing 1 changed file with 17 additions and 48 deletions.
65 changes: 17 additions & 48 deletions client/components/planning-editor-standalone/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {OrderedMap} from 'immutable';

import {
IAuthoringFieldV2,
ICommonFieldConfig,
IContentProfileV2,
IDateTimeFieldConfig,
IDropdownConfigVocabulary,
Expand Down Expand Up @@ -40,41 +39,6 @@ function getTextFieldConfig(options: {id: string; label: string, required: boole
return field;
}

// function getVocabularyRemoteSourceConfig(options: {id: string; label: string, required: boolean}): IAuthoringFieldV2 {
// const config: IDropdownConfig = {
// source: 'remote-source',
// getId: (item: ILocation) => item._id,
// getLabel: (item: ILocation) => item.name,
// multiple: false,
// searchOptions: (
// searchTerm,
// language,
// callback,
// ) => {
// return planningApi.locations.searchExternal(searchTerm, language).then((x) => {
// const tree: ITreeWithLookup<Partial<ILocation>> = {
// nodes: x.map((location) => ({value: location})),
// lookup: {},
// };

// callback(tree);
// });
// },
// };

// const field: IAuthoringFieldV2 = {
// id: options.id,
// name: options.label,
// fieldType: 'dropdown',
// fieldConfig: {
// ...config,
// required: options.required,
// },
// };

// return field;
// }

function getDateTimeField(options: {id: string; label: string, required: boolean}): IAuthoringFieldV2 {
const config: IDateTimeFieldConfig = {
allowSeconds: false,
Expand Down Expand Up @@ -139,6 +103,11 @@ export function getFieldDefinitions(): IFieldDefinitions {
getField: ({required, id}) => getTextFieldConfig({id: id, label: gettext('Headline'), required: required}),
});

result.push({
fieldId: 'planning_date',
getField: ({required, id}) => getDateTimeField({id: id, label: gettext('Planning date'), required: required}),
});

result.push({
fieldId: 'files',
getField: ({required, id}) => {
Expand Down Expand Up @@ -336,18 +305,18 @@ export function getProfile() {
// fieldConfig: categoryFieldConfig,
// };

// profileV2.header = profileV2.header.set(categoryField.id, categoryField);
// }
else {
skipped.push(fieldId);
}
}
// profileV2.header = profileV2.header.set(categoryField.id, categoryField);
// }
// else {
// skipped.push(fieldId);
// }
// }

profileV2.header.forEach((item) => {
item.fieldConfig.width = 100;
});
// profileV2.header.forEach((item) => {
// item.fieldConfig.width = 100;
// });

console.log('skipped -------------------------------- ', skipped, superdeskApi.entities.vocabulary.getAll());
// console.log('skipped -------------------------------- ', skipped, superdeskApi.entities.vocabulary.getAll());

return profileV2;
}
// return profileV2;
// }

0 comments on commit ba00534

Please sign in to comment.