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