mirror of
https://github.com/nasa/openmct.git
synced 2025-04-16 15:29:20 +00:00
[Tree] Display tree correctly
This commit is contained in:
parent
dc2b3e85cc
commit
7ee8d0a3f7
@ -22,13 +22,13 @@
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
'angular',
|
||||
'zepto',
|
||||
'text!../../res/templates/tree/toggle.html'
|
||||
], function (angular, toggleTemplate) {
|
||||
], function ($, toggleTemplate) {
|
||||
function ToggleView(state) {
|
||||
this.expanded = !!state;
|
||||
this.callbacks = [];
|
||||
this.el = angular.element(toggleTemplate);
|
||||
this.el = $(toggleTemplate);
|
||||
this.el.on('click', function () {
|
||||
this.model(!this.expanded);
|
||||
}.bind(this));
|
||||
|
@ -22,15 +22,13 @@
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
'angular',
|
||||
'zepto',
|
||||
'text!../../res/templates/tree/node.html',
|
||||
'./ToggleView',
|
||||
'./TreeLabelView'
|
||||
], function (angular, nodeTemplate, ToggleView, TreeLabelView) {
|
||||
], function ($, nodeTemplate, ToggleView, TreeLabelView) {
|
||||
'use strict';
|
||||
|
||||
var $ = angular.element.bind(angular);
|
||||
|
||||
function TreeNodeView(subtreeFactory) {
|
||||
this.li = $('<li>');
|
||||
|
||||
@ -40,6 +38,8 @@ define([
|
||||
if (!this.subtreeView) {
|
||||
this.subtreeView = subtreeFactory();
|
||||
this.subtreeView.model(this.activeObject);
|
||||
this.li.find('.tree-item-subtree').eq(0)
|
||||
.append($(this.subtreeView.elements()));
|
||||
}
|
||||
$(this.subtreeView.elements()).removeClass('hidden');
|
||||
} else if (this.subtreeView) {
|
||||
@ -51,8 +51,8 @@ define([
|
||||
|
||||
this.li.append($(nodeTemplate));
|
||||
this.li.find('span').eq(0)
|
||||
.append(this.toggleView.elements())
|
||||
.append(this.labelView.elements());
|
||||
.append($(this.toggleView.elements()))
|
||||
.append($(this.labelView.elements()));
|
||||
|
||||
this.model(undefined);
|
||||
}
|
||||
|
@ -22,13 +22,11 @@
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
'angular',
|
||||
'zepto',
|
||||
'./TreeNodeView'
|
||||
], function (angular, TreeNodeView) {
|
||||
], function ($, TreeNodeView) {
|
||||
'use strict';
|
||||
|
||||
var $ = angular.element.bind(angular);
|
||||
|
||||
function TreeView() {
|
||||
this.ul = $('<ul class="tree"></ul>');
|
||||
this.nodeViews = [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user