mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 01:02:42 +01:00
Allow stacked comment actions to be explicitly ordered
Summary: Ref T6027. Normally, actions use the same order as the form, but in some cases (like moving stuff on workboards) it makes sense to reorder them explicitly. Pin "Move on board" near the bottom, and "projects/subscribers" at the bottom. I think these are generally reasonable rules in all cases. Test Plan: Opened menu, saw slightly better action order. Reviewers: chad Reviewed By: chad Maniphest Tasks: T6027 Differential Revision: https://secure.phabricator.com/D15639
This commit is contained in:
parent
67629aab14
commit
4d32c990ab
6 changed files with 32 additions and 1 deletions
|
@ -163,6 +163,7 @@ EODOCS
|
||||||
->setIsDefaultable(false)
|
->setIsDefaultable(false)
|
||||||
->setIsLockable(false)
|
->setIsLockable(false)
|
||||||
->setCommentActionLabel(pht('Move on Workboard'))
|
->setCommentActionLabel(pht('Move on Workboard'))
|
||||||
|
->setCommentActionOrder(2000)
|
||||||
->setColumnMap($column_map),
|
->setColumnMap($column_map),
|
||||||
id(new PhabricatorTextEditField())
|
id(new PhabricatorTextEditField())
|
||||||
->setKey('title')
|
->setKey('title')
|
||||||
|
|
|
@ -50,6 +50,7 @@ final class PhabricatorProjectsEditEngineExtension
|
||||||
->setIsCopyable(true)
|
->setIsCopyable(true)
|
||||||
->setUseEdgeTransactions(true)
|
->setUseEdgeTransactions(true)
|
||||||
->setCommentActionLabel(pht('Change Project Tags'))
|
->setCommentActionLabel(pht('Change Project Tags'))
|
||||||
|
->setCommentActionOrder(8000)
|
||||||
->setDescription(pht('Select project tags for the object.'))
|
->setDescription(pht('Select project tags for the object.'))
|
||||||
->setTransactionType($edge_type)
|
->setTransactionType($edge_type)
|
||||||
->setMetadataValue('edge:type', $project_edge_type)
|
->setMetadataValue('edge:type', $project_edge_type)
|
||||||
|
|
|
@ -45,6 +45,7 @@ final class PhabricatorSubscriptionsEditEngineExtension
|
||||||
->setIsCopyable(true)
|
->setIsCopyable(true)
|
||||||
->setUseEdgeTransactions(true)
|
->setUseEdgeTransactions(true)
|
||||||
->setCommentActionLabel(pht('Change Subscribers'))
|
->setCommentActionLabel(pht('Change Subscribers'))
|
||||||
|
->setCommentActionOrder(9000)
|
||||||
->setDescription(pht('Choose subscribers.'))
|
->setDescription(pht('Choose subscribers.'))
|
||||||
->setTransactionType($subscribers_type)
|
->setTransactionType($subscribers_type)
|
||||||
->setValue($sub_phids);
|
->setValue($sub_phids);
|
||||||
|
|
|
@ -6,6 +6,7 @@ abstract class PhabricatorEditEngineCommentAction extends Phobject {
|
||||||
private $label;
|
private $label;
|
||||||
private $value;
|
private $value;
|
||||||
private $initialValue;
|
private $initialValue;
|
||||||
|
private $order;
|
||||||
|
|
||||||
abstract public function getPHUIXControlType();
|
abstract public function getPHUIXControlType();
|
||||||
abstract public function getPHUIXControlSpecification();
|
abstract public function getPHUIXControlSpecification();
|
||||||
|
@ -37,6 +38,20 @@ abstract class PhabricatorEditEngineCommentAction extends Phobject {
|
||||||
return $this->value;
|
return $this->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setOrder($order) {
|
||||||
|
$this->order = $order;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getOrder() {
|
||||||
|
return $this->order;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSortVector() {
|
||||||
|
return id(new PhutilSortVector())
|
||||||
|
->addInt($this->getOrder());
|
||||||
|
}
|
||||||
|
|
||||||
public function setInitialValue($initial_value) {
|
public function setInitialValue($initial_value) {
|
||||||
$this->initialValue = $initial_value;
|
$this->initialValue = $initial_value;
|
||||||
return $this;
|
return $this;
|
||||||
|
|
|
@ -1382,6 +1382,8 @@ abstract class PhabricatorEditEngine
|
||||||
$comment_actions[$key] = $comment_action;
|
$comment_actions[$key] = $comment_action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$comment_actions = msortv($comment_actions, 'getSortVector');
|
||||||
|
|
||||||
$view->setCommentActions($comment_actions);
|
$view->setCommentActions($comment_actions);
|
||||||
|
|
||||||
return $view;
|
return $view;
|
||||||
|
|
|
@ -24,6 +24,7 @@ abstract class PhabricatorEditField extends Phobject {
|
||||||
|
|
||||||
private $commentActionLabel;
|
private $commentActionLabel;
|
||||||
private $commentActionValue;
|
private $commentActionValue;
|
||||||
|
private $commentActionOrder = 1000;
|
||||||
private $hasCommentActionValue;
|
private $hasCommentActionValue;
|
||||||
|
|
||||||
private $isLocked;
|
private $isLocked;
|
||||||
|
@ -243,6 +244,15 @@ abstract class PhabricatorEditField extends Phobject {
|
||||||
return $this->commentActionLabel;
|
return $this->commentActionLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setCommentActionOrder($order) {
|
||||||
|
$this->commentActionOrder = $order;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCommentActionOrder() {
|
||||||
|
return $this->commentActionOrder;
|
||||||
|
}
|
||||||
|
|
||||||
public function setCommentActionValue($comment_action_value) {
|
public function setCommentActionValue($comment_action_value) {
|
||||||
$this->hasCommentActionValue = true;
|
$this->hasCommentActionValue = true;
|
||||||
$this->commentActionValue = $comment_action_value;
|
$this->commentActionValue = $comment_action_value;
|
||||||
|
@ -686,7 +696,8 @@ abstract class PhabricatorEditField extends Phobject {
|
||||||
$action
|
$action
|
||||||
->setKey($this->getKey())
|
->setKey($this->getKey())
|
||||||
->setLabel($label)
|
->setLabel($label)
|
||||||
->setValue($this->getValueForCommentAction($value));
|
->setValue($this->getValueForCommentAction($value))
|
||||||
|
->setOrder($this->getCommentActionOrder());
|
||||||
|
|
||||||
return $action;
|
return $action;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue