Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/directory/controller/PhabricatorDirectoryController.php b/src/applications/directory/controller/PhabricatorDirectoryController.php
index 1ee343e4b9..bdf85b43db 100644
--- a/src/applications/directory/controller/PhabricatorDirectoryController.php
+++ b/src/applications/directory/controller/PhabricatorDirectoryController.php
@@ -1,177 +1,176 @@
<?php
abstract class PhabricatorDirectoryController extends PhabricatorController {
public function buildStandardPageResponse($view, array $data) {
$page = $this->buildStandardPageView();
$page->setBaseURI('/');
$page->setTitle(idx($data, 'title'));
$page->setGlyph("\xE2\x9A\x92");
$page->appendChild($view);
$response = new AphrontWebpageResponse();
return $response->setContent($page->render());
}
public function buildNav() {
$user = $this->getRequest()->getUser();
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI('/'));
$applications = PhabricatorApplication::getAllInstalledApplications();
foreach ($applications as $key => $application) {
if (!$application->shouldAppearInLaunchView()) {
// Remove hidden applications (usually internal stuff).
unset($applications[$key]);
}
$invisible = PhabricatorApplication::TILE_INVISIBLE;
if ($application->getDefaultTileDisplay($user) == $invisible) {
// Remove invisible applications (e.g., admin apps for non-admins).
unset($applications[$key]);
}
}
$status = array();
foreach ($applications as $key => $application) {
$status[get_class($application)] = $application->loadStatus($user);
}
$tile_groups = array();
$prefs = $user->loadPreferences()->getPreference(
PhabricatorUserPreferences::PREFERENCE_APP_TILES,
array());
foreach ($applications as $key => $application) {
$display = idx(
$prefs,
get_class($application),
$application->getDefaultTileDisplay($user));
$tile_groups[$display][] = $application;
}
$tile_groups = array_select_keys(
$tile_groups,
array(
PhabricatorApplication::TILE_FULL,
PhabricatorApplication::TILE_SHOW,
PhabricatorApplication::TILE_HIDE,
));
foreach ($tile_groups as $tile_display => $tile_group) {
if (!$tile_group) {
continue;
}
$is_small_tiles = ($tile_display == PhabricatorApplication::TILE_SHOW) ||
($tile_display == PhabricatorApplication::TILE_HIDE);
if ($is_small_tiles) {
$groups = PhabricatorApplication::getApplicationGroups();
$tile_group = mgroup($tile_group, 'getApplicationGroup');
$tile_group = array_select_keys($tile_group, array_keys($groups));
} else {
$tile_group = array($tile_group);
}
$is_hide = ($tile_display == PhabricatorApplication::TILE_HIDE);
if ($is_hide) {
$show_item_id = celerity_generate_unique_node_id();
$hide_item_id = celerity_generate_unique_node_id();
$show_item = id(new PHUIListItemView())
->setName(pht('Show More Applications'))
->setHref('#')
->addSigil('reveal-content')
->setID($show_item_id);
$hide_item = id(new PHUIListItemView())
->setName(pht('Show Fewer Applications'))
->setHref('#')
->setStyle('display: none')
->setID($hide_item_id)
->addSigil('reveal-content');
$nav->addMenuItem($show_item);
$tile_ids = array($hide_item_id);
}
foreach ($tile_group as $group => $application_list) {
$tiles = array();
foreach ($application_list as $key => $application) {
$tile = id(new PhabricatorApplicationLaunchView())
->setApplication($application)
->setApplicationStatus(
idx($status, get_class($application), array()))
->setUser($user);
if ($tile_display == PhabricatorApplication::TILE_FULL) {
$tile->setFullWidth(true);
}
$tiles[] = $tile;
}
if ($is_small_tiles) {
while (count($tiles) % 3) {
$tiles[] = id(new PhabricatorApplicationLaunchView());
}
$label = id(new PHUIListItemView())
->setType(PHUIListItemView::TYPE_LABEL)
->setName($groups[$group]);
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;
}
$nav->addMenuItem($label);
}
$group_id = celerity_generate_unique_node_id();
$tile_ids[] = $group_id;
$nav->addCustomBlock(
phutil_tag(
'div',
array(
'class' => 'application-tile-group',
'id' => $group_id,
'style' => ($is_hide ? 'display: none' : null),
),
mpull($tiles, 'render')));
}
if ($is_hide) {
Javelin::initBehavior('phabricator-reveal-content');
$show_item->setMetadata(
array(
'showIDs' => $tile_ids,
'hideIDs' => array($show_item_id),
));
$hide_item->setMetadata(
array(
'showIDs' => array($show_item_id),
'hideIDs' => $tile_ids,
));
$nav->addMenuItem($hide_item);
}
}
$nav->addFilter(
'',
pht('Customize Applications...'),
'/settings/panel/home/');
$nav->addClass('phabricator-side-menu-home');
$nav->selectFilter(null);
return $nav;
}
}
diff --git a/src/view/AphrontTagView.php b/src/view/AphrontTagView.php
index 3690e02675..55b93efcbd 100644
--- a/src/view/AphrontTagView.php
+++ b/src/view/AphrontTagView.php
@@ -1,165 +1,158 @@
<?php
/**
* View which renders down to a single tag, and provides common access for tag
* attributes (setting classes, sigils, IDs, etc).
*/
abstract class AphrontTagView extends AphrontView {
private $id;
private $classes = array();
private $sigils = array();
private $style;
private $metadata;
private $mustCapture;
private $workflow;
public function setWorkflow($workflow) {
$this->workflow = $workflow;
return $this;
}
public function getWorkflow() {
return $this->workflow;
}
public function setMustCapture($must_capture) {
$this->mustCapture = $must_capture;
return $this;
}
public function getMustCapture() {
return $this->mustCapture;
}
final public function setMetadata(array $metadata) {
$this->metadata = $metadata;
return $this;
}
final public function getMetadata() {
return $this->metadata;
}
final public function setStyle($style) {
$this->style = $style;
return $this;
}
final public function getStyle() {
return $this->style;
}
final public function addSigil($sigil) {
$this->sigils[] = $sigil;
return $this;
}
final public function getSigils() {
return $this->sigils;
}
public function addClass($class) {
$this->classes[] = $class;
return $this;
}
public function getClasses() {
return $this->classes;
}
public function setID($id) {
$this->id = $id;
return $this;
}
public function getID() {
return $this->id;
}
protected function getTagName() {
return 'div';
}
protected function getTagAttributes() {
return array();
}
protected function getTagContent() {
return $this->renderChildren();
}
- protected function renderTagContainer($tag) {
- return $tag;
- }
-
protected function willRender() {
return;
}
final public function render() {
$this->willRender();
$attributes = $this->getTagAttributes();
$implode = array('class', 'sigil');
foreach ($implode as $attr) {
if (isset($attributes[$attr])) {
if (is_array($attributes[$attr])) {
$attributes[$attr] = implode(' ', $attributes[$attr]);
}
}
}
if (!is_array($attributes)) {
$class = get_class($this);
throw new Exception(
pht("View '%s' did not return an array from getTagAttributes()!",
$class));
}
$sigils = $this->sigils;
if ($this->workflow) {
$sigils[] = 'workflow';
}
$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,
'sigil' => $sigils ? implode(' ', $sigils) : null,
'mustcapture' => $this->mustCapture,
);
foreach ($tag_view_attributes as $key => $value) {
if ($value === null) {
continue;
}
if (!isset($attributes[$key])) {
$attributes[$key] = $value;
continue;
}
switch ($key) {
case 'class':
case 'sigil':
$attributes[$key] = $attributes[$key].' '.$value;
break;
default:
// Use the explicitly set value rather than the tag default value.
$attributes[$key] = $value;
break;
}
}
- $tag = javelin_tag(
+ return javelin_tag(
$this->getTagName(),
$attributes,
$this->getTagContent());
-
- return $this->renderTagContainer($tag);
}
}
diff --git a/src/view/phui/PHUIListItemView.php b/src/view/phui/PHUIListItemView.php
index 7b4fb59ae5..df24a426ae 100644
--- a/src/view/phui/PHUIListItemView.php
+++ b/src/view/phui/PHUIListItemView.php
@@ -1,159 +1,148 @@
<?php
final class PHUIListItemView extends AphrontTagView {
const TYPE_LINK = 'type-link';
const TYPE_SPACER = 'type-spacer';
const TYPE_LABEL = 'type-label';
const TYPE_BUTTON = 'type-button';
const TYPE_CUSTOM = 'type-custom';
const TYPE_DIVIDER = 'type-divider';
const TYPE_ICON = 'type-icon';
private $name;
private $href;
private $type = self::TYPE_LINK;
private $isExternal;
private $key;
private $icon;
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;
}
public function getSelected() {
return $this->selected;
}
public function setIcon($icon) {
$this->icon = $icon;
return $this;
}
public function getIcon() {
return $this->icon;
}
public function setKey($key) {
$this->key = (string)$key;
return $this;
}
public function getKey() {
return $this->key;
}
public function setType($type) {
$this->type = $type;
return $this;
}
public function getType() {
return $this->type;
}
public function setHref($href) {
$this->href = $href;
return $this;
}
public function getHref() {
return $this->href;
}
public function setName($name) {
$this->name = $name;
return $this;
}
public function getName() {
return $this->name;
}
public function setIsExternal($is_external) {
$this->isExternal = $is_external;
return $this;
}
public function getIsExternal() {
return $this->isExternal;
}
- // Maybe should be add ?
- public function setContainerAttrs($attrs) {
- $this->containerAttrs = $attrs;
- return $this;
- }
-
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
- );
+ protected function getTagAttributes() {
+ $classes = array();
+ $classes[] = 'phui-list-item-view';
+ $classes[] = 'phui-list-item-'.$this->type;
- // This is derptastical
- $this->containerAttrs['class'] = implode(' ', array_filter($classes));
+ if ($this->icon) {
+ $classes[] = 'phui-list-item-has-icon';
+ }
- return phutil_tag('li', $this->containerAttrs, $tag);
- }
+ if ($this->selected) {
+ $classes[] = 'phui-list-item-selected';
+ }
- protected function getTagAttributes() {
return array(
- 'class' => $this->href ? 'phui-list-item-href' : '',
- 'href' => $this->href);
+ 'class' => $classes,
+ );
}
protected function getTagContent() {
$name = null;
$icon = null;
if ($this->name) {
$external = null;
if ($this->isExternal) {
$external = " \xE2\x86\x97";
}
$name = phutil_tag(
'span',
array(
'class' => 'phui-list-item-name',
),
array(
$this->name,
$external,
));
}
if ($this->icon) {
$icon = id(new PHUIIconView())
->addClass('phui-list-item-icon')
->setSpriteSheet(PHUIIconView::SPRITE_ICONS)
->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,
+ ));
}
}
diff --git a/webroot/rsrc/js/application/maniphest/behavior-list-edit.js b/webroot/rsrc/js/application/maniphest/behavior-list-edit.js
index 873b9d8aee..f5128289c6 100644
--- a/webroot/rsrc/js/application/maniphest/behavior-list-edit.js
+++ b/webroot/rsrc/js/application/maniphest/behavior-list-edit.js
@@ -1,29 +1,32 @@
/**
* @provides javelin-behavior-maniphest-list-editor
* @requires javelin-behavior
* javelin-dom
* javelin-stratcom
* javelin-workflow
* javelin-fx
* javelin-util
*/
JX.behavior('maniphest-list-editor', function(config) {
var onedit = function(task, r) {
var nodes = JX.$H(r.tasks).getFragment().firstChild;
var new_task = JX.DOM.find(nodes, 'li', 'maniphest-task');
JX.DOM.replace(task, new_task);
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();
});
});
diff --git a/webroot/rsrc/js/application/maniphest/behavior-subpriorityeditor.js b/webroot/rsrc/js/application/maniphest/behavior-subpriorityeditor.js
index 68abcc6fad..3e5a77a100 100644
--- a/webroot/rsrc/js/application/maniphest/behavior-subpriorityeditor.js
+++ b/webroot/rsrc/js/application/maniphest/behavior-subpriorityeditor.js
@@ -1,74 +1,74 @@
/**
* @provides javelin-behavior-maniphest-subpriority-editor
* @requires javelin-behavior
* javelin-dom
* javelin-vector
* javelin-stratcom
* javelin-workflow
* phabricator-draggable-list
*/
JX.behavior('maniphest-subpriority-editor', function(config) {
var draggable = new JX.DraggableList('maniphest-task')
.setFindItemsHandler(function() {
var tasks = JX.DOM.scry(document.body, 'li', 'maniphest-task');
var heads = JX.DOM.scry(document.body, 'h1', 'task-group');
return tasks.concat(heads);
})
.setGhostNode(JX.$N('li', {className: 'maniphest-subpriority-target'}))
.setGhostHandler(function(ghost, target) {
if (target.nextSibling) {
if (JX.DOM.isType(target, 'h1')) {
target.nextSibling.insertBefore(ghost, target.nextSibling.firstChild);
} else {
target.parentNode.insertBefore(ghost, target.nextSibling);
}
} else {
target.parentNode.appendChild(ghost);
}
});
draggable.listen('shouldBeginDrag', function(e) {
- if (e.getNode('slippery')) {
+ if (e.getNode('slippery') || e.getNode('maniphest-edit-task')) {
JX.Stratcom.context().kill();
}
});
draggable.listen('didBeginDrag', function(node) {
draggable.getGhostNode().style.height = JX.Vector.getDim(node).y + 'px';
JX.DOM.alterClass(node, 'maniphest-task-dragging', true);
});
draggable.listen('didEndDrag', function(node) {
JX.DOM.alterClass(node, 'maniphest-task-dragging', false);
});
draggable.listen('didDrop', function(node, after) {
var data = {
task: JX.Stratcom.getData(node).taskID
};
if (JX.DOM.isType(after, 'h1')) {
data.priority = JX.Stratcom.getData(after).priority;
} else {
data.after = JX.Stratcom.getData(after).taskID;
}
draggable.lock();
JX.DOM.alterClass(node, 'maniphest-task-loading', true);
var onresponse = function(r) {
var nodes = JX.$H(r.tasks).getFragment().firstChild;
var task = JX.DOM.find(nodes, 'li', 'maniphest-task');
JX.DOM.replace(node, task);
draggable.unlock();
};
new JX.Workflow(config.uri, data)
.setHandler(onresponse)
.start();
});
});

File Metadata

Mime Type
text/x-diff
Expires
Thu, Aug 14, 8:24 AM (1 d, 12 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
197524
Default Alt Text
(17 KB)

Event Timeline