{:uriI"�file:///Users/henk/roqua/quby_engine/app/assets/javascripts/quby/backbone/models/panel.js.coffee?type=application/javascript&pipeline=self&id=a14ac4dc2e223e5a17446704f31a12e447a9e64316f242f58663d1c9319b70d4:ET:load_pathI"9/Users/henk/roqua/quby_engine/app/assets/javascripts;T:
filenameI"^/Users/henk/roqua/quby_engine/app/assets/javascripts/quby/backbone/models/panel.js.coffee;T:	nameI"quby/backbone/models/panel;T:logical_pathI"'quby/backbone/models/panel.self.js;T:content_typeI"application/javascript;T:sourceI"Z	(function() {
  var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
    hasProp = {}.hasOwnProperty;

  Quby.Models.Panel = (function(superClass) {
    extend(Panel, superClass);

    function Panel() {
      return Panel.__super__.constructor.apply(this, arguments);
    }

    Panel.prototype.defaults = function() {
      return {
        questions: new Quby.Collections.Questions,
        view: new Quby.Views.PanelView({
          model: this
        }),
        panelId: null,
        initedShowsHidesCalled: false
      };
    };

    Panel.prototype.initialize = function() {
      var hidePanelTrigger, panelId, viewSelector;
      panelId = this.get('panelId');
      viewSelector = "#" + panelId;
      if (panelId) {
        this.get("view").setElement($(viewSelector)[0]);
      }
      hidePanelTrigger = function() {
        return this.trigger("hidePanelCheck");
      };
      this.get("questions").on("hide", hidePanelTrigger, this);
      this.get("questions").on("unhide", hidePanelTrigger, this);
      this.get("questions").on("show", hidePanelTrigger, this);
      this.get("questions").on("unshow", hidePanelTrigger, this);
      this.on("hidePanelCheck", this.hidePanelCheck, this);
      return this.trigger("hidePanelCheck");
    };

    Panel.prototype.initShowsHides = function(allQuestions) {
      if (!this.get('initedShowsHidesCalled')) {
        this.set('initedShowsHidesCalled', true);
        return this.get("questions").each(function(question) {
          var options;
          options = question.get("options");
          return options.each(function(option) {
            return option.initShowsHides(allQuestions);
          });
        });
      }
    };

    Panel.prototype.hidePanelCheck = function() {
      if (this.hidden()) {
        if (!this.get("questions").noneVisible()) {
          return this.trigger("unhide");
        }
      } else {
        if (this.get("questions").noneVisible()) {
          return this.trigger("hide");
        }
      }
    };

    Panel.prototype.hidden = function() {
      return this.get("view").hidden();
    };

    return Panel;

  })(Backbone.Model);

}).call(this);
;T:
metadata{:dependencieso:Set:
@hash}
I"environment-version;TTI"environment-paths;TTI"rails-env;TTI"jprocessors:type=application/javascript&file_type=application/javascript&engines=.coffee&pipeline=self;TTI"lfile-digest:///Users/henk/roqua/quby_engine/app/assets/javascripts/quby/backbone/models/panel.js.coffee;TTF:
requiredo;;}�F:stubbedo;;}�F:
linkso;;}�F:charsetI"
utf-8;F:digest"%�s����\܎����_����H<�W�n����
:lengthiZ	:dependencies_digest"%䶪�݋FA\���H��e�pOZ:��
g�1H��%:idI"Ea14ac4dc2e223e5a17446704f31a12e447a9e64316f242f58663d1c9319b70d4;F:
mtimel+�B�]