Skip to content

Commit f26be0e

Browse files
author
epriestley
committedJun 5, 2013
Remove all the container node stuff from AphrontTagView
Summary: See discussion in D6131, D6130. This turned into 35 layers of mess so throw it away and just tweak the JS to be more flexible. Test Plan: - Clicked "Show More Applications". - Clicked "Show Fewer Applications". - Edited tasks using popup dialog. - Tried to drag tasks using pencil icon (correctly no longer works). - Changed threads in Conpherence. - Not sure how to actually hit the Conpherence "Load ... Threads" thing since it seems to auto-load? But that works, at least, and the code doesn't really care what you hit. - Added a conpherence participant. - Added a new calendar item. - Poked around other menus. Reviewers: chad Reviewed By: chad CC: aran Differential Revision: https://secure.phabricator.com/D6133
1 parent 94c2900 commit f26be0e

File tree

5 files changed

+38
-54
lines changed

5 files changed

+38
-54
lines changed
 

‎src/applications/directory/controller/PhabricatorDirectoryController.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,8 @@ public function buildNav() {
125125
if ($is_hide) {
126126
$label_id = celerity_generate_unique_node_id();
127127
$attrs = array();
128-
$attrs['style'] = 'display: none;';
129-
$attrs['id'] = $label_id;
130-
$label->setContainerAttrs($attrs);
128+
$label->setStyle('display: none;');
129+
$label->setID($label_id);
131130
$tile_ids[] = $label_id;
132131
}
133132

‎src/view/AphrontTagView.php

+2-9
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,6 @@ protected function getTagContent() {
8989
return $this->renderChildren();
9090
}
9191

92-
protected function renderTagContainer($tag) {
93-
return $tag;
94-
}
95-
9692
protected function willRender() {
9793
return;
9894
}
@@ -126,8 +122,7 @@ final public function render() {
126122
$tag_view_attributes = array(
127123
'id' => $this->id,
128124

129-
'class' => $this->classes ?
130-
implode(' ', array_filter($this->classes)) : null,
125+
'class' => implode(' ', $this->classes),
131126
'style' => $this->style,
132127

133128
'meta' => $this->metadata,
@@ -155,11 +150,9 @@ final public function render() {
155150
}
156151
}
157152

158-
$tag = javelin_tag(
153+
return javelin_tag(
159154
$this->getTagName(),
160155
$attributes,
161156
$this->getTagContent());
162-
163-
return $this->renderTagContainer($tag);
164157
}
165158
}

‎src/view/phui/PHUIListItemView.php

+24-35
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,6 @@ final class PHUIListItemView extends AphrontTagView {
1919
private $selected;
2020
private $containerAttrs;
2121

22-
public function setProperty($property) {
23-
$this->property = $property;
24-
return $this;
25-
}
26-
27-
public function getProperty() {
28-
return $this->property;
29-
}
30-
3122
public function setSelected($selected) {
3223
$this->selected = $selected;
3324
return $this;
@@ -91,34 +82,26 @@ public function getIsExternal() {
9182
return $this->isExternal;
9283
}
9384

94-
// Maybe should be add ?
95-
public function setContainerAttrs($attrs) {
96-
$this->containerAttrs = $attrs;
97-
return $this;
98-
}
99-
10085
protected function getTagName() {
101-
return $this->href ? 'a' : 'div';
86+
return 'li';
10287
}
10388

104-
protected function renderTagContainer($tag) {
105-
$classes = array(
106-
'phui-list-item-view',
107-
'phui-list-item-'.$this->type,
108-
$this->icon ? 'phui-list-item-has-icon' : null,
109-
$this->selected ? 'phui-list-item-selected' : null
110-
);
89+
protected function getTagAttributes() {
90+
$classes = array();
91+
$classes[] = 'phui-list-item-view';
92+
$classes[] = 'phui-list-item-'.$this->type;
11193

112-
// This is derptastical
113-
$this->containerAttrs['class'] = implode(' ', array_filter($classes));
94+
if ($this->icon) {
95+
$classes[] = 'phui-list-item-has-icon';
96+
}
11497

115-
return phutil_tag('li', $this->containerAttrs, $tag);
116-
}
98+
if ($this->selected) {
99+
$classes[] = 'phui-list-item-selected';
100+
}
117101

118-
protected function getTagAttributes() {
119102
return array(
120-
'class' => $this->href ? 'phui-list-item-href' : '',
121-
'href' => $this->href);
103+
'class' => $classes,
104+
);
122105
}
123106

124107
protected function getTagContent() {
@@ -149,11 +132,17 @@ protected function getTagContent() {
149132
->setSpriteIcon($this->icon);
150133
}
151134

152-
return array(
153-
$icon,
154-
$this->renderChildren(),
155-
$name,
156-
);
135+
return phutil_tag(
136+
$this->href ? 'a' : 'div',
137+
array(
138+
'href' => $this->href,
139+
'class' => $this->href ? 'phui-list-item-href' : null,
140+
),
141+
array(
142+
$icon,
143+
$this->renderChildren(),
144+
$name,
145+
));
157146
}
158147

159148
}

‎webroot/rsrc/js/application/maniphest/behavior-list-edit.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,15 @@ JX.behavior('maniphest-list-editor', function(config) {
1818
new JX.FX(new_task).setDuration(500).start({opacity: [0, 1]});
1919
};
2020

21-
JX.Stratcom.listen('click', 'maniphest-edit-task', function(e) {
22-
e.kill();
23-
var task = e.getNode('maniphest-task');
24-
JX.Workflow.newFromLink(e.getNode('maniphest-edit-task'))
25-
.setHandler(JX.bind(null, onedit, task))
26-
.start();
21+
JX.Stratcom.listen(
22+
'click',
23+
['maniphest-edit-task', 'tag:a'],
24+
function(e) {
25+
e.kill();
26+
var task = e.getNode('maniphest-task');
27+
JX.Workflow.newFromLink(e.getNode('tag:a'))
28+
.setHandler(JX.bind(null, onedit, task))
29+
.start();
2730
});
2831

2932
});

‎webroot/rsrc/js/application/maniphest/behavior-subpriorityeditor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ JX.behavior('maniphest-subpriority-editor', function(config) {
3030
});
3131

3232
draggable.listen('shouldBeginDrag', function(e) {
33-
if (e.getNode('slippery')) {
33+
if (e.getNode('slippery') || e.getNode('maniphest-edit-task')) {
3434
JX.Stratcom.context().kill();
3535
}
3636
});

0 commit comments

Comments
 (0)
Failed to load comments.