Sha256: f69039a2723a9418aaa9a3d9ada895bd725c7ed34ffe9718d70175b276ccc1a3

Contents?: true

Size: 1.95 KB

Versions: 58

Compression:

Stored size: 1.95 KB

Contents

(function() {

  define(['view_hier_model'], function(ViewHierModel) {
    var TreeNodeView, TreeView;
    TreeNodeView = Backbone.View.extend({
      tagName: 'li',
      initialize: function() {
        return this.model.on('change:selected', _.bind(this.refreshSelectedness, this));
      },
      $a: function() {
        return this.$('> a');
      },
      render: function() {
        var $childList, child, childView, _i, _len, _ref,
          _this = this;
        $childList = $("<ul/>");
        _ref = this.model.get('children');
        for (_i = 0, _len = _ref.length; _i < _len; _i++) {
          child = _ref[_i];
          childView = new TreeNodeView({
            model: child
          });
          $childList.append(childView.render().el);
        }
        this.$el.append("<a>" + (this.model.getDesc()) + "</a>").append($childList);
        this.$a().on('mouseenter', function() {
          return _this.model.setActive();
        }).on('mouseleave', function() {
          return _this.model.unsetActive();
        }).on('click', function() {
          return _this.model.trigger('selected', _this.model);
        });
        this.refreshSelectedness();
        return this;
      },
      refreshSelectedness: function() {
        if (this.model.get('selected')) {
          return this.$a().addClass('selected');
        } else {
          return this.$a().removeClass('selected');
        }
      }
    });
    return TreeView = Backbone.View.extend({
      el: $('#dom-dump > ul'),
      initialize: function() {
        this.model = new ViewHierModel();
        return this.model.on('change', _.bind(this.refresh, this));
      },
      refresh: function() {
        var rootNodeView;
        this.$el.empty();
        rootNodeView = new TreeNodeView({
          model: this.model.get('root')
        });
        this.$el.append(rootNodeView.render().el);
        return this.$el.treeview({
          collapsed: false
        });
      }
    });
  });

}).call(this);

Version data entries

58 entries across 41 versions & 5 rubygems

Version Path
sc-frank-ios-1.2.3 frank-skeleton/frank_static_resources.bundle/js/tree_view.js
frank-cucumber-1.2.5 frank-skeleton/frank_static_resources.bundle/js/tree_view.js
frank-cucumber-1.2.4.pre1 frank-skeleton/frank_static_resources.bundle/js/tree_view.js
frank-pivotal-1.3.0.pre.2 frank-skeleton/frank_static_resources.bundle/js/tree_view.js
sc-frank-cucumber-1.2.1.bba52d7.debug frank-skeleton/frank_static_resources.bundle/js/tree_view.js
sc-frank-cucumber-1.2.1.e1e3ccb.debug frank-skeleton/frank_static_resources.bundle/js/tree_view.js
sc-frank-cucumber-1.2.1.1a856ca.debug frank-skeleton/frank_static_resources.bundle/js/tree_view.js
frank-pivotal-1.3.0.pre.1 frank-skeleton/frank_static_resources.bundle/js/tree_view.js
frank-pivotal-1.2.4 frank-skeleton/frank_static_resources.bundle/js/tree_view.js
frank-pivotal-1.2.3.pre.2 frank-skeleton/frank_static_resources.bundle/js/tree_view.js
frank-pivotal-1.2.3.pre.1 frank-skeleton/frank_static_resources.bundle/js/tree_view.js
frank-pivotal-1.2.3 frank-skeleton/frank_static_resources.bundle/js/tree_view.js
sc-frank-cucumber-1.2.1.b7791c5.debug frank-skeleton/frank_static_resources.bundle/js/tree_view.js
sc-frank-cucumber-1.2.1.b7791c5.debug frank-skeleton/frank_static_resources.bundle/bundle/js/tree_view.js
sc-frank-cucumber-1.2.1.b7791c5.debug frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/tree_view.js
frank-cucumber-1.2.3 frank-skeleton/frank_static_resources.bundle/js/tree_view.js
sc-frank-cucumber-1.2.1.3256dc1.debug frank-skeleton/frank_static_resources.bundle/bundle/js/tree_view.js
sc-frank-cucumber-1.2.1.3256dc1.debug frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/tree_view.js
sc-frank-cucumber-1.2.1.3256dc1.debug frank-skeleton/frank_static_resources.bundle/js/tree_view.js
sc-frank-cucumber-1.2.1.9c95c03.debug frank-skeleton/frank_static_resources.bundle/js/tree_view.js