Changeset 522
- Timestamp:
- 08/07/07 23:25:42 (1 year ago)
- Files:
-
- pagoda/trunk/Pagoda/pagoda/widgets/admin/static/css/site_tree.css (modified) (1 diff)
- pagoda/trunk/Pagoda/pagoda/widgets/admin/static/css/tree.css (modified) (6 diffs)
- pagoda/trunk/Pagoda/pagoda/widgets/admin/static/javascript/site_tree.js (modified) (1 diff)
- pagoda/trunk/Pagoda/pagoda/widgets/admin/static/javascript/tree_menu.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
pagoda/trunk/Pagoda/pagoda/widgets/admin/static/css/site_tree.css
r511 r522 10 10 height: 16px; 11 11 background-image: url("../images/layout.png"); 12 }13 14 /* Selected node should display an arrow pointing towards the menu */15 #site_tree .x-tree-node div.x-tree-selected {16 background-image: url("../images/arrow-panel-right.png");17 background-repeat: no-repeat;18 background-position: 97% 52%;19 12 } 20 13 pagoda/trunk/Pagoda/pagoda/widgets/admin/static/css/tree.css
r511 r522 4 4 text-align: left; 5 5 font-size: 100%; 6 position: relative; 6 7 } 7 8 8 9 /* Tree nodes should have a nice color, even when being dragged around */ 9 .x-tree-node a span, .x-dd-drag-ghost a span { 10 .x-tree-node a span, 11 .x-dd-drag-ghost a span { 10 12 text-decoration: underline; 11 13 color: #01e; … … 13 15 } 14 16 15 /* Tree nodes and Menu should be the same height */ 17 /* Selected tree node and menu items should have the same text color */ 18 .x-tree-node .x-tree-selected a span, 19 .tree-menu .x-menu-list-item button { 20 color: #03f; 21 } 22 23 /* Selected tree node should be bold and not have any background color */ 24 .x-tree-node .x-tree-selected a span { 25 background: transparent; 26 font-weight: bold; 27 } 28 29 /* Tree nodes and menu should be the same height */ 16 30 li.x-tree-node, 17 31 .ydd-drag-ghost a span, … … 20 34 } 21 35 22 /* Selected tree nodes (and their menu) should be styled nicely */ 23 .x-tree-node .x-tree-selected, 36 /* Style the menu */ 24 37 div.tree-menu { 25 38 background-color: #d5e5ff; … … 27 40 border: 1px solid #61839F; 28 41 } 29 .x-tree-node .x-tree-selected a span {30 background: transparent;31 font-weight: bold;32 }33 42 34 /* Don't let unused tree layout images force the line height to be larger */43 /* Don't let unused tree layout images force the line height to be larger than it needs to be */ 35 44 .x-tree-icon, 36 45 .x-tree-ec-icon, … … 45 54 } 46 55 47 /* Make it look like menu and selected tree node share a border */48 .x-tree-node .x-tree-selected {49 border-right: 0px none;50 }51 div.tree-menu {52 border-left: 0px none;53 }54 55 56 /* Nice hover-color for Tree Menu buttons */ 56 57 .tree-menu button:hover { 57 58 background-color: #E4EEFF; 58 }59 60 /* Tree Nodes and Menu Items should have the same color */61 .x-tree-node .x-tree-selected a span,62 .tree-menu .x-menu-list-item button {63 color: #03f;64 59 } 65 60 … … 85 80 border: 0; 86 81 } 87 88 /* Menu should be horizontal (not vertical, which is the default) */89 .tree-menu li,90 .tree-menu button {91 display: inline;92 }pagoda/trunk/Pagoda/pagoda/widgets/admin/static/javascript/site_tree.js
r511 r522 71 71 }); 72 72 73 // Attach TreeMenu to this tree 74 this.menu. attachTo(this);73 // Attach TreeMenu to this tree, positioned to the right of the tree 74 this.menu.register(this, 'r'); 75 75 76 76 } pagoda/trunk/Pagoda/pagoda/widgets/admin/static/javascript/tree_menu.js
r511 r522 3 3 4 4 // Configure this menu 5 this.defaultAlign = 'tl-tr';6 5 this.shadow = false; 7 6 Ext.menu.TreeMenu.superclass.constructor.call(this, config); … … 18 17 }; 19 18 Ext.extend(Ext.menu.TreeMenu, Ext.menu.Menu, { 20 // Aligns top of menu to top of this.alignEl 21 align: function(el) { 22 this.getEl().setTop(this.alignEl.getTop()); 23 }, 24 // Override `show` to remember which element to align with 19 // Override `show` to position the menu underneath (in z-index terms) 20 // the `element`, which is expected to be a tree node, and style the 21 // menu to look like it's popping out of the tree node. 22 // `element` must be a tree node 23 // `position` should be 'r' or 'l' to have the menu pop out the 24 // right side or the left side of the tree node, respectively. 25 // (defaults to 'r') 26 // `parentMenu` is unused for this type of menu. 25 27 show: function(element, position, parentMenu) { 28 // Remember which element this menu is attached to 26 29 this.alignEl = Ext.get(element); 27 Ext.menu.TreeMenu.superclass.show.call(this, element, position, parentMenu); 30 31 // Ensure that this menu has been rendered 32 if (!this.el) { 33 this.render(); 34 } 35 36 // Fire 'beforeshow' event 37 this.fireEvent("beforeshow", this); 38 39 // Align this menu over 'element' with enough padding to fly out 40 var align_position = (position == 'r') ? 'tl-tl' : 'tr-tr'; 41 this.el.alignTo(this.alignEl, align_position); 42 var padding_position = (position == 'r') ? 'padding-left' : 'padding-right'; 43 this.el.setStyle(padding_position, this.alignEl.getWidth() + 'px'); 44 45 // Set z-index of menu and element so the menu appears behind 'element' 46 this.alignEl.setStyle('z-index', '15000'); 47 this.el.setStyle('z-index', '14999'); 48 49 // Show the menu 50 this.el.show(); 51 this.hidden = false; 52 53 // Fire 'show' event 54 this.fireEvent("show", this); 55 28 56 }, 29 57 // Attach this menu to the specified tree, adding event handlers 30 58 // to make the menu appear next to a node that was clicked. 31 attachTo: function(tree) { 59 // `tree` must be a valid TreePanel 60 // `position` should be 'r' or 'l' to have the menu pop out the 61 // right side or the left side of the tree node, respectively. 62 // (defaults to 'r') 63 register: function(tree, position) { 32 64 33 65 // Remember parameters … … 39 71 } 40 72 41 // Given a tree, ensures that the selected node is focused42 // (useful for giving focus back to a clicked tree node after menu is shown)43 var focus_active_node = function (tree) {44 var selection_model = tree.getSelectionModel();45 var selected_nodes = selection_model.getSelectedNodes();46 if (Ext.type(selected_nodes) == 'array') {47 Ext.each(selected_nodes, function(item, index, allItems) {48 var el = get_node_el(item);49 el.focus();50 });51 }52 }53 54 // When the menu is shown, give focus back to the active tree node and realign menu55 this.on('show', function() {56 focus_active_node.defer(60, {}, [this.tree]);57 this.align.defer(1, this); // needs the delay for some reason!?!58 }, this);59 60 73 // When a node in the tree is clicked, show the menu 61 74 this.tree.on('click', function(node) { 62 75 var node_el = get_node_el(node); 63 this.show(node_el );76 this.show(node_el, position); 64 77 }, this); 65 78 }
