scoutforpets / ember-fullcalendar

An Ember Component for FullCalendar and FullCalendar Scheduler
MIT License
39 stars 45 forks source link

The includeScheduler option does not lead to importing the "Scheduler" #57

Closed markwatney2016 closed 6 years ago

markwatney2016 commented 7 years ago

I fiddled around with ember-fullcalendar (in a fresh Ember project) and have a problem with one configuration setting documented here:

https://github.com/scoutforpets/ember-fullcalendar#opting-in

My ember-cli-build.js looks like this:

const EmberApp = require('ember-cli/lib/broccoli/ember-app');

module.exports = function(defaults) {
  var app = new EmberApp(defaults, {
      emberFullCalendar: {
          includeScheduler: true
      }
  });

  return app.toTree();
};

Unfortunatelly this configuration setting does not seem work: the “Scheduler” is not imported.

I found the snippet in ember-fullcalendar where this configuration setting is used (in node_modules/ember-fullcalendar/index.js):

  included: function(app, parentAddon) {

    var target = parentAddon || app;

    // allow addon to be nested - see: https://github.com/ember-cli/ember-cli/issues/3718
    if (target.app) {
      target = target.app;
    }

    var config = target.project.config(target.env) || {};

    // Add scheduler to executable unless configured not to.
    if (config.emberFullCalendar && config.emberFullCalendar.includeScheduler === true) {
      this.includeScheduler = true;
    } else {
      this.includeScheduler = false;
    }

    this._super.included.apply(this, arguments);
  }

If I replace this.includeScheduler = false; with this.includeScheduler = true; in the else clause, the “Scheduler” gets imported and everything works like a charm.

config.emberFullCalendar seems to be undefined.

Is this a bug, an error in the documentation or did I make a mistake?

jamesdixon commented 7 years ago

@markwatney2016 I believe this is a documentation issue.

I just looked at my own app and the configuration is in my config/environment.js file.

Minimal example:

let ENV = {
    emberFullCalendar: {
      includeScheduler: true
    }
  };

Let me know if this works for you.

markwatney2016 commented 7 years ago

@jamesdixon Yes, this works. Thank you!