Sha256: 9013258fb3326a9540e1e83be7b566d9eafe42d145f2e043744c7080864996e1

Contents?: true

Size: 1.25 KB

Versions: 30

Compression:

Stored size: 1.25 KB

Contents

(function() {

  Luca.components.Controller = Luca.containers.CardView.extend({
    initialize: function(options) {
      var _ref;
      this.options = options;
      Luca.containers.CardView.prototype.initialize.apply(this, arguments);
      this.defaultCard || (this.defaultCard = (_ref = this.components[0]) != null ? _ref.name : void 0);
      if (!this.defaultCard) {
        throw "Controllers must specify a defaultCard property and/or the first component must have a name";
      }
      return this.state = new Backbone.Model({
        active_section: this.defaultCard
      });
    },
    each: function(fn) {
      var _this = this;
      return _(this.components).each(function(component) {
        return fn.apply(_this, [component]);
      });
    },
    "default": function(callback) {
      return this.navigate_to(this.defaultCard, callback);
    },
    navigate_to: function(section, callback) {
      var _this = this;
      section || (section = this.defaultCard);
      this.activate(section, false, function(activator, previous, current) {
        _this.state.set({
          active_section: current.name
        });
        if (_.isFunction(callback)) return callback.apply(current);
      });
      return this.find(section);
    }
  });

}).call(this);

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
luca-0.9.76 vendor/assets/luca-ui/components/controller.js
luca-0.9.7 vendor/assets/luca-ui/components/controller.js
luca-0.9.65 vendor/assets/luca-ui/components/controller.js
luca-0.9.6 vendor/assets/luca-ui/components/controller.js
luca-0.9.42 vendor/assets/luca-ui/components/controller.js
luca-0.9.4 vendor/assets/luca-ui/components/controller.js
luca-0.9.2 vendor/assets/luca-ui/components/controller.js
luca-0.9.1 vendor/assets/luca-ui/components/controller.js
luca-0.9.0 vendor/assets/luca-ui/components/controller.js
luca-0.8.599 vendor/assets/luca-ui/components/controller.js
luca-0.8.59 vendor/assets/luca-ui/components/controller.js
luca-0.8.3 vendor/assets/luca-ui/components/controller.js
luca-0.8.2 vendor/assets/luca-ui/components/controller.js
luca-0.8.06 vendor/assets/luca-ui/components/controller.js
luca-0.8 vendor/assets/luca-ui/components/controller.js
luca-0.7.92 vendor/assets/luca-ui/components/controller.js
luca-0.7.91 vendor/assets/luca-ui/components/controller.js
luca-0.7.9 vendor/assets/luca-ui/components/controller.js
luca-0.7.8 vendor/assets/luca-ui/components/controller.js
luca-0.7.7 vendor/assets/luca-ui/components/controller.js