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
rufus-0.6 RufusApp/Frank/frank_static_resources.bundle/js/tree_view.js
rufus-0.6 RufusApp/Frank/frankified_build/Frankified.app/frank_static_resources.bundle/js/tree_view.js
rufus-0.5 RufusApp/Frank/frankified_build/Frankified.app/frank_static_resources.bundle/js/tree_view.js
rufus-0.5 RufusApp/Frank/frank_static_resources.bundle/js/tree_view.js
rufus-0.4 RufusApp/Frank/frank_static_resources.bundle/js/tree_view.js
rufus-0.4 RufusApp/Frank/frankified_build/Frankified.app/frank_static_resources.bundle/js/tree_view.js
rufus-0.3 RufusApp/Frank/frankified_build/Frankified.app/frank_static_resources.bundle/js/tree_view.js
rufus-0.3 RufusApp/Frank/frank_static_resources.bundle/js/tree_view.js
rufus-0.1 RufusApp/Frank/frank_static_resources.bundle/js/tree_view.js
rufus-0.1 RufusApp/Frank/frankified_build/Frankified.app/frank_static_resources.bundle/js/tree_view.js
frank-cucumber-1.2.0 frank-skeleton/frank_static_resources.bundle/js/tree_view.js
frank-cucumber-1.2.0.pre1 frank-skeleton/frank_static_resources.bundle/js/tree_view.js
frank-cucumber-1.1.13.pre1 frank-skeleton/frank_static_resources.bundle/js/tree_view.js
frank-cucumber-1.1.12 frank-skeleton/frank_static_resources.bundle/js/tree_view.js
frank-cucumber-1.1.11.pre1 frank-skeleton/frank_static_resources.bundle/js/tree_view.js
frank-cucumber-1.1.10 frank-skeleton/frank_static_resources.bundle/js/tree_view.js
frank-cucumber-1.1.9.pre1 frank-skeleton/frank_static_resources.bundle/js/tree_view.js
frank-cucumber-1.1.8 frank-skeleton/frank_static_resources.bundle/js/tree_view.js