Skip to content

Commit dbc63c8

Browse files
author
jboulay
committed
Extract resourceId from eventSource if it exists
1 parent 8cf5f78 commit dbc63c8

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

src/models/EventDef.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ once we do away with the deprecated eventResourceField.
3737
EventDef.prototype.applyMiscProps = function(rawProps) {
3838
rawProps = $.extend({}, rawProps) // clone, because of delete
3939

40-
this.resourceIds = Resource.extractIds(rawProps, this.source.calendar)
40+
this.resourceIds = Resource.extractIds(rawProps, this.source)
4141

4242
delete rawProps.resourceId
4343
delete rawProps.resourceIds

src/models/EventSource.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ import { EventSource } from 'fullcalendar'
22

33
// defineStandardProps won't work :(
44
// TODO: find a better way
5-
(EventSource.prototype as any).standardPropMap.resourceEditable = true // automatically transfer
5+
(EventSource.prototype as any).standardPropMap.resourceEditable = true; // automatically transfer
6+
(EventSource.prototype as any).standardPropMap.resourceId = true

src/models/Resource.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
export default class Resource {
33

44

5-
static extractIds(rawProps, calendar) {
6-
const resourceField = calendar.opt('eventResourceField') || 'resourceId'
5+
static extractIds(rawProps, source) {
6+
const resourceField = source.calendar.opt('eventResourceField') || 'resourceId'
77
const resourceIds = []
88

99
if (rawProps.resourceIds) {
@@ -16,6 +16,10 @@ export default class Resource {
1616
resourceIds.push(Resource.normalizeId(rawProps[resourceField]))
1717
}
1818

19+
if (source[resourceField]) {
20+
resourceIds.push(Resource.normalizeId(source[resourceField]))
21+
}
22+
1923
return resourceIds
2024
}
2125

0 commit comments

Comments
 (0)