Giter VIP home page Giter VIP logo

meteor-fullcalendar's Introduction

FullCalendar JQuery plugin packaged for Meteor 1.0

Instalation

meteor add rzymek:fullcalendar

Usage

{{> fullcalendar }}

Options to FullCalendar can be passed as attributes:

{{> fullcalendar defaultView='agendaWeek'}}

If you want to have options defined in JS (or have them reactive), you can do:

<template name="example">
    {{>fullcalendar options}}
</template>

Template.example.helpers({
    options: function() {
        return {
            defaultView: 'basicWeek'
        };
    }
});

To access the .fullcalendar method assign an id or a class first

{{> fullcalendar id="myCalendar" ...}}

Then you can for example do

$('#myCalendar').fullCalendar('refetchEvents');

Updating fullcalendar

To update fullcalendar version run

./update.sh

This will update to the newest fullcalendar's tag. To update to a specific version do

./update.sh 2.2.6

If you want me to publish a new package version just create an issue. In case you can't wait to use a new fullcalendar version in your project, you can update the package locally:

cd your_meteor_project
mkdir -p packages
git clone https://github.com/rzymek/meteor-fullcalendar packages/rzymek:fullcalendar
./packages/rzymek:fullcalendar/update.sh

After the desired version gets published just remove the local package:

rm -r packages/rzymek:fullcalendar

meteor-fullcalendar's People

Contributors

rzymek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

meteor-fullcalendar's Issues

Unable to change event colors?

Is there something in the package's css that's overriding event background and border colors? Can't seem to set them to what I want no matter what I do. I see other fullcalendar repos seem to have the colors set to the default blue in the packaged css, is this one the same? If so, can we get that rule taken out so we can customize event colors?

Not able to output any events at all?

Hi there, I've tried using this package to output events and no matter which format I try and use I can't seem to output any events at all.

I've tried using a basic array of objects as well as using a function. You wouldn't happen to have a basic example for a basic Meteor collection would you?

Thanks!

$('.fc').fullCalendar('refetchEvents') is undefined

Hi, i can't refetch events.

I've tried everything to make the calendar reactive, but i noticed that the function $('.fc').fullCalendar('refetchEvents') does not return or does nothing.

The best i could do was this call $('.fc').fullCalendar('destroy') before $('.fc').fullCalendar(events).

I need some help with this );

TypeError: units.toLowerCase is not a function

Error dump is below. Perhaps the issue is the old version of momentjs your package installs, when I already have momentjs 2.18.1 installed from npm?

