fullcalendar integration

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

fullcalendar integration

Ilya Obshadko
Anyone tried using fullcalendar with Tapestry 5.4.x?

I'm getting an error 'RequireJS error: define: momentProperties.push is not
a function'.
I believe this has something to do with moment.js initialization, but can't
figure it out.

Searching relevant topics on the web didn't quite help. Any help would be
appreciated.


--
Ilya Obshadko
Reply | Threaded
Open this post in threaded view
|

Re: fullcalendar integration

Ilya Obshadko
Solved - it turns out that Tapestry loads its own version of moment.js
which is incompatible with fullcalendar.

This does the trick:

@Contribute(ModuleManager.class)
public static void configureScheduler(MappedConfiguration<String,
Object> configuration,

@Path("classpath:META-INF/assets/scheduler-1.9.4/lib/moment.min.js")
Resource momentJs,

@Path("classpath:META-INF/assets/scheduler-1.9.4/lib/fullcalendar.js")
Resource fullCalendarJs,

@Path("classpath:META-INF/assets/scheduler-1.9.4/scheduler.js")
Resource schedulerJs) {
    configuration.override("moment", new
JavaScriptModuleConfiguration(momentJs));
    configuration.add("fullcalendar", new
JavaScriptModuleConfiguration(fullCalendarJs).dependsOn("moment").exports("fullcalendar"));
}


On Sat, Nov 10, 2018 at 8:53 AM Ilya Obshadko <[hidden email]> wrote:

> Anyone tried using fullcalendar with Tapestry 5.4.x?
>
> I'm getting an error 'RequireJS error: define: momentProperties.push is
> not a function'.
> I believe this has something to do with moment.js initialization, but
> can't figure it out.
>
> Searching relevant topics on the web didn't quite help. Any help would be
> appreciated.
>
>
> --
> Ilya Obshadko
>
>
>
>

--
Ilya Obshadko
Reply | Threaded
Open this post in threaded view
|

Re: fullcalendar integration

Thiago H de Paula Figueiredo
Thanks for the example, Ilya!

On Sat, Nov 10, 2018 at 8:53 AM Ilya Obshadko <[hidden email]> wrote:

> Solved - it turns out that Tapestry loads its own version of moment.js
> which is incompatible with fullcalendar.
>
> This does the trick:
>
> @Contribute(ModuleManager.class)
> public static void configureScheduler(MappedConfiguration<String,
> Object> configuration,
>
> @Path("classpath:META-INF/assets/scheduler-1.9.4/lib/moment.min.js")
> Resource momentJs,
>
> @Path("classpath:META-INF/assets/scheduler-1.9.4/lib/fullcalendar.js")
> Resource fullCalendarJs,
>
> @Path("classpath:META-INF/assets/scheduler-1.9.4/scheduler.js")
> Resource schedulerJs) {
>     configuration.override("moment", new
> JavaScriptModuleConfiguration(momentJs));
>     configuration.add("fullcalendar", new
>
> JavaScriptModuleConfiguration(fullCalendarJs).dependsOn("moment").exports("fullcalendar"));
> }
>
>
> On Sat, Nov 10, 2018 at 8:53 AM Ilya Obshadko <[hidden email]> wrote:
>
> > Anyone tried using fullcalendar with Tapestry 5.4.x?
> >
> > I'm getting an error 'RequireJS error: define: momentProperties.push is
> > not a function'.
> > I believe this has something to do with moment.js initialization, but
> > can't figure it out.
> >
> > Searching relevant topics on the web didn't quite help. Any help would be
> > appreciated.
> >
> >
> > --
> > Ilya Obshadko
> >
> >
> >
> >
>
> --
> Ilya Obshadko
>


--
Thiago
Reply | Threaded
Open this post in threaded view
|

Re: fullcalendar integration

JumpStart
In my AppModule I found a comment about a dependency on jquery-ui’s DatePicker. Thought it might help.

@Path("/META-INF/assets/js/jquery-ui-1.9.1.js") Resource jqueryUi,
@Path("/META-INF/assets/moment-timezone-with-data-2012-2022.js") Resource momentTimezoneWithData,
@Path("/META-INF/assets/fullcalendar-3.9.0/fullcalendar.js") Resource fullcalendar

configuration.add("jquery-ui", new JavaScriptModuleConfiguration(jqueryUi));

configuration.add("moment-timezone-with-data”, new JavaScriptModuleConfiguration(momentTimezoneWithData).dependsOn("moment"));

// fullcalendar Requires jquery-ui's DatePicker and Moment to be present because it has translations for them.
configuration.add("fullcalendar”, new JavaScriptModuleConfiguration(fullcalendar).dependsOn("jquery-ui", "moment-timezone-with-data"));

Geoff

> On 12 Nov 2018, at 9:34 pm, Thiago H. de Paula Figueiredo <[hidden email]> wrote:
>
> Thanks for the example, Ilya!
>
> On Sat, Nov 10, 2018 at 8:53 AM Ilya Obshadko <[hidden email]> wrote:
>
>> Solved - it turns out that Tapestry loads its own version of moment.js
>> which is incompatible with fullcalendar.
>>
>> This does the trick:
>>
>> @Contribute(ModuleManager.class)
>> public static void configureScheduler(MappedConfiguration<String,
>> Object> configuration,
>>
>> @Path("classpath:META-INF/assets/scheduler-1.9.4/lib/moment.min.js")
>> Resource momentJs,
>>
>> @Path("classpath:META-INF/assets/scheduler-1.9.4/lib/fullcalendar.js")
>> Resource fullCalendarJs,
>>
>> @Path("classpath:META-INF/assets/scheduler-1.9.4/scheduler.js")
>> Resource schedulerJs) {
>>    configuration.override("moment", new
>> JavaScriptModuleConfiguration(momentJs));
>>    configuration.add("fullcalendar", new
>>
>> JavaScriptModuleConfiguration(fullCalendarJs).dependsOn("moment").exports("fullcalendar"));
>> }
>>
>>
>> On Sat, Nov 10, 2018 at 8:53 AM Ilya Obshadko <[hidden email]> wrote:
>>
>>> Anyone tried using fullcalendar with Tapestry 5.4.x?
>>>
>>> I'm getting an error 'RequireJS error: define: momentProperties.push is
>>> not a function'.
>>> I believe this has something to do with moment.js initialization, but
>>> can't figure it out.
>>>
>>> Searching relevant topics on the web didn't quite help. Any help would be
>>> appreciated.
>>>
>>>
>>> --
>>> Ilya Obshadko
>>>
>>>
>>>
>>>
>>
>> --
>> Ilya Obshadko
>>
>
>
> --
> Thiago