Code Monkey home page Code Monkey logo

ember-fullcalendar's Introduction

ember-fullcalendar

dependencies npm version

ember-fullcalendar brings the power of FullCalendar and FullCalendar Scheduler to Ember.

Installation

This addon works in Ember 1.13.9+ or 2.0+ with no deprecations.

To install it run:

ember install ember-fullcalendar

Overview

This addon currently supports every option and callback currently available for FullCalendar 3.6 and FullCalendar Scheduler 1.8. Please see the FullCalendar documentation for more information.

Usage

A simple example:

let 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'
}]);

{{full-calendar events=events}}

FullCalendar Methods

FullCalendar methods can be called like so:

// app/controllers/application.js
import Ember from 'ember';

export default Ember.Controller.extend({
	actions: {
		nextMonth(){
			Ember.$('.full-calendar').fullCalendar('next');
		}
	}
});

DDAU

Where possible, this addon takes advantage of DDAU (Data Down, Actions Up) to allow your Ember app to interact with FullCalendar from outside of the component. Below are a list of properties that override default FullCalendar properties:

  • viewName (replaces defaultView) - allows you to change the view mode from outside of the component. For example, when using header=false, you can use your own buttons to modify the viewName property to change the view of the calendar.

  • viewRange - can be used in conjunction with viewName to simultaneously navigate to a new date when switching to a new view. See the docs.

  • onViewChange - pass an action to be notified when the view changes. This is different than the viewRender callback provided by FullCalendar as it is only triggered when the view changes and is not when any of the date navigation methods are called.

  • date (replaces defaultDate) - allows you to change the date from outside of the component.

FullCalendar Callbacks

All FullCalendar and FullCalendar Scheduler callbacks are supported and can be handled using Ember Actions. Here's a simple example:

Add the component to your template:

// app/templates/application.hbs
{{full-calendar events=events eventClick=(action 'clicked')}}

Add some events:

// app/routes/application.js
import Ember from 'ember';

export default Ember.Route.extend({
	model: function() {
		return {
			events: Ember.A([{
				title: 'Partayyyy', start: new Date()
			}])
  	};
	}
});

Register the action in your controller or component:

// app/controllers/application.js
import Ember from 'ember';

export default Ember.Controller.extend({
	actions: {
		clicked(event, jsEvent, view){
			this.showModal(event);
		}
	}
});

FullCalendar Scheduler

Opting In

By default, FullCalendar Scheduler is NOT imported. To include it, add the following to your application's config/environment.js:

var ENV = {
  emberFullCalendar: {
    includeScheduler: true
  }
  // Other options here, as needed.
});

FullCalendar Locales

By default, only English locale is available. If you need to use other locales, you have to include them in config/environment.js like this:

var ENV = {
  emberFullCalendar: {
      includeLocales: ['fr', 'it']
  }
  // Other options here, as needed.
});

Or, if you need ALL the locales, you can do the following:

var ENV = {
  emberFullCalendar: {
      includeLocales: 'all'
  }
  // Other options here, as needed.
});

Then, you can set the fullcalendar language by using the locale option:

{{full-calendar events=events locale='fr'}}

Fastboot Support

This addon now has minimal Fastboot support via #46.

License

By default, the addon uses the Free Trial License Key provided by FullCalendar. If you have a paid license key, you may set it by explicitly passing it into the component as schedulerLicenseKey or, the better option, is to set it in your config/environment.js file like so:

	emberFullCalendar: {
		schedulerLicenseKey: '<your license key>'
	}

ember-fullcalendar's People

Contributors

beverlyguillermo avatar danchadwick avatar dhiemstra avatar ember-tomster avatar fpalluel avatar jamesdixon avatar lan0 avatar mcfiredrill avatar miguelcobain avatar mtudor avatar robbiethewagner avatar

Watchers

 avatar  avatar

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.