Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/application/diff/DiffPathView.js
| Show All 15 Lines | members: { | ||||
| _selected: false, | _selected: false, | ||||
| _focused: false, | _focused: false, | ||||
| _icon: null, | _icon: null, | ||||
| _indentNode: null, | _indentNode: null, | ||||
| _pathNode: null, | _pathNode: null, | ||||
| _changeset: null, | _changeset: null, | ||||
| _inlineNode: null, | _inlineNode: null, | ||||
| _isDirectory: false, | |||||
| _displayPath: null, | |||||
| getNode: function() { | getNode: function() { | ||||
| if (!this._node) { | if (!this._node) { | ||||
| var attrs = { | var attrs = { | ||||
| className: 'diff-tree-path' | className: 'diff-tree-path' | ||||
| }; | }; | ||||
| this._node = JX.$N('li', attrs, this._getIndentNode()); | this._node = JX.$N('li', attrs, this._getIndentNode()); | ||||
| var onclick = JX.bind(this, this._onclick); | var onclick = JX.bind(this, this._onclick); | ||||
| JX.DOM.listen(this._node, 'click', null, onclick); | JX.DOM.listen(this._node, 'click', null, onclick); | ||||
| } | } | ||||
| return this._node; | return this._node; | ||||
| }, | }, | ||||
| getIcon: function() { | getIcon: function() { | ||||
| if (!this._icon) { | if (!this._icon) { | ||||
| this._icon = new JX.PHUIXIconView(); | this._icon = new JX.PHUIXIconView(); | ||||
| } | } | ||||
| return this._icon; | return this._icon; | ||||
| }, | }, | ||||
| setPath: function(path) { | setPath: function(path) { | ||||
| this._path = path; | this._path = path; | ||||
| this._redrawPath(); | |||||
| return this; | |||||
| }, | |||||
| var display = this._path[this._path.length - 1]; | setDisplayPath: function(path) { | ||||
| JX.DOM.setContent(this._getPathNode(), display); | this._displayPath = path; | ||||
| this._redrawPath(); | |||||
| return this; | |||||
| }, | |||||
| setIsDirectory: function(is_directory) { | |||||
| this._isDirectory = is_directory; | |||||
| this._redrawPath(); | |||||
| return this; | return this; | ||||
| }, | }, | ||||
| setChangeset: function(changeset) { | setChangeset: function(changeset) { | ||||
| this._changeset = changeset; | this._changeset = changeset; | ||||
| var node = this.getNode(); | var node = this.getNode(); | ||||
| JX.DOM.alterClass(node, 'diff-tree-path-changeset', !!changeset); | JX.DOM.alterClass(node, 'diff-tree-path-changeset', !!changeset); | ||||
| return this; | return this; | ||||
| }, | }, | ||||
| getChangeset: function() { | getChangeset: function() { | ||||
| return this._changeset; | return this._changeset; | ||||
| }, | }, | ||||
| getPath: function() { | getPath: function() { | ||||
| return this._path; | return this._path; | ||||
| }, | }, | ||||
| setHidden: function(hidden) { | |||||
| this._hidden = hidden; | |||||
| var node = this.getNode(); | |||||
| if (this._hidden) { | |||||
| JX.DOM.hide(node); | |||||
| } else { | |||||
| JX.DOM.show(node); | |||||
| } | |||||
| return this; | |||||
| }, | |||||
| setDepth: function(depth) { | setDepth: function(depth) { | ||||
| this._depth = depth; | this._depth = depth; | ||||
| this._getIndentNode().style.marginLeft = (6 * this._depth) + 'px'; | this._getIndentNode().style.marginLeft = (8 * this._depth) + 'px'; | ||||
| return this; | return this; | ||||
| }, | }, | ||||
| setIsSelected: function(selected) { | setIsSelected: function(selected) { | ||||
| this._selected = selected; | this._selected = selected; | ||||
| var node = this.getNode(); | var node = this.getNode(); | ||||
| ▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | members: { | ||||
| getInlineNode: function() { | getInlineNode: function() { | ||||
| if (!this._inlineNode) { | if (!this._inlineNode) { | ||||
| var attrs = { | var attrs = { | ||||
| className: 'diff-tree-path-inlines', | className: 'diff-tree-path-inlines', | ||||
| }; | }; | ||||
| this._inlineNode = JX.$N('div', attrs, '-'); | this._inlineNode = JX.$N('div', attrs, '-'); | ||||
| } | } | ||||
| return this._inlineNode; | return this._inlineNode; | ||||
| }, | |||||
| _redrawPath: function() { | |||||
| var display; | |||||
| if (this._displayPath) { | |||||
| display = this._displayPath; | |||||
| } else { | |||||
| display = this._path[this._path.length - 1]; | |||||
| } | |||||
| var is_directory = this._isDirectory; | |||||
| if (is_directory) { | |||||
| display = display + '/'; | |||||
| } | |||||
| JX.DOM.setContent(this._getPathNode(), display); | |||||
| } | } | ||||
| } | } | ||||
| }); | }); | ||||