Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for google calendar. #71

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

yortz
Copy link

@yortz yortz commented Dec 6, 2017

This adds the missing googleCalendarApiKey option available on fullcalendar.js by default to enable support for google calendar, together with the required (updated) gcal.min.js file. Currently using this on a production website, it runs smoothly just simply add the value for your google calendar api key and the url for the public calendar in eventsources e.g.:

googleCalendarApiKey: computed(function() {
  return this.get('currentUser.googleCalendarApiKey');
}),

calendarUrl: computed(function() {
  return this.get('currentUser.calendarUrl');
}),

eventSources: computed('currentUser.calendarUrl', function() {
  let events = [this.get('localEvents')];
  if (this.hasGoogleCalendarEvents()) {
    events.push(this.get('googleEvents'));
  }
  return events;
}),

hasGoogleCalendarEvents() {
  return (this.get('googleCalendarApiKey') && this.get('calendarUrl'));
},

localEvents: computed(function() {
	return events = Ember.A([{
	 title: 'Event 1',
	 start: '2016-05-05T07:08:08',
	 end: '2016-05-05T09:08:08'
	}, {
	 title: 'Event 2',
	 start: '2016-05-06T07:08:08',
	 end: '2016-05-07T09:08:08'
	}, {
	 title: 'Event 3',
	 start: '2016-05-10T07:08:08',
	 end: '2016-05-10T09:48:08'
	}, {
	 title: 'Event 4',
	 start: '2016-05-11T07:15:08',
	 end: '2016-05-11T09:08:08'
	}]);
}),

googleEvents: computed(function() {
  let calendarId = this.get('calendarUrl');
  return {
    googleCalendarId: calendarId,
    className: 'gcal-event'
  };
})

@yortz
Copy link
Author

yortz commented Dec 6, 2017

Actually, you need to explicitly require gcal.min.js in your ember app, being a not a js developer I cannot understand how to import it into the component, maybe this PR can save some time to other peeps trying to add google calendar via the fullcalendar addon for ember.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant