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.8.2 RufusApp/Frank/frankified_build/Frankified.app/frank_static_resources.bundle/js/tree_view.js
rufus-0.8.2 RufusApp/Frank/frank_static_resources.bundle/js/tree_view.js
rufus-0.8.1 RufusApp/Frank/frankified_build/Frankified.app/frank_static_resources.bundle/js/tree_view.js
rufus-0.8.1 RufusApp/Frank/frank_static_resources.bundle/js/tree_view.js
rufus-0.8 RufusApp/Frank/frank_static_resources.bundle/js/tree_view.js
rufus-0.8 RufusApp/Frank/frankified_build/Frankified.app/frank_static_resources.bundle/js/tree_view.js
sc-frank-cucumber-1.2.1.1dcc760.debug frank-skeleton/frank_static_resources.bundle/js/tree_view.js
frank-cucumber-1.2.2 frank-skeleton/frank_static_resources.bundle/js/tree_view.js
sc-frank-cucumber-1.2.1.1dcc760 frank-skeleton/frank_static_resources.bundle/bundle/js/tree_view.js
sc-frank-cucumber-1.2.1.1dcc760 frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/tree_view.js
sc-frank-cucumber-1.2.1.1dcc760 frank-skeleton/frank_static_resources.bundle/js/tree_view.js
frank-cucumber-1.2.1 frank-skeleton/frank_static_resources.bundle/js/tree_view.js
sc-frank-cucumber-1.2.1.902fa34 frank-skeleton/frank_static_resources.bundle/bundle/js/tree_view.js
sc-frank-cucumber-1.2.1.902fa34 frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/tree_view.js
sc-frank-cucumber-1.2.1.902fa34 frank-skeleton/frank_static_resources.bundle/js/tree_view.js
sc-frank-cucumber-1.2.1.d2d00d2 frank-skeleton/frank_static_resources.bundle/js/tree_view.js
sc-frank-cucumber-1.2.1.c13cb90 frank-skeleton/frank_static_resources.bundle/js/tree_view.js
sc-frank-cucumber-1.2.1.00af28c frank-skeleton/frank_static_resources.bundle/js/tree_view.js
rufus-0.7 RufusApp/Frank/frankified_build/Frankified.app/frank_static_resources.bundle/js/tree_view.js
rufus-0.7 RufusApp/Frank/frank_static_resources.bundle/js/tree_view.js