@lblod/ember-rdfa-editor-lblod-plugins 16.3.0 → 16.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/addon/components/citation-plugin/citation-card.hbs +1 -1
- package/addon/components/citation-plugin/citations/article-list.hbs +2 -2
- package/addon/components/citation-plugin/citations/legal-document-detail.hbs +2 -2
- package/addon/components/citation-plugin/citations/legal-document-list.hbs +2 -2
- package/addon/components/citation-plugin/citations/search-modal.hbs +4 -6
- package/addon/components/{snippet-plugin/helpers → common/search}/alert-load-error.hbs +6 -5
- package/addon/components/common/search/alert-no-items.hbs +9 -0
- package/addon/components/common/search/loading.hbs +4 -0
- package/addon/components/snippet-plugin/search-modal.hbs +4 -6
- package/addon/components/snippet-plugin/snippet-list/snippet-list-modal.hbs +3 -6
- package/addon/components/worship-plugin/administrative-unit-picker.hbs +15 -0
- package/addon/components/worship-plugin/administrative-unit-picker.ts +38 -0
- package/addon/components/worship-plugin/insert.hbs +17 -0
- package/addon/components/worship-plugin/insert.ts +38 -0
- package/addon/components/worship-plugin/list.hbs +46 -0
- package/addon/components/worship-plugin/search-modal.hbs +78 -0
- package/addon/components/worship-plugin/search-modal.ts +129 -0
- package/addon/components/worship-plugin/sortable-table-header.hbs +35 -0
- package/addon/components/worship-plugin/sortable-table-header.ts +38 -0
- package/addon/plugins/snippet-plugin/utils/fetch-data.ts +1 -3
- package/addon/plugins/worship-plugin/index.ts +9 -0
- package/addon/plugins/worship-plugin/utils/fetchAdministrativeUnits.ts +52 -0
- package/addon/plugins/worship-plugin/utils/fetchWorshipServices.ts +109 -0
- package/addon/plugins/worship-plugin/utils/insertWorshipService.ts +16 -0
- package/addon/utils/sparql-helpers.ts +8 -0
- package/app/components/{citation-plugin/helpers/alert-no-items.js → common/search/alert-load-error.js} +1 -1
- package/app/components/{snippet-plugin/helpers → common/search}/alert-no-items.js +1 -1
- package/app/components/{snippet-plugin/helpers/alert-load-error.js → common/search/loading.js} +1 -1
- package/app/components/worship-plugin/administrative-unit-picker.js +1 -0
- package/app/components/{citation-plugin/helpers/alert-load-error.js → worship-plugin/insert.js} +1 -1
- package/app/components/worship-plugin/list.js +1 -0
- package/app/components/worship-plugin/search-modal.js +1 -0
- package/app/components/worship-plugin/sortable-table-header.js +1 -0
- package/app/styles/citaten-plugin.scss +1 -1
- package/app/styles/snippet-plugin.scss +1 -1
- package/app/styles/worship-plugin.scss +19 -0
- package/components/worship-plugin/administrative-unit-picker.d.ts +12 -0
- package/components/worship-plugin/insert.d.ts +16 -0
- package/components/worship-plugin/search-modal.d.ts +30 -0
- package/components/worship-plugin/sortable-table-header.d.ts +13 -0
- package/package.json +1 -1
- package/plugins/worship-plugin/index.d.ts +8 -0
- package/plugins/worship-plugin/utils/fetchAdministrativeUnits.d.ts +7 -0
- package/plugins/worship-plugin/utils/fetchWorshipServices.d.ts +23 -0
- package/plugins/worship-plugin/utils/insertWorshipService.d.ts +3 -0
- package/translations/en-US.yaml +27 -12
- package/translations/nl-BE.yaml +27 -12
- package/utils/sparql-helpers.d.ts +4 -0
- package/addon/components/citation-plugin/helpers/alert-load-error.hbs +0 -21
- package/addon/components/citation-plugin/helpers/alert-no-items.hbs +0 -10
- package/addon/components/snippet-plugin/helpers/alert-no-items.hbs +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @lblod/ember-rdfa-editor-lblod-plugins
|
|
2
2
|
|
|
3
|
+
## 16.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#404](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/404) [`9382c7f`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/9382c7f3e1c0e9495e2d9a7c21a58505653693b4) Thanks [@piemonkey](https://github.com/piemonkey)! - Add plugin to handle inserting worship services (erediensten)
|
|
8
|
+
|
|
3
9
|
## 16.3.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
</div>
|
|
48
48
|
{{else}}
|
|
49
49
|
{{#if this.error}}
|
|
50
|
-
<
|
|
50
|
+
<Common::Search::AlertLoadError @fullSize={{true}} @error={{this.error}} class="au-o-box"/>
|
|
51
51
|
{{else}}
|
|
52
52
|
<CitationPlugin::Citations::ArticleList
|
|
53
53
|
@insertArticleCitation={{fn @insertArticleCitation @legalDocument}}
|
|
@@ -110,4 +110,4 @@
|
|
|
110
110
|
</AuToolbar>
|
|
111
111
|
</div>
|
|
112
112
|
</div>
|
|
113
|
-
</div>
|
|
113
|
+
</div>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<AuModal
|
|
2
|
+
class="citaten-modal"
|
|
2
3
|
@modalOpen={{@open}}
|
|
3
4
|
@closeModal={{fn this.closeModal this.legislationTypeUri this.text}}
|
|
4
5
|
@title={{t 'citaten-plugin.card.title'}}
|
|
@@ -197,14 +198,11 @@
|
|
|
197
198
|
<mc.content>
|
|
198
199
|
{{#if this.legalDocumentResource.isRunning}}
|
|
199
200
|
<div class='au-u-margin'>
|
|
200
|
-
<
|
|
201
|
-
<span class='au-u-hidden-visually'>{{t
|
|
202
|
-
'citaten-plugin.alert.loading'
|
|
203
|
-
}}</span>
|
|
201
|
+
<Common::Search::Loading />
|
|
204
202
|
</div>
|
|
205
203
|
{{else}}
|
|
206
204
|
{{#if this.error}}
|
|
207
|
-
<
|
|
205
|
+
<Common::Search::AlertLoadError
|
|
208
206
|
@fullSize={{true}}
|
|
209
207
|
@error={{this.error}}
|
|
210
208
|
class='au-u-margin'
|
|
@@ -222,7 +220,7 @@
|
|
|
222
220
|
/>
|
|
223
221
|
</div>
|
|
224
222
|
{{else}}
|
|
225
|
-
<
|
|
223
|
+
<Common::Search::AlertNoItems
|
|
226
224
|
@fullSize={{true}}
|
|
227
225
|
class='au-u-margin'
|
|
228
226
|
/>
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
<AuAlert
|
|
2
|
-
@title=
|
|
2
|
+
@title={{t 'common.search.error-title'}}
|
|
3
3
|
@skin='error'
|
|
4
4
|
@icon='alert-triangle'
|
|
5
5
|
@closable={{false}}
|
|
6
|
-
|
|
6
|
+
@size={{if @fullSize 'default' 'small'}}
|
|
7
|
+
class='au-u-margin'
|
|
7
8
|
...attributes
|
|
8
9
|
>
|
|
9
|
-
<p>{{t '
|
|
10
|
-
<code class='au-u-error
|
|
10
|
+
<p>{{t 'common.search.error-intro'}}</p>
|
|
11
|
+
<code class='au-u-error error-code'>{{@error}}</code>
|
|
11
12
|
<p>
|
|
12
|
-
{{t '
|
|
13
|
+
{{t 'common.search.error-outro'}}
|
|
13
14
|
<AuLinkExternal
|
|
14
15
|
href='mailto:gelinktnotuleren@vlaanderen.be'
|
|
15
16
|
@icon='mail'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<AuModal
|
|
2
|
+
class="snippet-modal"
|
|
2
3
|
@modalOpen={{@open}}
|
|
3
4
|
@closeModal={{this.closeModal}}
|
|
4
5
|
@title={{t 'snippet-plugin.modal.title'}}
|
|
@@ -39,14 +40,11 @@
|
|
|
39
40
|
<div class='au-u-padding-top snippet-modal--list-container'>
|
|
40
41
|
{{#if this.snippetsResource.isRunning}}
|
|
41
42
|
<div class='au-u-margin'>
|
|
42
|
-
<
|
|
43
|
-
<span class='au-u-hidden-visually'>
|
|
44
|
-
{{t 'snippet-plugin.alert.loading'}}
|
|
45
|
-
</span>
|
|
43
|
+
<Common::Search::Loading />
|
|
46
44
|
</div>
|
|
47
45
|
{{else}}
|
|
48
46
|
{{#if this.error}}
|
|
49
|
-
<
|
|
47
|
+
<Common::Search::AlertLoadError @error={{this.error}} />
|
|
50
48
|
{{else}}
|
|
51
49
|
{{#if this.snippetsResource.value.length}}
|
|
52
50
|
<SnippetPlugin::Snippets::SnippetList
|
|
@@ -54,7 +52,7 @@
|
|
|
54
52
|
@onInsert={{@onInsert}}
|
|
55
53
|
/>
|
|
56
54
|
{{else}}
|
|
57
|
-
<
|
|
55
|
+
<Common::Search::AlertNoItems />
|
|
58
56
|
{{/if}}
|
|
59
57
|
{{/if}}
|
|
60
58
|
{{/if}}
|
|
@@ -39,14 +39,11 @@
|
|
|
39
39
|
<div class='au-u-padding-top snippet-modal--list-container'>
|
|
40
40
|
{{#if this.snippetListResource.isRunning}}
|
|
41
41
|
<div class='au-u-margin'>
|
|
42
|
-
<
|
|
43
|
-
<span class='au-u-hidden-visually'>
|
|
44
|
-
{{t 'snippet-plugin.alert.loading'}}
|
|
45
|
-
</span>
|
|
42
|
+
<Common::Search::Loading />
|
|
46
43
|
</div>
|
|
47
44
|
{{else}}
|
|
48
45
|
{{#if this.error}}
|
|
49
|
-
<
|
|
46
|
+
<Common::Search::AlertLoadError @error={{this.error}} class="au-u-margin-top-none" />
|
|
50
47
|
{{else}}
|
|
51
48
|
{{#if this.snippetListResource.value.length}}
|
|
52
49
|
<SnippetPlugin::SnippetList::SnippetListView
|
|
@@ -55,7 +52,7 @@
|
|
|
55
52
|
@onChange={{this.onChange}}
|
|
56
53
|
/>
|
|
57
54
|
{{else}}
|
|
58
|
-
<
|
|
55
|
+
<Common::Search::AlertNoItems />
|
|
59
56
|
{{/if}}
|
|
60
57
|
{{/if}}
|
|
61
58
|
{{/if}}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<PowerSelect
|
|
2
|
+
@loadingMessage={{t 'common.search.loading'}}
|
|
3
|
+
@searchMessage={{t 'worship-plugin.modal.search.search'}}
|
|
4
|
+
@noMatchesMessage={{t 'worship-plugin.modal.search.no-results'}}
|
|
5
|
+
@placeholderMessage={{t 'worship-plugin.modal.fields.admin-unit'}}
|
|
6
|
+
@allowClear={{true}}
|
|
7
|
+
@renderInPlace={{true}}
|
|
8
|
+
@searchEnabled={{true}}
|
|
9
|
+
@search={{perform this.searchUnits}}
|
|
10
|
+
@selected={{@selectedUnit}}
|
|
11
|
+
@onChange={{@onSelectUnit}}
|
|
12
|
+
...attributes
|
|
13
|
+
as |unit|>
|
|
14
|
+
{{unit.label}}
|
|
15
|
+
</PowerSelect>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { restartableTask, timeout } from 'ember-concurrency';
|
|
3
|
+
import { AdministrativeUnit } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/worship-plugin';
|
|
4
|
+
import { fetchAdministrativeUnits } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/worship-plugin/utils/fetchAdministrativeUnits';
|
|
5
|
+
import { WorshipPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/worship-plugin';
|
|
6
|
+
|
|
7
|
+
interface Args {
|
|
8
|
+
config: WorshipPluginConfig;
|
|
9
|
+
selectedUnit?: AdministrativeUnit;
|
|
10
|
+
onSelectUnit: (unit: AdministrativeUnit) => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default class AdministrativeUnitPickerComponent extends Component<Args> {
|
|
14
|
+
searchUnits = restartableTask(async (search: string) => {
|
|
15
|
+
await timeout(200);
|
|
16
|
+
|
|
17
|
+
const abortController = new AbortController();
|
|
18
|
+
try {
|
|
19
|
+
const units = await fetchAdministrativeUnits({
|
|
20
|
+
search,
|
|
21
|
+
config: this.args.config,
|
|
22
|
+
abortSignal: abortController.signal,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
return units;
|
|
26
|
+
} catch (err) {
|
|
27
|
+
// ember-power-select doesn't seem to have a way to display errors.
|
|
28
|
+
console.error(
|
|
29
|
+
'Error occured when searching for administrative units',
|
|
30
|
+
err,
|
|
31
|
+
);
|
|
32
|
+
// We just re-throw to keep TS happy, ember-concurrency just swallows it.
|
|
33
|
+
throw err;
|
|
34
|
+
} finally {
|
|
35
|
+
abortController.abort();
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<li class='au-c-list__item'>
|
|
2
|
+
<AuButton
|
|
3
|
+
@icon='add'
|
|
4
|
+
@iconAlignment='left'
|
|
5
|
+
@skin='link'
|
|
6
|
+
{{on 'click' this.openModal}}
|
|
7
|
+
>
|
|
8
|
+
{{t 'worship-plugin.insert.title'}}
|
|
9
|
+
</AuButton>
|
|
10
|
+
</li>
|
|
11
|
+
|
|
12
|
+
<WorshipPlugin::SearchModal
|
|
13
|
+
@open={{this.showModal}}
|
|
14
|
+
@closeModal={{this.closeModal}}
|
|
15
|
+
@config={{@config}}
|
|
16
|
+
@onInsert={{this.onInsert}}
|
|
17
|
+
/>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { action } from '@ember/object';
|
|
2
|
+
import Component from '@glimmer/component';
|
|
3
|
+
import { tracked } from '@glimmer/tracking';
|
|
4
|
+
|
|
5
|
+
import { SayController } from '@lblod/ember-rdfa-editor';
|
|
6
|
+
import { WorshipPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/worship-plugin';
|
|
7
|
+
import { WorshipService } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/worship-plugin/utils/fetchWorshipServices';
|
|
8
|
+
import { insertWorshipService } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/worship-plugin/utils/insertWorshipService';
|
|
9
|
+
|
|
10
|
+
interface Args {
|
|
11
|
+
controller: SayController;
|
|
12
|
+
config: WorshipPluginConfig;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default class WorshipPluginInsertComponent extends Component<Args> {
|
|
16
|
+
@tracked showModal = false;
|
|
17
|
+
|
|
18
|
+
get controller() {
|
|
19
|
+
return this.args.controller;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@action
|
|
23
|
+
openModal() {
|
|
24
|
+
this.controller.focus();
|
|
25
|
+
this.showModal = true;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@action
|
|
29
|
+
closeModal() {
|
|
30
|
+
this.showModal = false;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@action
|
|
34
|
+
onInsert(service: WorshipService) {
|
|
35
|
+
insertWorshipService(this.controller, service);
|
|
36
|
+
this.closeModal();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<AuTable>
|
|
2
|
+
<:header>
|
|
3
|
+
<tr class='au-c-data-table__header-title'>
|
|
4
|
+
<th>
|
|
5
|
+
<WorshipPlugin::SortableTableHeader
|
|
6
|
+
@field='label'
|
|
7
|
+
@label={{t 'worship-plugin.modal.fields.name'}}
|
|
8
|
+
@sort={{@sort}}
|
|
9
|
+
@setSort={{@setSort}}
|
|
10
|
+
/>
|
|
11
|
+
</th>
|
|
12
|
+
<th />
|
|
13
|
+
</tr>
|
|
14
|
+
</:header>
|
|
15
|
+
<:body>
|
|
16
|
+
{{#unless (or @services.isRunning @error)}}
|
|
17
|
+
{{#if @services.value.totalCount}}
|
|
18
|
+
{{#each @services.value.results as |row|}}
|
|
19
|
+
<tr>
|
|
20
|
+
<td>{{row.label}}</td>
|
|
21
|
+
<td class='au-u-text-center'>
|
|
22
|
+
<AuButton
|
|
23
|
+
{{on 'click' (fn @insert row)}}
|
|
24
|
+
>
|
|
25
|
+
{{t 'worship-plugin.modal.insert'}}
|
|
26
|
+
</AuButton>
|
|
27
|
+
</td>
|
|
28
|
+
</tr>
|
|
29
|
+
{{/each}}
|
|
30
|
+
{{/if}}
|
|
31
|
+
{{/unless}}
|
|
32
|
+
</:body>
|
|
33
|
+
</AuTable>
|
|
34
|
+
{{#if @services.isRunning}}
|
|
35
|
+
<div class='au-u-margin'>
|
|
36
|
+
<Common::Search::Loading />
|
|
37
|
+
</div>
|
|
38
|
+
{{else}}
|
|
39
|
+
{{#if @error}}
|
|
40
|
+
<Common::Search::AlertLoadError @error={{@error}} />
|
|
41
|
+
{{else}}
|
|
42
|
+
{{#unless @services.value.totalCount}}
|
|
43
|
+
<Common::Search::AlertNoItems />
|
|
44
|
+
{{/unless}}
|
|
45
|
+
{{/if}}
|
|
46
|
+
{{/if}}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<AuModal
|
|
2
|
+
class='worship-modal'
|
|
3
|
+
@modalOpen={{@open}}
|
|
4
|
+
@closeModal={{this.closeModal}}
|
|
5
|
+
@title={{t 'worship-plugin.modal.title'}}
|
|
6
|
+
@size='large'
|
|
7
|
+
@padding='none'
|
|
8
|
+
as |modal|
|
|
9
|
+
>
|
|
10
|
+
<modal.Body>
|
|
11
|
+
<AuMainContainer @scroll={{true}} class='worship-modal--main-container' as |mc|>
|
|
12
|
+
<mc.sidebar>
|
|
13
|
+
<div class='au-c-sidebar'>
|
|
14
|
+
<div class='au-c-sidebar__content au-u-padding'>
|
|
15
|
+
<AuHeading @level='3' @skin='4' class='au-u-padding-bottom-small'>
|
|
16
|
+
{{t 'worship-plugin.modal.search.title'}}
|
|
17
|
+
</AuHeading>
|
|
18
|
+
<AuLabel
|
|
19
|
+
class='au-margin-bottom-small'
|
|
20
|
+
for='searchTerm'
|
|
21
|
+
>
|
|
22
|
+
{{t 'worship-plugin.modal.fields.name'}}
|
|
23
|
+
</AuLabel>
|
|
24
|
+
<AuNativeInput
|
|
25
|
+
@type='text'
|
|
26
|
+
@width='block'
|
|
27
|
+
id='searchTerm'
|
|
28
|
+
value={{this.searchText}}
|
|
29
|
+
placeholder={{t 'worship-plugin.modal.search.placeholder'}}
|
|
30
|
+
{{on 'input' this.setInputSearchText}}
|
|
31
|
+
/>
|
|
32
|
+
<AuLabel
|
|
33
|
+
class='au-margin-bottom-small'
|
|
34
|
+
for='admin-unit-select'
|
|
35
|
+
>
|
|
36
|
+
{{t 'worship-plugin.modal.fields.admin-unit'}}
|
|
37
|
+
</AuLabel>
|
|
38
|
+
<WorshipPlugin::AdministrativeUnitPicker
|
|
39
|
+
id='admin-unit-select'
|
|
40
|
+
@config={{@config}}
|
|
41
|
+
@selectedUnit={{this.administrativeUnit}}
|
|
42
|
+
@onSelectUnit={{this.setAdministrativeUnit}}
|
|
43
|
+
/>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</mc.sidebar>
|
|
47
|
+
<mc.content @scroll={{true}}>
|
|
48
|
+
<div class='worship-modal--list-container'>
|
|
49
|
+
<WorshipPlugin::List
|
|
50
|
+
@error={{this.error}}
|
|
51
|
+
@services={{this.servicesResource}}
|
|
52
|
+
@sort={{this.sort}}
|
|
53
|
+
@setSort={{this.setSort}}
|
|
54
|
+
@insert={{@onInsert}}
|
|
55
|
+
/>
|
|
56
|
+
</div>
|
|
57
|
+
{{#if this.servicesResource.value.totalCount}}
|
|
58
|
+
{{#let
|
|
59
|
+
(pagination
|
|
60
|
+
page=this.pageNumber pageSize=this.pageSize count=this.servicesResource.value.totalCount
|
|
61
|
+
)
|
|
62
|
+
as |pg|
|
|
63
|
+
}}
|
|
64
|
+
<Pagination::PaginationView
|
|
65
|
+
@totalCount={{pg.count}}
|
|
66
|
+
@rangeStart={{pg.pageStart}}
|
|
67
|
+
@rangeEnd={{pg.pageEnd}}
|
|
68
|
+
@onNextPage={{this.nextPage}}
|
|
69
|
+
@onPreviousPage={{this.previousPage}}
|
|
70
|
+
@isFirstPage={{not pg.hasPreviousPage}}
|
|
71
|
+
@isLastPage={{not pg.hasNextPage}}
|
|
72
|
+
/>
|
|
73
|
+
{{/let}}
|
|
74
|
+
{{/if}}
|
|
75
|
+
</mc.content>
|
|
76
|
+
</AuMainContainer>
|
|
77
|
+
</modal.Body>
|
|
78
|
+
</AuModal>
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { tracked } from '@glimmer/tracking';
|
|
3
|
+
import { assert } from '@ember/debug';
|
|
4
|
+
import { action } from '@ember/object';
|
|
5
|
+
import { restartableTask, timeout } from 'ember-concurrency';
|
|
6
|
+
import { task as trackedTask } from 'ember-resources/util/ember-concurrency';
|
|
7
|
+
import { WorshipPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/worship-plugin';
|
|
8
|
+
import {
|
|
9
|
+
fetchWorshipServices,
|
|
10
|
+
SearchSort,
|
|
11
|
+
WorshipService,
|
|
12
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/worship-plugin/utils/fetchWorshipServices';
|
|
13
|
+
import { AdministrativeUnit } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/worship-plugin';
|
|
14
|
+
|
|
15
|
+
interface Args {
|
|
16
|
+
config: WorshipPluginConfig;
|
|
17
|
+
open: boolean;
|
|
18
|
+
closeModal: () => void;
|
|
19
|
+
onInsert: (service: WorshipService) => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default class WorshipPluginSearchModalComponent extends Component<Args> {
|
|
23
|
+
// Filtering
|
|
24
|
+
@tracked sort: SearchSort = false;
|
|
25
|
+
@tracked inputSearchText: string | null = null;
|
|
26
|
+
@tracked administrativeUnit: AdministrativeUnit | undefined =
|
|
27
|
+
this.args.config.defaultAdministrativeUnit;
|
|
28
|
+
|
|
29
|
+
// Display
|
|
30
|
+
@tracked error: unknown;
|
|
31
|
+
|
|
32
|
+
// Pagination
|
|
33
|
+
@tracked pageNumber = 0;
|
|
34
|
+
@tracked pageSize = 20;
|
|
35
|
+
@tracked totalCount = 0;
|
|
36
|
+
|
|
37
|
+
get config() {
|
|
38
|
+
return this.args.config;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
get searchText() {
|
|
42
|
+
return this.inputSearchText;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@action
|
|
46
|
+
setInputSearchText(event: InputEvent) {
|
|
47
|
+
assert(
|
|
48
|
+
'inputSearchText must be bound to an input element',
|
|
49
|
+
event.target instanceof HTMLInputElement,
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
this.inputSearchText = event.target.value;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@action
|
|
56
|
+
setAdministrativeUnit(unit: AdministrativeUnit) {
|
|
57
|
+
this.administrativeUnit = unit;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@action
|
|
61
|
+
async closeModal() {
|
|
62
|
+
await this.servicesResource.cancel();
|
|
63
|
+
this.args.closeModal();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
search = restartableTask(async () => {
|
|
67
|
+
await timeout(500);
|
|
68
|
+
|
|
69
|
+
const abortController = new AbortController();
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
const queryResult = await fetchWorshipServices({
|
|
73
|
+
administrativeUnitURI: this.administrativeUnit?.uri,
|
|
74
|
+
config: this.args.config,
|
|
75
|
+
searchMeta: {
|
|
76
|
+
abortSignal: abortController.signal,
|
|
77
|
+
filter: {
|
|
78
|
+
label: this.inputSearchText ?? undefined,
|
|
79
|
+
},
|
|
80
|
+
sort: this.sort,
|
|
81
|
+
page: this.pageNumber,
|
|
82
|
+
pageSize: this.pageSize,
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
this.error = undefined;
|
|
86
|
+
|
|
87
|
+
// Reset to first page if there are no results for this one e.g. when changing search
|
|
88
|
+
if (
|
|
89
|
+
this.pageNumber !== 0 &&
|
|
90
|
+
this.pageNumber * this.pageSize >= queryResult.totalCount
|
|
91
|
+
) {
|
|
92
|
+
this.pageNumber = 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return queryResult;
|
|
96
|
+
} catch (error) {
|
|
97
|
+
this.error = error;
|
|
98
|
+
return {
|
|
99
|
+
results: [],
|
|
100
|
+
totalCount: 0,
|
|
101
|
+
};
|
|
102
|
+
} finally {
|
|
103
|
+
abortController.abort();
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
servicesResource = trackedTask(this, this.search, () => [
|
|
108
|
+
this.inputSearchText,
|
|
109
|
+
this.administrativeUnit,
|
|
110
|
+
this.pageNumber,
|
|
111
|
+
this.pageSize,
|
|
112
|
+
this.sort,
|
|
113
|
+
]);
|
|
114
|
+
|
|
115
|
+
@action
|
|
116
|
+
setSort(sort: SearchSort) {
|
|
117
|
+
this.sort = sort;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@action
|
|
121
|
+
previousPage() {
|
|
122
|
+
--this.pageNumber;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@action
|
|
126
|
+
nextPage() {
|
|
127
|
+
++this.pageNumber;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{{!-- Based on au-data-table-th-sortable from ember-appuniversum and using the same classes --}}
|
|
2
|
+
<span
|
|
3
|
+
class='au-c-data-table__header-title au-c-data-table__header-title--sortable
|
|
4
|
+
{{if this.order ' is-active'}}'
|
|
5
|
+
>
|
|
6
|
+
{{@label}}
|
|
7
|
+
{{#if (eq this.order 'DESC')}}
|
|
8
|
+
<button
|
|
9
|
+
type='button'
|
|
10
|
+
{{on 'click' this.changeSort}}
|
|
11
|
+
class='au-c-data-table__sort'
|
|
12
|
+
>
|
|
13
|
+
<span class='au-u-hidden-visually'>{{t 'worship-plugin.modal.sort.asc'}}</span>
|
|
14
|
+
<AuIcon @icon='nav-up' />
|
|
15
|
+
</button>
|
|
16
|
+
{{else if (eq this.order 'ASC')}}
|
|
17
|
+
<button
|
|
18
|
+
type='button'
|
|
19
|
+
{{on 'click' this.changeSort}}
|
|
20
|
+
class='au-c-data-table__sort'
|
|
21
|
+
>
|
|
22
|
+
<span class='au-u-hidden-visually'>{{t 'worship-plugin.modal.sort.desc'}}</span>
|
|
23
|
+
<AuIcon @icon='nav-down' />
|
|
24
|
+
</button>
|
|
25
|
+
{{else}}
|
|
26
|
+
<button
|
|
27
|
+
type='button'
|
|
28
|
+
{{on 'click' this.changeSort}}
|
|
29
|
+
class='au-c-data-table__sort'
|
|
30
|
+
>
|
|
31
|
+
<span class='au-u-hidden-visually'>{{t 'worship-plugin.modal.sort.sort'}}</span>
|
|
32
|
+
<AuIcon @icon='nav-up-down' />
|
|
33
|
+
</button>
|
|
34
|
+
{{/if}}
|
|
35
|
+
</span>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { action } from '@ember/object';
|
|
2
|
+
import Component from '@glimmer/component';
|
|
3
|
+
import {
|
|
4
|
+
SearchSort,
|
|
5
|
+
WorshipService,
|
|
6
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/worship-plugin/utils/fetchWorshipServices';
|
|
7
|
+
|
|
8
|
+
interface Args {
|
|
9
|
+
label: string;
|
|
10
|
+
field: keyof WorshipService;
|
|
11
|
+
sort: SearchSort;
|
|
12
|
+
setSort: (sort: SearchSort) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default class SnippetInsertComponent extends Component<Args> {
|
|
16
|
+
get order() {
|
|
17
|
+
if (this.args.sort) {
|
|
18
|
+
const [sortedField, order] = this.args.sort;
|
|
19
|
+
if (sortedField === this.args.field) {
|
|
20
|
+
return order;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@action changeSort() {
|
|
27
|
+
const order = this.order;
|
|
28
|
+
let newSort: SearchSort;
|
|
29
|
+
if (!order) {
|
|
30
|
+
newSort = [this.args.field, 'ASC'];
|
|
31
|
+
} else if (order === 'ASC') {
|
|
32
|
+
newSort = [this.args.field, 'DESC'];
|
|
33
|
+
} else {
|
|
34
|
+
newSort = false;
|
|
35
|
+
}
|
|
36
|
+
this.args.setSort(newSort);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
executeCountQuery,
|
|
3
3
|
executeQuery,
|
|
4
|
+
sparqlEscapeString,
|
|
4
5
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/sparql-helpers';
|
|
5
6
|
import { Snippet, SnippetList } from '../index';
|
|
6
7
|
|
|
7
8
|
type Filter = { name?: string; assignedSnippetListIds?: string[] };
|
|
8
9
|
type Pagination = { pageNumber: number; pageSize: number };
|
|
9
10
|
|
|
10
|
-
const sparqlEscapeString = (value: string) =>
|
|
11
|
-
'"""' + value.replace(/[\\"]/g, (match) => '\\' + match) + '"""';
|
|
12
|
-
|
|
13
11
|
const buildSnippetCountQuery = ({ name, assignedSnippetListIds }: Filter) => {
|
|
14
12
|
return `
|
|
15
13
|
PREFIX schema: <http://schema.org/>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type BindingObject,
|
|
3
|
+
executeQuery,
|
|
4
|
+
sparqlEscapeString,
|
|
5
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/sparql-helpers';
|
|
6
|
+
import { AdministrativeUnit, WorshipPluginConfig } from '../';
|
|
7
|
+
|
|
8
|
+
export interface FetchAdministrativeUnitsArgs {
|
|
9
|
+
config: WorshipPluginConfig;
|
|
10
|
+
search: string;
|
|
11
|
+
abortSignal?: AbortSignal;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const emptyUnit: AdministrativeUnit = {
|
|
15
|
+
uri: '',
|
|
16
|
+
label: '',
|
|
17
|
+
};
|
|
18
|
+
const selectUnit = Object.keys(emptyUnit)
|
|
19
|
+
.map((key) => `?${key}`)
|
|
20
|
+
.join(' ');
|
|
21
|
+
|
|
22
|
+
export async function fetchAdministrativeUnits({
|
|
23
|
+
config: { endpoint },
|
|
24
|
+
search,
|
|
25
|
+
abortSignal,
|
|
26
|
+
}: FetchAdministrativeUnitsArgs): Promise<AdministrativeUnit[]> {
|
|
27
|
+
const filterQuery = !search
|
|
28
|
+
? ''
|
|
29
|
+
: `FILTER(CONTAINS(LCASE(?label), LCASE(${sparqlEscapeString(search)})))`;
|
|
30
|
+
|
|
31
|
+
const query = `
|
|
32
|
+
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
|
|
33
|
+
PREFIX erediensten: <http://data.lblod.info/vocabularies/erediensten/>
|
|
34
|
+
|
|
35
|
+
SELECT DISTINCT ${selectUnit} WHERE {
|
|
36
|
+
?uri erediensten:betrokkenBestuur ?targetUri;
|
|
37
|
+
skos:prefLabel ?label.
|
|
38
|
+
${filterQuery}
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
const queryResult = await executeQuery<BindingObject<AdministrativeUnit>>({
|
|
43
|
+
endpoint,
|
|
44
|
+
query,
|
|
45
|
+
abortSignal,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
return queryResult.results.bindings.map<AdministrativeUnit>((binding) => ({
|
|
49
|
+
uri: binding.uri.value,
|
|
50
|
+
label: binding.label.value,
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import RSVP from 'rsvp';
|
|
2
|
+
import {
|
|
3
|
+
type BindingObject,
|
|
4
|
+
executeCountQuery,
|
|
5
|
+
executeQuery,
|
|
6
|
+
sparqlEscapeString,
|
|
7
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/sparql-helpers';
|
|
8
|
+
import { WorshipPluginConfig } from '../';
|
|
9
|
+
|
|
10
|
+
export type WorshipService = {
|
|
11
|
+
uri: string;
|
|
12
|
+
label: string;
|
|
13
|
+
};
|
|
14
|
+
export interface WorshipServiceResponse {
|
|
15
|
+
results: WorshipService[];
|
|
16
|
+
totalCount: number;
|
|
17
|
+
}
|
|
18
|
+
export type SearchSort = [keyof WorshipService, 'ASC' | 'DESC'] | false;
|
|
19
|
+
export interface SearchMeta {
|
|
20
|
+
filter?: Partial<WorshipService>;
|
|
21
|
+
sort?: SearchSort;
|
|
22
|
+
pageSize: number;
|
|
23
|
+
page: number;
|
|
24
|
+
abortSignal: AbortSignal;
|
|
25
|
+
}
|
|
26
|
+
export interface FetchWorshipServicesArgs {
|
|
27
|
+
administrativeUnitURI?: string;
|
|
28
|
+
searchMeta: SearchMeta;
|
|
29
|
+
config: WorshipPluginConfig;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const emptyWorshipService: WorshipService = {
|
|
33
|
+
uri: '',
|
|
34
|
+
label: '',
|
|
35
|
+
};
|
|
36
|
+
const selectWorshipService = Object.keys(emptyWorshipService)
|
|
37
|
+
.map((key) => `?${key}`)
|
|
38
|
+
.join(' ');
|
|
39
|
+
|
|
40
|
+
export async function fetchWorshipServices({
|
|
41
|
+
administrativeUnitURI,
|
|
42
|
+
config: { endpoint },
|
|
43
|
+
searchMeta: { abortSignal, filter, pageSize, page, sort },
|
|
44
|
+
}: FetchWorshipServicesArgs): Promise<WorshipServiceResponse> {
|
|
45
|
+
const unitQuery = !administrativeUnitURI
|
|
46
|
+
? ''
|
|
47
|
+
: `<${administrativeUnitURI}> erediensten:betrokkenBestuur/org:organization ?uri.`;
|
|
48
|
+
const sortQuery = !sort ? '' : `ORDER BY ${sort[1]}(?${sort[0]})`;
|
|
49
|
+
const filterQuery = !filter
|
|
50
|
+
? ''
|
|
51
|
+
: Object.entries(filter)
|
|
52
|
+
.map(([field, search]) =>
|
|
53
|
+
search?.length > 0
|
|
54
|
+
? `FILTER(CONTAINS(LCASE(?${field}), LCASE(${sparqlEscapeString(
|
|
55
|
+
search,
|
|
56
|
+
)})))`
|
|
57
|
+
: undefined,
|
|
58
|
+
)
|
|
59
|
+
.filter(Boolean)
|
|
60
|
+
.join('; ');
|
|
61
|
+
|
|
62
|
+
const query = `
|
|
63
|
+
PREFIX org: <http://www.w3.org/ns/org#>
|
|
64
|
+
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
|
|
65
|
+
PREFIX erediensten: <http://data.lblod.info/vocabularies/erediensten/>
|
|
66
|
+
|
|
67
|
+
SELECT ${selectWorshipService} WHERE {
|
|
68
|
+
?uri a erediensten:BestuurVanDeEredienst;
|
|
69
|
+
skos:prefLabel ?label.
|
|
70
|
+
${unitQuery}
|
|
71
|
+
${filterQuery}
|
|
72
|
+
}
|
|
73
|
+
${sortQuery} LIMIT ${pageSize} OFFSET ${page * pageSize}
|
|
74
|
+
`;
|
|
75
|
+
const countQuery = `
|
|
76
|
+
PREFIX org: <http://www.w3.org/ns/org#>
|
|
77
|
+
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
|
|
78
|
+
PREFIX erediensten: <http://data.lblod.info/vocabularies/erediensten/>
|
|
79
|
+
|
|
80
|
+
SELECT (count(?uri) as ?count) WHERE {
|
|
81
|
+
?uri a erediensten:BestuurVanDeEredienst;
|
|
82
|
+
skos:prefLabel ?label.
|
|
83
|
+
${unitQuery}
|
|
84
|
+
${filterQuery}
|
|
85
|
+
}
|
|
86
|
+
`;
|
|
87
|
+
|
|
88
|
+
const totalCountPromise = executeCountQuery({
|
|
89
|
+
endpoint,
|
|
90
|
+
query: countQuery,
|
|
91
|
+
abortSignal,
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const resultsPromise = executeQuery<BindingObject<WorshipService>>({
|
|
95
|
+
endpoint,
|
|
96
|
+
query,
|
|
97
|
+
abortSignal,
|
|
98
|
+
}).then((queryResult) =>
|
|
99
|
+
queryResult.results.bindings.map<WorshipService>((binding) => ({
|
|
100
|
+
uri: binding.uri.value,
|
|
101
|
+
label: binding.label.value,
|
|
102
|
+
})),
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
return RSVP.hash({
|
|
106
|
+
results: resultsPromise,
|
|
107
|
+
totalCount: totalCountPromise,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SayController } from '@lblod/ember-rdfa-editor';
|
|
2
|
+
import { WorshipService } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/worship-plugin/utils/fetchWorshipServices';
|
|
3
|
+
|
|
4
|
+
export function insertWorshipService(
|
|
5
|
+
controller: SayController,
|
|
6
|
+
worshipService: WorshipService,
|
|
7
|
+
) {
|
|
8
|
+
const node = controller.schema.text(worshipService.label);
|
|
9
|
+
|
|
10
|
+
controller.withTransaction(
|
|
11
|
+
(tr) => {
|
|
12
|
+
return tr.replaceSelectionWith(node);
|
|
13
|
+
},
|
|
14
|
+
{ view: controller.mainEditorView },
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import * as RDF from '@rdfjs/types';
|
|
2
2
|
import { optionMapOr } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
|
|
3
3
|
|
|
4
|
+
export type BindingObject<Obj extends Record<string, string>> = Record<
|
|
5
|
+
keyof Obj,
|
|
6
|
+
{ value: string }
|
|
7
|
+
>;
|
|
8
|
+
|
|
4
9
|
export interface QueryResult<Binding = Record<string, RDF.Term>> {
|
|
5
10
|
results: {
|
|
6
11
|
bindings: Binding[];
|
|
@@ -13,6 +18,9 @@ interface QueryConfig {
|
|
|
13
18
|
abortSignal?: AbortSignal;
|
|
14
19
|
}
|
|
15
20
|
|
|
21
|
+
export const sparqlEscapeString = (value: string) =>
|
|
22
|
+
'"""' + value.replace(/[\\"]/g, (match) => '\\' + match) + '"""';
|
|
23
|
+
|
|
16
24
|
export async function executeQuery<Binding = Record<string, RDF.Term>>({
|
|
17
25
|
query,
|
|
18
26
|
endpoint,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/common/search/alert-load-error';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/common/search/alert-no-items';
|
package/app/components/{snippet-plugin/helpers/alert-load-error.js → common/search/loading.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/common/search/loading';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/worship-plugin/administrative-unit-picker';
|
package/app/components/{citation-plugin/helpers/alert-load-error.js → worship-plugin/insert.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/worship-plugin/insert';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/worship-plugin/list';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/worship-plugin/search-modal';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/worship-plugin/sortable-table-header';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.worship-modal {
|
|
2
|
+
&--main-container {
|
|
3
|
+
height: 100% !important;
|
|
4
|
+
|
|
5
|
+
#content {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&--list-container {
|
|
12
|
+
overflow: auto;
|
|
13
|
+
flex-grow: 1;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.error-code {
|
|
17
|
+
font-family: var(--au-font-tertiary);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { AdministrativeUnit } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/worship-plugin';
|
|
3
|
+
import { WorshipPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/worship-plugin';
|
|
4
|
+
interface Args {
|
|
5
|
+
config: WorshipPluginConfig;
|
|
6
|
+
selectedUnit?: AdministrativeUnit;
|
|
7
|
+
onSelectUnit: (unit: AdministrativeUnit) => void;
|
|
8
|
+
}
|
|
9
|
+
export default class AdministrativeUnitPickerComponent extends Component<Args> {
|
|
10
|
+
searchUnits: import("ember-concurrency").TaskForAsyncTaskFunction<unknown, (search: string) => Promise<AdministrativeUnit[]>>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { SayController } from '@lblod/ember-rdfa-editor';
|
|
3
|
+
import { WorshipPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/worship-plugin';
|
|
4
|
+
import { WorshipService } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/worship-plugin/utils/fetchWorshipServices';
|
|
5
|
+
interface Args {
|
|
6
|
+
controller: SayController;
|
|
7
|
+
config: WorshipPluginConfig;
|
|
8
|
+
}
|
|
9
|
+
export default class WorshipPluginInsertComponent extends Component<Args> {
|
|
10
|
+
showModal: boolean;
|
|
11
|
+
get controller(): SayController;
|
|
12
|
+
openModal(): void;
|
|
13
|
+
closeModal(): void;
|
|
14
|
+
onInsert(service: WorshipService): void;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { WorshipPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/worship-plugin';
|
|
3
|
+
import { SearchSort, WorshipService } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/worship-plugin/utils/fetchWorshipServices';
|
|
4
|
+
import { AdministrativeUnit } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/worship-plugin';
|
|
5
|
+
interface Args {
|
|
6
|
+
config: WorshipPluginConfig;
|
|
7
|
+
open: boolean;
|
|
8
|
+
closeModal: () => void;
|
|
9
|
+
onInsert: (service: WorshipService) => void;
|
|
10
|
+
}
|
|
11
|
+
export default class WorshipPluginSearchModalComponent extends Component<Args> {
|
|
12
|
+
sort: SearchSort;
|
|
13
|
+
inputSearchText: string | null;
|
|
14
|
+
administrativeUnit: AdministrativeUnit | undefined;
|
|
15
|
+
error: unknown;
|
|
16
|
+
pageNumber: number;
|
|
17
|
+
pageSize: number;
|
|
18
|
+
totalCount: number;
|
|
19
|
+
get config(): WorshipPluginConfig;
|
|
20
|
+
get searchText(): string | null;
|
|
21
|
+
setInputSearchText(event: InputEvent): void;
|
|
22
|
+
setAdministrativeUnit(unit: AdministrativeUnit): void;
|
|
23
|
+
closeModal(): Promise<void>;
|
|
24
|
+
search: import("ember-concurrency").TaskForAsyncTaskFunction<unknown, () => Promise<import("@lblod/ember-rdfa-editor-lblod-plugins/plugins/worship-plugin/utils/fetchWorshipServices").WorshipServiceResponse>>;
|
|
25
|
+
servicesResource: import("ember-resources/util/ember-concurrency").TaskInstance<unknown>;
|
|
26
|
+
setSort(sort: SearchSort): void;
|
|
27
|
+
previousPage(): void;
|
|
28
|
+
nextPage(): void;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { SearchSort, WorshipService } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/worship-plugin/utils/fetchWorshipServices';
|
|
3
|
+
interface Args {
|
|
4
|
+
label: string;
|
|
5
|
+
field: keyof WorshipService;
|
|
6
|
+
sort: SearchSort;
|
|
7
|
+
setSort: (sort: SearchSort) => void;
|
|
8
|
+
}
|
|
9
|
+
export default class SnippetInsertComponent extends Component<Args> {
|
|
10
|
+
get order(): false | "ASC" | "DESC";
|
|
11
|
+
changeSort(): void;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
package/package.json
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AdministrativeUnit, WorshipPluginConfig } from '../';
|
|
2
|
+
export interface FetchAdministrativeUnitsArgs {
|
|
3
|
+
config: WorshipPluginConfig;
|
|
4
|
+
search: string;
|
|
5
|
+
abortSignal?: AbortSignal;
|
|
6
|
+
}
|
|
7
|
+
export declare function fetchAdministrativeUnits({ config: { endpoint }, search, abortSignal, }: FetchAdministrativeUnitsArgs): Promise<AdministrativeUnit[]>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { WorshipPluginConfig } from '../';
|
|
2
|
+
export type WorshipService = {
|
|
3
|
+
uri: string;
|
|
4
|
+
label: string;
|
|
5
|
+
};
|
|
6
|
+
export interface WorshipServiceResponse {
|
|
7
|
+
results: WorshipService[];
|
|
8
|
+
totalCount: number;
|
|
9
|
+
}
|
|
10
|
+
export type SearchSort = [keyof WorshipService, 'ASC' | 'DESC'] | false;
|
|
11
|
+
export interface SearchMeta {
|
|
12
|
+
filter?: Partial<WorshipService>;
|
|
13
|
+
sort?: SearchSort;
|
|
14
|
+
pageSize: number;
|
|
15
|
+
page: number;
|
|
16
|
+
abortSignal: AbortSignal;
|
|
17
|
+
}
|
|
18
|
+
export interface FetchWorshipServicesArgs {
|
|
19
|
+
administrativeUnitURI?: string;
|
|
20
|
+
searchMeta: SearchMeta;
|
|
21
|
+
config: WorshipPluginConfig;
|
|
22
|
+
}
|
|
23
|
+
export declare function fetchWorshipServices({ administrativeUnitURI, config: { endpoint }, searchMeta: { abortSignal, filter, pageSize, page, sort }, }: FetchWorshipServicesArgs): Promise<WorshipServiceResponse>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SayController } from '@lblod/ember-rdfa-editor';
|
|
2
|
+
import { WorshipService } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/worship-plugin/utils/fetchWorshipServices';
|
|
3
|
+
export declare function insertWorshipService(controller: SayController, worshipService: WorshipService): void;
|
package/translations/en-US.yaml
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
common:
|
|
2
|
+
search:
|
|
3
|
+
loading: Loading…
|
|
4
|
+
no-results: No results found
|
|
5
|
+
error-title: Error while loading results
|
|
6
|
+
error-intro: 'An error occurred while loading results'
|
|
7
|
+
error-outro: In case this problem keeps occurring, please contact
|
|
8
|
+
|
|
1
9
|
article-structure-plugin:
|
|
2
10
|
insert:
|
|
3
11
|
paragraph: Insert paragraph
|
|
@@ -103,12 +111,6 @@ citaten-plugin:
|
|
|
103
111
|
lookup-publicatie-short: Publicatie
|
|
104
112
|
publicatie-non-available: Full content not public
|
|
105
113
|
publicatie-non-available-short: Not public
|
|
106
|
-
alert:
|
|
107
|
-
loading: Loading…
|
|
108
|
-
no-results: No results found
|
|
109
|
-
error-title: Error while loading results
|
|
110
|
-
error-intro: 'An error occured while loading results from the Flemish Codex:'
|
|
111
|
-
error-outro: In case this problem keeps occuring, please contact
|
|
112
114
|
|
|
113
115
|
besluit-type-plugin:
|
|
114
116
|
dt: 'Decision type'
|
|
@@ -267,12 +269,6 @@ snippet-plugin:
|
|
|
267
269
|
title: Filter on
|
|
268
270
|
label: Snippet name
|
|
269
271
|
placeholder: Type something...
|
|
270
|
-
alert:
|
|
271
|
-
loading: Loading…
|
|
272
|
-
no-results: No results found
|
|
273
|
-
error-title: Error while loading results
|
|
274
|
-
error-intro: 'An error occurred while loading results'
|
|
275
|
-
error-outro: In case this problem keeps occurring, please contact
|
|
276
272
|
snippet-list:
|
|
277
273
|
open-modal: Manage snippet lists
|
|
278
274
|
modal:
|
|
@@ -383,3 +379,22 @@ editor-plugins:
|
|
|
383
379
|
|
|
384
380
|
confidentiality-plugin:
|
|
385
381
|
redact: Redact
|
|
382
|
+
|
|
383
|
+
worship-plugin:
|
|
384
|
+
insert:
|
|
385
|
+
title: Insert worship service
|
|
386
|
+
modal:
|
|
387
|
+
title: Choose a worship service
|
|
388
|
+
insert: Insert
|
|
389
|
+
search:
|
|
390
|
+
title: Filter on
|
|
391
|
+
placeholder: Type something...
|
|
392
|
+
search: search
|
|
393
|
+
no results: nothing found
|
|
394
|
+
fields:
|
|
395
|
+
name: Name
|
|
396
|
+
admin-unit: Administrative Unit
|
|
397
|
+
sort:
|
|
398
|
+
sort: Sort
|
|
399
|
+
asc: Sort ascending
|
|
400
|
+
desc: Sort descending
|
package/translations/nl-BE.yaml
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
common:
|
|
2
|
+
search:
|
|
3
|
+
loading: Laden…
|
|
4
|
+
no-results: Geen resultaten gevonden
|
|
5
|
+
error-title: Probleem bij het laden
|
|
6
|
+
error-intro: "Er is een fout opgetreden tijdens het laden van de resultaten:"
|
|
7
|
+
error-outro: Moest dit probleem aanhouden, neem contact op met
|
|
8
|
+
|
|
1
9
|
article-structure-plugin:
|
|
2
10
|
insert:
|
|
3
11
|
paragraph: Paragraaf invoegen
|
|
@@ -104,12 +112,6 @@ citaten-plugin:
|
|
|
104
112
|
lookup-publicatie-short: Publicatie
|
|
105
113
|
publicatie-non-available: Volledige inhoud niet publiek
|
|
106
114
|
publicatie-non-available-short: Niet publiek
|
|
107
|
-
alert:
|
|
108
|
-
loading: Laden…
|
|
109
|
-
no-results: Geen resultaten gevonden
|
|
110
|
-
error-title: Probleem bij het laden
|
|
111
|
-
error-intro: "Er heeft zich een fout voorgedaan bij het zoeken in de Vlaamse Codex:"
|
|
112
|
-
error-outro: Moest dit probleem aanhouden, neem contact op met
|
|
113
115
|
|
|
114
116
|
|
|
115
117
|
besluit-type-plugin:
|
|
@@ -271,12 +273,6 @@ snippet-plugin:
|
|
|
271
273
|
title: Filter op
|
|
272
274
|
label: Fragmentnaam
|
|
273
275
|
placeholder: Typ iets...
|
|
274
|
-
alert:
|
|
275
|
-
loading: Laden…
|
|
276
|
-
no-results: Geen resultaten gevonden
|
|
277
|
-
error-title: Probleem bij het laden
|
|
278
|
-
error-intro: "Er is een fout opgetreden tijdens het laden van de resultaten:"
|
|
279
|
-
error-outro: Moest dit probleem aanhouden, neem contact op met
|
|
280
276
|
snippet-list:
|
|
281
277
|
open-modal: Fragmentlijsten beheren
|
|
282
278
|
modal:
|
|
@@ -387,3 +383,22 @@ editor-plugins:
|
|
|
387
383
|
|
|
388
384
|
confidentiality-plugin:
|
|
389
385
|
redact: Redigeren
|
|
386
|
+
|
|
387
|
+
worship-plugin:
|
|
388
|
+
insert:
|
|
389
|
+
title: Erediensten invoegen
|
|
390
|
+
modal:
|
|
391
|
+
title: Kies een erediensten
|
|
392
|
+
insert: Invoegen
|
|
393
|
+
search:
|
|
394
|
+
title: Filter op
|
|
395
|
+
placeholder: Typ iets...
|
|
396
|
+
search: zoeken
|
|
397
|
+
no results: niets gevonden
|
|
398
|
+
fields:
|
|
399
|
+
name: Naam
|
|
400
|
+
admin-unit: Bestuurseenheid
|
|
401
|
+
sort:
|
|
402
|
+
sort: Sorteren
|
|
403
|
+
asc: Oplopend sorteren
|
|
404
|
+
desc: Aflopend sorteren
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import * as RDF from '@rdfjs/types';
|
|
2
|
+
export type BindingObject<Obj extends Record<string, string>> = Record<keyof Obj, {
|
|
3
|
+
value: string;
|
|
4
|
+
}>;
|
|
2
5
|
export interface QueryResult<Binding = Record<string, RDF.Term>> {
|
|
3
6
|
results: {
|
|
4
7
|
bindings: Binding[];
|
|
@@ -9,6 +12,7 @@ interface QueryConfig {
|
|
|
9
12
|
endpoint: string;
|
|
10
13
|
abortSignal?: AbortSignal;
|
|
11
14
|
}
|
|
15
|
+
export declare const sparqlEscapeString: (value: string) => string;
|
|
12
16
|
export declare function executeQuery<Binding = Record<string, RDF.Term>>({ query, endpoint, abortSignal, }: QueryConfig): Promise<QueryResult<Binding>>;
|
|
13
17
|
export declare function executeCountQuery(queryConfig: QueryConfig): Promise<number>;
|
|
14
18
|
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<AuAlert
|
|
2
|
-
@title="{{t "citaten-plugin.alert.error-title"}}"
|
|
3
|
-
@skin="error"
|
|
4
|
-
@icon="alert-triangle"
|
|
5
|
-
@size="{{if @fullSize "default" "small"}}"
|
|
6
|
-
@closable={{false}}
|
|
7
|
-
...attributes>
|
|
8
|
-
<p>{{t "citaten-plugin.alert.error-intro"}}</p>
|
|
9
|
-
<code class="au-u-error citaten--error-code">{{@error}}</code>
|
|
10
|
-
<p>
|
|
11
|
-
{{t "citaten-plugin.alert.error-outro"}}
|
|
12
|
-
<AuLinkExternal
|
|
13
|
-
href="mailto:gelinktnotuleren@vlaanderen.be"
|
|
14
|
-
@icon="mail"
|
|
15
|
-
@iconAlignment="left">
|
|
16
|
-
{{!-- template-lint-disable no-bare-strings --}}
|
|
17
|
-
gelinktnotuleren@vlaanderen.be
|
|
18
|
-
</AuLinkExternal>.
|
|
19
|
-
</p>
|
|
20
|
-
</AuAlert>
|
|
21
|
-
|