private _eventRender()

in legacy/src/Calendar/Views.tsx [613:669]


    private _eventRender(
        eventSource: Calendar_Contracts.IEventSource,
        event: FullCalendar.EventObject,
        element: JQuery,
        view: FullCalendar.ViewObject,
    ) {
        if (event.rendering !== "background") {
            const eventObject = event as Calendar_Contracts.IExtendedCalendarEventObject;
            const calendarEvent = this._eventObjectToCalendarEvent(eventObject);

            if (calendarEvent.icons) {
                for (const icon of calendarEvent.icons) {
                    const $image = $("<img/>")
                        .attr("src", icon.src)
                        .addClass("event-icon")
                        .addClass(icon.cssClass)
                        .prependTo(element.find(".fc-content"));
                    if (icon.title) {
                        $image.attr("title", icon.title);
                    }
                    if (eventSource.getEnhancer) {
                        eventSource.getEnhancer().then(enhancer => {
                            if (icon.action) {
                                const iconEvent = icon.linkedEvent || calendarEvent;
                                $image.bind("click", icon.action.bind(this, iconEvent));
                            }
                            if (icon.linkedEvent) {
                                enhancer.canEdit(calendarEvent, this._currentMember).then((canEdit: boolean) => {
                                    const commands = [
                                        { rank: 5, id: "Edit", text: "Edit", icon: "icon-edit" },
                                        { rank: 10, id: "Delete", text: "Delete", icon: "icon-delete" },
                                    ];
                                    const tempEvent = this._calendarEventToEventObject(icon.linkedEvent, eventSource);
                                    this._buildContextMenu($image, tempEvent, commands);
                                    $image.bind("click", this._editEvent.bind(this, tempEvent));
                                });
                            }
                        });
                    }
                }
            }

            if (eventSource.getEnhancer) {
                eventSource.getEnhancer().then(enhancer => {
                    enhancer.canEdit(calendarEvent, this._currentMember).then((canEdit: boolean) => {
                        if (canEdit) {
                            const commands = [
                                { rank: 5, id: "Edit", text: "Edit", icon: "icon-edit" },
                                { rank: 10, id: "Delete", text: "Delete", icon: "icon-delete" },
                            ];
                            this._buildContextMenu($(element), eventObject, commands);
                        }
                    });
                });
            }
        }
    }