Skip to content

Commit

Permalink
Merge pull request #787 from lblod/feat/config-per-admin-unit
Browse files Browse the repository at this point in the history
Add configuration per administrative unit
  • Loading branch information
lagartoverde authored Dec 9, 2024
2 parents 3f46731 + a89d1a0 commit 3ad947f
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/eight-ravens-allow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'frontend-gelinkt-notuleren': minor
---

Add configuration per administrative unit
16 changes: 16 additions & 0 deletions app/config/configuration-per-admin-unit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { ADMINISTRATIVE_UNIT_URIS } from './constants';

export default {
[ADMINISTRATIVE_UNIT_URIS.GEMEENTE_GENT]: {
structure: {
fullLengthArticles: true,
onlyArticleSpecialName: false,
},
},
[ADMINISTRATIVE_UNIT_URIS.OCMW_GENT]: {
structure: {
fullLengthArticles: true,
onlyArticleSpecialName: false,
},
},
};
7 changes: 7 additions & 0 deletions app/config/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,10 @@ export const IV_CLASSIFICATIE_MAP = {
[BESTUURSEENHEID_CLASSIFICATIE_CODES.OCMW]:
BESTUURSORGAAN_CLASSIFICATIE_CODES.OCMW_RAAD,
};

export const ADMINISTRATIVE_UNIT_URIS = {
GEMEENTE_GENT:
'http://data.lblod.info/id/bestuurseenheden/353234a365664e581db5c2f7cc07add2534b47b8e1ab87c821fc6e6365e6bef5',
OCMW_GENT:
'http://data.lblod.info/id/bestuurseenheden/c5623baf3970c5efa9746dff01afd43092c1321a47316dbe81ed79604b56e8ea',
};
14 changes: 10 additions & 4 deletions app/services/editor/agendapoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ import {
OCMW,
} from '../../utils/bestuurseenheid-classificatie-codes';
import {
structure,
structureView,
structureWithConfig,
structureViewWithConfig,
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/structure-plugin/node';
import {
inlineRdfaWithConfig,
Expand Down Expand Up @@ -120,6 +120,7 @@ import { htmlToDoc } from '@lblod/ember-rdfa-editor/utils/_private/html-utils';
import { citationPlugin } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin';
import { isRdfaAttrs } from '@lblod/ember-rdfa-editor/core/schema';
import { BESLUIT } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
import configurationPerAdminUnit from '../../config/configuration-per-admin-unit';

export default class AgendapointEditorService extends Service {
@service intl;
Expand Down Expand Up @@ -218,6 +219,7 @@ export default class AgendapointEditorService extends Service {
insertArticle: {
uriGenerator: () => `http://data.lblod.info/artikels/${uuidv4()}`,
},
...this.adminUnitConfig,
};
}

Expand All @@ -231,6 +233,10 @@ export default class AgendapointEditorService extends Service {
}
}

get adminUnitConfig() {
return configurationPerAdminUnit[this.defaultMunicipality.uri] || {};
}

get codelistEditOptions() {
return {
endpoint: ENV.fallbackCodelistEndpoint,
Expand Down Expand Up @@ -265,7 +271,7 @@ export default class AgendapointEditorService extends Service {
controller,
),
snippet: snippetView(this.config.snippet)(controller),
structure: structureView(controller),
structure: structureViewWithConfig(this.config.structure)(controller),
mandatee_table: mandateeTableView(controller),
person_variable: personVariableView(controller),
autofilled_variable: autofilledVariableView(controller),
Expand All @@ -284,7 +290,7 @@ export default class AgendapointEditorService extends Service {
doc: docWithConfig({ rdfaAware: true }),
paragraph,
repaired_block: repairedBlockWithConfig({ rdfaAware: true }),
structure,
structure: structureWithConfig(this.config.structure),
list_item: listItemWithConfig({ enableHierarchicalList: true }),
ordered_list: orderedListWithConfig({ enableHierarchicalList: true }),
bullet_list: bulletListWithConfig({ enableHierarchicalList: true }),
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"@lblod/ember-environment-banner": "^0.5.0",
"@lblod/ember-mock-login": "^0.10.0",
"@lblod/ember-rdfa-editor": "10.9.0",
"@lblod/ember-rdfa-editor-lblod-plugins": "26.0.2",
"@lblod/ember-rdfa-editor-lblod-plugins": "26.1.0",
"@lblod/template-uuid-instantiator": "^1.0.3",
"@release-it-plugins/lerna-changelog": "^6.0.0",
"@tsconfig/ember": "^3.0.8",
Expand Down

0 comments on commit 3ad947f

Please sign in to comment.