1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-29 00:40:57 +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) { if ($is_hide) {
$label_id = celerity_generate_unique_node_id(); $label_id = celerity_generate_unique_node_id();
$attrs = array(); $attrs = array();
$attrs['style'] = 'display: none;'; $label->setStyle('display: none;');
$attrs['id'] = $label_id; $label->setID($label_id);
$label->setContainerAttrs($attrs);
$tile_ids[] = $label_id; $tile_ids[] = $label_id;
} }

View file

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

View file

@ -19,15 +19,6 @@ final class PHUIListItemView extends AphrontTagView {
private $selected; private $selected;
private $containerAttrs; private $containerAttrs;
public function setProperty($property) {
$this->property = $property;
return $this;
}
public function getProperty() {
return $this->property;
}
public function setSelected($selected) { public function setSelected($selected) {
$this->selected = $selected; $this->selected = $selected;
return $this; return $this;
@ -91,34 +82,26 @@ final class PHUIListItemView extends AphrontTagView {
return $this->isExternal; return $this->isExternal;
} }
// Maybe should be add ?
public function setContainerAttrs($attrs) {
$this->containerAttrs = $attrs;
return $this;
}
protected function getTagName() { protected function getTagName() {
return $this->href ? 'a' : 'div'; return 'li';
}
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);
} }
protected function getTagAttributes() { 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( return array(
'class' => $this->href ? 'phui-list-item-href' : '', 'class' => $classes,
'href' => $this->href); );
} }
protected function getTagContent() { protected function getTagContent() {
@ -149,11 +132,17 @@ final class PHUIListItemView extends AphrontTagView {
->setSpriteIcon($this->icon); ->setSpriteIcon($this->icon);
} }
return array( return phutil_tag(
$icon, $this->href ? 'a' : 'div',
$this->renderChildren(), array(
$name, '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]}); new JX.FX(new_task).setDuration(500).start({opacity: [0, 1]});
}; };
JX.Stratcom.listen('click', 'maniphest-edit-task', function(e) { JX.Stratcom.listen(
e.kill(); 'click',
var task = e.getNode('maniphest-task'); ['maniphest-edit-task', 'tag:a'],
JX.Workflow.newFromLink(e.getNode('maniphest-edit-task')) function(e) {
.setHandler(JX.bind(null, onedit, task)) e.kill();
.start(); 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) { draggable.listen('shouldBeginDrag', function(e) {
if (e.getNode('slippery')) { if (e.getNode('slippery') || e.getNode('maniphest-edit-task')) {
JX.Stratcom.context().kill(); JX.Stratcom.context().kill();
} }
}); });