1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-28 16:30:59 +01:00

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
This commit is contained in:
epriestley 2013-06-05 16:21:55 -07:00
parent 94c29007b6
commit f26be0e2d4
5 changed files with 40 additions and 56 deletions

View file

@ -125,9 +125,8 @@ abstract class PhabricatorDirectoryController extends PhabricatorController {
if ($is_hide) {
$label_id = celerity_generate_unique_node_id();
$attrs = array();
$attrs['style'] = 'display: none;';
$attrs['id'] = $label_id;
$label->setContainerAttrs($attrs);
$label->setStyle('display: none;');
$label->setID($label_id);
$tile_ids[] = $label_id;
}

View file

@ -89,10 +89,6 @@ abstract class AphrontTagView extends AphrontView {
return $this->renderChildren();
}
protected function renderTagContainer($tag) {
return $tag;
}
protected function willRender() {
return;
}
@ -126,8 +122,7 @@ abstract class AphrontTagView extends AphrontView {
$tag_view_attributes = array(
'id' => $this->id,
'class' => $this->classes ?
implode(' ', array_filter($this->classes)) : null,
'class' => implode(' ', $this->classes),
'style' => $this->style,
'meta' => $this->metadata,
@ -155,11 +150,9 @@ abstract class AphrontTagView extends AphrontView {
}
}
$tag = javelin_tag(
return javelin_tag(
$this->getTagName(),
$attributes,
$this->getTagContent());
return $this->renderTagContainer($tag);
}
}

View file

@ -19,15 +19,6 @@ final class PHUIListItemView extends AphrontTagView {
private $selected;
private $containerAttrs;
public function setProperty($property) {
$this->property = $property;
return $this;
}
public function getProperty() {
return $this->property;
}
public function setSelected($selected) {
$this->selected = $selected;
return $this;
@ -91,34 +82,26 @@ final class PHUIListItemView extends AphrontTagView {
return $this->isExternal;
}
// Maybe should be add ?
public function setContainerAttrs($attrs) {
$this->containerAttrs = $attrs;
return $this;
}
protected function getTagName() {
return $this->href ? 'a' : 'div';
}
protected function renderTagContainer($tag) {
$classes = array(
'phui-list-item-view',
'phui-list-item-'.$this->type,
$this->icon ? 'phui-list-item-has-icon' : null,
$this->selected ? 'phui-list-item-selected' : null
);
// This is derptastical
$this->containerAttrs['class'] = implode(' ', array_filter($classes));
return phutil_tag('li', $this->containerAttrs, $tag);
return 'li';
}
protected function getTagAttributes() {
$classes = array();
$classes[] = 'phui-list-item-view';
$classes[] = 'phui-list-item-'.$this->type;
if ($this->icon) {
$classes[] = 'phui-list-item-has-icon';
}
if ($this->selected) {
$classes[] = 'phui-list-item-selected';
}
return array(
'class' => $this->href ? 'phui-list-item-href' : '',
'href' => $this->href);
'class' => $classes,
);
}
protected function getTagContent() {
@ -149,11 +132,17 @@ final class PHUIListItemView extends AphrontTagView {
->setSpriteIcon($this->icon);
}
return array(
$icon,
$this->renderChildren(),
$name,
);
return phutil_tag(
$this->href ? 'a' : 'div',
array(
'href' => $this->href,
'class' => $this->href ? 'phui-list-item-href' : null,
),
array(
$icon,
$this->renderChildren(),
$name,
));
}
}

View file

@ -18,12 +18,15 @@ JX.behavior('maniphest-list-editor', function(config) {
new JX.FX(new_task).setDuration(500).start({opacity: [0, 1]});
};
JX.Stratcom.listen('click', 'maniphest-edit-task', function(e) {
e.kill();
var task = e.getNode('maniphest-task');
JX.Workflow.newFromLink(e.getNode('maniphest-edit-task'))
.setHandler(JX.bind(null, onedit, task))
.start();
JX.Stratcom.listen(
'click',
['maniphest-edit-task', 'tag:a'],
function(e) {
e.kill();
var task = e.getNode('maniphest-task');
JX.Workflow.newFromLink(e.getNode('tag:a'))
.setHandler(JX.bind(null, onedit, task))
.start();
});
});

View file

@ -30,7 +30,7 @@ JX.behavior('maniphest-subpriority-editor', function(config) {
});
draggable.listen('shouldBeginDrag', function(e) {
if (e.getNode('slippery')) {
if (e.getNode('slippery') || e.getNode('maniphest-edit-task')) {
JX.Stratcom.context().kill();
}
});