TypeError: units.toLowerCase is not a function at normalizeUnits (http://localhost:3000/packages/momentjs_moment.js?hash=76d88106d32bc66d1746f0b021b152e1edcdd15d:638:33) at Moment.set (http://localhost:3000/packages/momentjs_moment.js?hash=76d88106d32bc66d1746f0b021b152e1edcdd15d:2574:21) at Moment.newMomentProto.stripTime (http://localhost:3000/packages/rzymek_fullcalendar.js?hash=b21f2ed094a6dfe021d6208c2878dc0d136d713f:1335:8) at members.constructor.normalizeCurrentRange (http://localhost:3000/packages/rzymek_fullcalendar.js?hash=b21f2ed094a6dfe021d6208c2878dc0d136d713f:10642:16) at members.constructor.buildCurrentRangeInfo (http://localhost:3000/packages/rzymek_fullcalendar.js?hash=b21f2ed094a6dfe021d6208c2878dc0d136d713f:10627:8) at members.constructor.buildDateProfile (http://localhost:3000/packages/rzymek_fullcalendar.js?hash=b21f2ed094a6dfe021d6208c2878dc0d136d713f:10557:22) at constructor.updateToolbarButtons (http://localhost:3000/packages/rzymek_fullcalendar.js?hash=b21f2ed094a6dfe021d6208c2878dc0d136d713f:12450:24) at members.constructor.executeDateRender (http://localhost:3000/packages/rzymek_fullcalendar.js?hash=b21f2ed094a6dfe021d6208c2878dc0d136d713f:9618:17) at http://localhost:3000/packages/rzymek_fullcalendar.js?hash=b21f2ed094a6dfe021d6208c2878dc0d136d713f:9531:10 at constructor.runTaskFunc (http://localhost:3000/packages/rzymek_fullcalendar.js?hash=b21f2ed094a6dfe021d6208c2878dc0d136d713f:2401:13) undefined

The example doesn't work

Although there is an example folder provided, the example files does not work. Other than showing a very simple calendar, the example is not adding any event to the database nor showing any event in a database. Since I am new to this, I really couldn't get it to work without a point of reference.

how to add and show task on the calendar?

I am a new for this package.
I would to add/show or remove task on calendar with due date.
And then example it can alert message before 1 hour of due date.
Please help me.

Enable to refresh event w/o re-redering page

Hey there, running througth some troubles...

Template.agenda.helpers({
    options() {
        let events = Events.findOne() && Events.findOne().events;
        let calendar = {
            titleFormat: 'MMM D YYYY',
            header: {
                left: 'prev',
                center: 'title',
                right: 'today ,next'
            },
            defaultView: 'month',
            events: events,
            eventClick: function (calEvent, jsEvent, view) {
                Session.set('eventId', calEvent._id);
                Modal.show('editevent');
            },
            eventDrop: function (event, delta, revertFunc) {
                Meteor.call('events.update', {
                    title: event.title,
                    _id: event._id,
                    start: event._start._d,
                    end: event._end._d
                });
            },
            dayClick: function (date, jsEvent, view) {
                Session.set('clicked-date', date._d);
                Modal.show('addnew');
            }
        };
        $('#calendar').fullCalendar('refetchEvents'); // using this perfom absolutly nothing
        return calendar
    },

});`

<template name="agenda">
    {{#if Template.subscriptionsReady}} {{> fullcalendar options id="calendar" }} {{else}} {{> spinner}} {{/if}}
</template>

Also, when i add a new event, i perform :
$('#calendar').fullCalendar('renderEvent', result);

Somehow, template doesn't update until i refresh manualy the page.. anyone encouring the same problem ?

Calendar design

Hello,
i have a question. Is it possible to change the design of the calendar, so it just shows the number of the day as field ? And if it's possible, how can i do it ?
It should look something like this:
calendar

Thanks !

how to call .fullCalendar( 'rerenderEvents' )

hi,
I'm adding events after the calendar template is created (via the 'events' call back), but the events are only shown when I click on 'next' and not after the 'events' callback...

so I thought using 'rerenderEvents', but how to call it in the client code?

thanks,

tinto

calendar id not available

My page shows a table of events, or a full calendar of events. The switch is controlled by a button which drives a session variable.

If I arrive on the page in table mode, it draws the table. When I press the button to full calendar mode the session variable is changed and it draws the full calendar, and also does a refetchEvents reactively.

The problem is that the refetch events seems to be called before the id of the full calendar is known, so it doesn't get set up correctly.

How can I know when the full calendar id is in the dom so I can call refetch events?

Note that if I arrive on the page in calendar mode, all is good because my code to call refetchEvents is in onRendered(). But it doesnt work if I switch to calendar mode after the page was rendered, even if I wrap the refetch code in an autorun - the id is not there yet.

Moment issue

Hey!
I'm having an issue when trying to get the calendar.
What I'm getting is: Cannot read property 'localeData' of undefined at getMomentLocaleData
function getMomentLocaleData(localeCode) { return moment.localeData(localeCode) || moment.localeData('en'); }
I have moment installed...

Thanks!

dayClick

Hello,

I would like to add an event by clicking on a day. I tried to add "dayClick: function() { .... } in the helpers by nothing happens.

Can you help me?

Thanks

Cannot read property 'id' of null

I am trying to get the calendar rendered like it is explained in the README. I keep getting this error:

Exception from Tracker afterFlush function:
debug.js:41 TypeError: Cannot read property 'id' of null
    at Template.fullcalendar.rendered (template.js:4)
    at template.js:116
    at Function.Template._withTemplateInstanceFunc (template.js:457)
    at fireCallbacks (template.js:112)
    at null.<anonymous> (template.js:205)
    at view.js:107
    at Object.Blaze._withCurrentView (view.js:538)
    at view.js:106
    at Object.Tracker._runFlush (tracker.js:497)
    at onGlobalMessage (setimmediate.js:102)

list View not working

Hello
I would like to be able to use the listWeek view from FullCalendar.
Whatever I do I get the following error:

Exception from Tracker afterFlush function:
TypeError: spec.class is not a constructor
    at Calendar_constructor.instantiateView (rzymek_fullcalendar.js?hash=943b863…:9296)
    at renderView (rzymek_fullcalendar.js?hash=943b863…:9678)
    at initialRender (rzymek_fullcalendar.js?hash=943b863…:9623)
    at Calendar_constructor.render (rzymek_fullcalendar.js?hash=943b863…:9587)
    at HTMLDivElement.<anonymous> (rzymek_fullcalendar.js?hash=943b863…:85)
    at Function.each (jquery.js?hash=c57b3cf…:442)
    at jQuery.fn.init.each (jquery.js?hash=c57b3cf…:194)
    at jQuery.fn.init.$.fn.fullCalendar (rzymek_fullcalendar.js?hash=943b863…:64)
    at Blaze.TemplateInstance.Template.fullcalendar.rendered (rzymek_fullcalendar.js?hash=943b863…:12970)
    at blaze.js?hash=983d07a…:3341

I'm using Meteor version 1.4.2.3.
Thanks for any help!


Here is a small working example to see the behaviour:
meteor create testFC
cd testFC
meteor add rzymek:fullcalendar

main.html:

<head>
  <title>testFC</title>
</head>

<body>
  <h1>Welcome to Meteor!</h1>
  {{> calendar}}
</body>

calendar.html

<template name="calendar">
  {{> fullcalendar options}}
</template>

calendar.js

Template.calendar.helpers({
  options: function(){
    return {
      defaultView: 'listWeek',
    }
  }
});

scrollTime not working

I have a calendar working fine, except that it does not seem to recognize scrollTime option.
Maybe its a conflict with router-autoscroll?

template helpers other than "options" are not called, it seems

hi,

using the latest version like this

<template name="weekStripe">
    <div class="container" style="margin-top: 70px;">
        <div class="row">
            <div class="panel panel-default">
                <div class="panel-body">
                    {{> fullcalendar options}}
                </div>
            </div>
        </div>
    </div>
</template>
  Template.weekStripe.helpers ({
    options: function () {
      return {
        defaultView: 'basicWeek',
        firstDay: 1,
        height: 150
      }
    },

    dayClick: function (date, jsEvent, view) {
      alert('a day has been clicked!');
    }
  });

dayClick is not called in my case

am I missing something required?

cheers

How to query date and time from new collection?

I have collection called Requests in my project. One of its attributes is stored as follow : "requestedDateTime": "August 11, 2017 at 3:27 AM"

Is it possible to query the date and time from Requests collection to the fullCalendar?

And is there any documentation I can refer to about this package?

adding new language support

HI : How can I add a new language support to the calendar ?
I like to add fa (Farsi) language support. I be glad to do all the translations and submit a resource file.

Tom

{{> fullCalendar}}

As you don't use this plugin on specific elements with content, we should create a {{> fullCalendar}} helpers that takes a couple of options/settings.

It should create the <div class=".calendar"></div> dom and initalize the fullcalendar plugin with the provided options.

eventDrop not firing when a calendar item is dragged to another day

I'm following your code from the meteor example in gitHub (very few changes made; have added eventDrop in my template helper just under onEventClicked (which works fine):

`

onEventClicked: function() {
return function(calEvent, jsEvent, view) {
alert("Event clicked: "+calEvent.title);
$(this).css('border-color', 'red');
}
},

onEventDrop: function(event, delta, revertFunc) {
alert(" was dropped on " + event);
if (!confirm("Are you sure about this change?")) {
revertFunc();
}
}
`

in my template, I have the following:

          `{{> fullcalendar
                          class="mainCalendar"
                          defaultView='month'
                          height="100%"
                          events=events
                          eventClick=onEventClicked
                          editable=true
                          eventDrop=onEventDrop
             }}`

the eventDrop fires on load for each event (not sure why), but when moving/dropping a calendar item on to another day, no event helpers are fired.

Do I have the event defined in the wrong place? Should it be in onRendered? First time use of this package, and finding it difficult to know where to use it in Meteor vs. Jquery initializations where there is much more documentation.

Please advise.

FULL JS FILE BELOW:

`
Template.calendar.rendered = function () {
var fc = this.$('.fc');
this.autorun(function () {
//1) trigger event re-rendering when the collection is changed in any way
//2) find all, because we've already subscribed to a specific range
Events.find();
fc.fullCalendar('refetchEvents');
});
};

Template.calendar.helpers({
events: function () {
var fc = $('.fc');
return function (start, end, tz, callback) {
//subscribe only to specified date range
Meteor.subscribe('events', start.toDate(), end.toDate(), function () {
//trigger event rendering when collection is downloaded
fc.fullCalendar('refetchEvents');
});

      //find all, because we've already subscribed to a specific range
      var events = Events.find().map(function (it) {
          return {
              title: it.date.toISOString(),
              start: it.date,
              allDay: true
          };
      });
      callback(events);
  };
},
onEventClicked: function() {
  return function(calEvent, jsEvent, view) {
      alert("Event clicked: "+calEvent.title);
      $(this).css('border-color', 'red');
  }
},
onEventDrop: function(event, delta, revertFunc) {

    //alert(" was dropped on " + event);

    if (!confirm("Are you sure about this change?")) {
        revertFunc();
    }

}

});

Template.calendar.events({
'click .addEvent': function () {
Meteor.call('insertEvent', function(error, result){
// display error to the user and abort
if (error)
throwError("Error on event insert");

  });
},
'click .removeEvent':function() {
    var event = Events.findOne();
    if(event) {
        Events.remove(event._id);
    }
}

});

`

no such template as 'fullcalendar'

add {{>fullcalendar}} to my template causes an error which says no such template exists as 'fullcalendar'

I have added the package...

Theme and buttons not loading

I'm trying to import my calendar and yet I just get the blank calendar even if I only add a few basic options.
How do we do this?

I'd also like to know if you're working to get the package with Full Calendar 2.2.3 soon :)

Using Select

Hi there,

I have been trying to implement select

{{> fullcalendar id="plannerCalendar" selectable=true events=plannerEvents select=plannerSelect defaultView="agendaWeek" height=1500 }}

and

Template.plannercalendar.helpers({
    plannerSelect: function (start, end) {
        console.log('planner select ...');

but 'planner select' never get called ...

any clue?

Using the npm package for fullcalendar

meteor: v1.3.x

Just looking for a little guidance here with the added node module support in the latest meteor releases. My thoughts are related to modifying the wrappers you have provided but rather using npm to install fullcalendar under the node_modules directory:

Get the latest fullcalendar release and update package.json:
meteor npm install -save fullcalendar

Add import statement to some client/main.js file:
import fullcalendar from 'fullcalendar';

Probably some other things to change but is this the correct road to go down with the added npm support in meteor now? Thanks in advance for any help.

Possible example where passing options in JS not template?

Hi there, would it be possible at all to provide a very basic example where the options are passed as a helper and not directly on the html component (as per the example folder)?

You mention it in your docs but I'm having trouble getting any of the options to work (such as header). When I add them directly to the component, things seem to work but some options (such as header) I presume can only be set in JS.

I'm trying to set something like this in my template:

{{>fullcalendar options=options events=events}}

but seemingly the events will be picked up but not the options.

Full JS below:

Template.adminLessons.helpers({
  options: function() {
    return {
      defaultView: 'agendaWeek',
      header: {
        left: 'prev,next,today',
        center: 'title',
        right: 'agendaWeek,month,agendaDay'
      }
    };
  },
  events: function() {
    var fc;
    fc = $('.mainCalendar');
    return function(start, end, tz, callback) {
      var lessons;
      Meteor.subscribe('lessons', start.toDate(), end.toDate(), function() {
        return fc.fullCalendar('refetchEvents');
      });
      lessons = _.map(Lessons.find().fetch(), function(event) {
        return {
          title: event.title,
          start: event.start,
          end: event.end,
          className: event.type,
          id: event._id
        };
      });
      return callback(lessons);
    };
  },
  onEventClicked: function() {
    return function(calEvent, jsEvent, view) {
      return Router.go('adminLesson', {
        _id: calEvent.id
      });
    };
  },
  onDayClicked: function() {
    return function(date, jsEvent, view) {
      Session.set('addingEvent', true);
      $('input#title').focus();
      Session.set('addingEventClass', 'active');
      Session.set('addingEventDate', moment(date._d).format('YYYY-MM-DD'));
      Session.set('addingEventStartTime', moment(date._d).format('HH:mm'));
      return Session.set('addingEventEndTime', moment(date._d).add(1, 'hours').format('HH:mm'));
    };
  }
});

Template.adminLessons.rendered = function() {
  var fc;
  fc = this.$('.fc');
  return this.autorun(function() {
    Lessons.find();
    return fc.fullCalendar('refetchEvents');
  });
};

Would be great if you could see where I'm going wrong, thanks.

update to 2.7.0

Can you update to the latest version? The new version support touch on mobile.

Conflict with momentjs:moment?

I keep getting errors:

momentjs_moment.js:186 Uncaught TypeError: config._d.getTime is not a function
Moment @ momentjs_moment.js:186
clone @ momentjs_moment.js:1848
newMomentProto.clone @ rzymek_fullcalendar.js:926
moment_format__toISOString @ momentjs_moment.js:1944
EJSON.stringify @ ejson.js:343
stringify @ reactive-dict.js:6
_.extend.set @ reactive-dict.js:61
Template.events.helpers.options.eventClick @ visits.js:40
trigger @ rzymek_fullcalendar.js:8308
fc.View.Class.extend.trigger @ rzymek_fullcalendar.js:6635
Grid.mixin.bindSegHandlers.$.each.click @ rzymek_fullcalendar.js:3647
(anonymous function) @ rzymek_fullcalendar.js:3665
jQuery.event.dispatch @ jquery.js:4665
jQuery.event.add.elemData.handle @ jquery.js:4333

Can you kindly help? @rzymek

update

Can you please update fullcalendar and also show me how to update locally so I don't have to be coming to you áll the time.

I tried to follow this To update fullcalendar version run ./update.sh but was not sure where to run that command from.
where can I locate the source files so i replace the calendar.js file with the latest one. I am thinking that will be the easiest way to update. No?

Thanks.

Can I set header options in the meteor template, if so what's the syntax?

{{> fullcalendar
class="mainCalendar"
id="myCalendar"
defaultView='month'
height="100%"
events=events
eventClick=onEventClicked
eventDrop=onEventDrop
eventResize=onEventResize
dayClick=onDayClick
editable=true
* header=[?]*

}}

Note, it appears that if I set the options in the template, I can't also set them on rendered which is where I have the below code which seems to be overwritten or ignored. thanks!

$('#myCalendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
}
});

Unable subscribe

hello, please help me fix this issue with subscription not working. I used your exact code and only changed the collection name, but mongol show no subscription. Thanks .

`Template.RenderCalendar.helpers({
calId: 'clndr',
options: function () {
return {
events: function () {
var fc = $(this.calId);
// var fc = $('.fc');
return function (start, end, tz, callback) {
//subscribe only to specified date range
Meteor.subscribe('appointments', start.toDate(), end.toDate(), function () {
//trigger event rendering when collection is downloaded
fc.fullCalendar('refetchEvents');
});

                //find all, because we've already subscribed to a specific range
                var events = Appointments.find().map(function (it) {
                    return {
                        title: it.date.toISOString(),
                        start: it.date
                    };
                });
                callback(events);
            };
        }            
    };
}

});
Template.RenderCalendar.rendered = function () {
var calendar = $(this.calId);
//trigger event re-rendering when the collection is changed in any way
this.autorun(function () {
//2) find all, because we've already subscribed to a specific range
Appointments.find();
calendar.fullCalendar('refetchEvents');
});
};`

how ever if i use something like below, the subsription works, but i am unable to get the fullcalendar instance to be able to properly subscribe to a range using fc's start, end properties.

`events: function () {
var fc = $(this.calId);
// var fc = $('.fc');
return function (start, end, tz, callback) {
//subscribe only to specified date range
Meteor.subscribe('appointments', start.toDate(), end.toDate(), function () {
//trigger event rendering when collection is downloaded
fc.fullCalendar('refetchEvents');
});

                //find all, because we've already subscribed to a specific range
                var events = Appointments.find().map(function (it) {
                    return {
                        title: it.date.toISOString(),
                        start: it.date
                    };
                });
                callback(events);
          };
       }`

dayClick callback in options not working

I have my code in a calendar.js file as follows:

var calendar = $('#calendar').fullCalendar({
    dayClick: function(date, jsEvent, view){
        var newEvent = {};
        newEvent.start = date._d;
        newEvent.end = date._d;
        newEvent.title = "New Event";
        Meteor.call('saveCalEvent', newEvent);
    }
});

The server-side method will insert a new Event Object at that date, but it is of little relevance because the code crashes before that line. I repeatedly receive the Uncaught TypeError: m._d.getTime is not a function at moment.js:93 in my console and am unable to continue. I was reading that this might be due to the my moment.js version, it is currently at 2.11.2 and my fullCalendar version is at 2.6.0

Any assistance would be greatly appreciated; the console error is screenshotted below:
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.