mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 01:02:42 +01:00
Make a handful of minor Slowvote behaviors more consistent with other applications
Summary: Ref T12685. - Better icon/color/label consistency. - Make "0" a valid response. - Fix a bug where creating a poll with Quicksand enabled led to bad times (form submitted back to the search screen). Test Plan: {F4956412} Reviewers: chad, amckinley Reviewed By: chad Maniphest Tasks: T12685 Differential Revision: https://secure.phabricator.com/D17878
This commit is contained in:
parent
d2e1dd0ef0
commit
c7a6422559
5 changed files with 25 additions and 5 deletions
|
@ -68,7 +68,13 @@ final class PhabricatorSlowvoteEditController
|
|||
}
|
||||
|
||||
if ($is_new) {
|
||||
$responses = array_filter($responses);
|
||||
// NOTE: Make sure common and useful response "0" is preserved.
|
||||
foreach ($responses as $key => $response) {
|
||||
if (!strlen($response)) {
|
||||
unset($responses[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($responses)) {
|
||||
$errors[] = pht('You must offer at least one response.');
|
||||
$e_response = pht('Required');
|
||||
|
@ -139,13 +145,14 @@ final class PhabricatorSlowvoteEditController
|
|||
}
|
||||
|
||||
return id(new AphrontRedirectResponse())
|
||||
->setURI('/V'.$poll->getID());
|
||||
->setURI($poll->getURI());
|
||||
} else {
|
||||
$poll->setViewPolicy($v_view_policy);
|
||||
}
|
||||
}
|
||||
|
||||
$form = id(new AphrontFormView())
|
||||
->setAction($request->getrequestURI())
|
||||
->setUser($viewer)
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
|
|
|
@ -35,9 +35,9 @@ final class PhabricatorSlowvotePollController
|
|||
));
|
||||
}
|
||||
|
||||
$header_icon = $poll->getIsClosed() ? 'fa-ban' : 'fa-circle-o';
|
||||
$header_icon = $poll->getIsClosed() ? 'fa-ban' : 'fa-square-o';
|
||||
$header_name = $poll->getIsClosed() ? pht('Closed') : pht('Open');
|
||||
$header_color = $poll->getIsClosed() ? 'dark' : 'bluegrey';
|
||||
$header_color = $poll->getIsClosed() ? 'indigo' : 'bluegrey';
|
||||
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setHeader($poll->getQuestion())
|
||||
|
@ -89,7 +89,7 @@ final class PhabricatorSlowvotePollController
|
|||
|
||||
$is_closed = $poll->getIsClosed();
|
||||
$close_poll_text = $is_closed ? pht('Reopen Poll') : pht('Close Poll');
|
||||
$close_poll_icon = $is_closed ? 'fa-play-circle-o' : 'fa-ban';
|
||||
$close_poll_icon = $is_closed ? 'fa-check' : 'fa-ban';
|
||||
|
||||
$curtain->addAction(
|
||||
id(new PhabricatorActionView())
|
||||
|
|
|
@ -11,6 +11,14 @@ final class PhabricatorSlowvoteEditor
|
|||
return pht('Slowvote');
|
||||
}
|
||||
|
||||
public function getCreateObjectTitle($author, $object) {
|
||||
return pht('%s created this poll.', $author);
|
||||
}
|
||||
|
||||
public function getCreateObjectTitleForFeed($author, $object) {
|
||||
return pht('%s created %s.', $author, $object);
|
||||
}
|
||||
|
||||
public function getTransactionTypes() {
|
||||
$types = parent::getTransactionTypes();
|
||||
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
|
||||
|
|
|
@ -55,6 +55,7 @@ final class PhabricatorSlowvoteSearchEngine
|
|||
|
||||
id(new PhabricatorSearchCheckboxesField())
|
||||
->setKey('statuses')
|
||||
->setLabel(pht('Statuses'))
|
||||
->setOptions(array(
|
||||
'open' => pht('Open'),
|
||||
'closed' => pht('Closed'),
|
||||
|
|
|
@ -112,6 +112,10 @@ final class PhabricatorSlowvotePoll extends PhabricatorSlowvoteDAO
|
|||
return 'V'.$this->getID();
|
||||
}
|
||||
|
||||
public function getURI() {
|
||||
return '/'.$this->getMonogram();
|
||||
}
|
||||
|
||||
public function save() {
|
||||
if (!$this->getMailKey()) {
|
||||
$this->setMailKey(Filesystem::readRandomCharacters(20));
|
||||
|
|
Loading…
Reference in a new issue