1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Render slowvote respondents as a facepile instead of smushed-together names

Summary: Make this more usable. Also fix a bug where $choices got overriden by a
loop variable.
Test Plan: Looked at a vote with multiple respondents.
Reviewed By: jungejason
Reviewers: tuomaspelkonen, jungejason, aran, codeblock
CC: aran, jungejason
Differential Revision: 629
This commit is contained in:
epriestley 2011-07-09 10:22:11 -07:00
parent 227d75c38c
commit 84c7ba24c3
4 changed files with 80 additions and 47 deletions

View file

@ -1071,7 +1071,7 @@ celerity_register_resource_map(array(
),
'phabricator-remarkup-css' =>
array(
'uri' => '/res/e0c44a00/rsrc/css/core/remarkup.css',
'uri' => '/res/a6acb5f0/rsrc/css/core/remarkup.css',
'type' => 'css',
'requires' =>
array(
@ -1101,7 +1101,7 @@ celerity_register_resource_map(array(
),
'phabricator-slowvote-css' =>
array(
'uri' => '/res/25f0375b/rsrc/css/application/slowvote/slowvote.css',
'uri' => '/res/0a95e217/rsrc/css/application/slowvote/slowvote.css',
'type' => 'css',
'requires' =>
array(
@ -1183,30 +1183,6 @@ celerity_register_resource_map(array(
'uri' => '/res/pkg/307df223/javelin.pkg.js',
'type' => 'js',
),
'8e9024dc' =>
array (
'name' => 'core.pkg.css',
'symbols' =>
array (
0 => 'phabricator-core-css',
1 => 'phabricator-core-buttons-css',
2 => 'phabricator-standard-page-view',
3 => 'aphront-dialog-view-css',
4 => 'aphront-form-view-css',
5 => 'aphront-panel-view-css',
6 => 'aphront-side-nav-view-css',
7 => 'aphront-table-view-css',
8 => 'aphront-crumbs-view-css',
9 => 'aphront-tokenizer-control-css',
10 => 'aphront-typeahead-control-css',
11 => 'aphront-list-filter-view-css',
12 => 'phabricator-directory-css',
13 => 'phabricator-remarkup-css',
14 => 'syntax-highlighting-css',
),
'uri' => '/res/pkg/8e9024dc/core.pkg.css',
'type' => 'css',
),
'95b66c1a' =>
array (
'name' => 'differential.pkg.css',
@ -1254,18 +1230,42 @@ celerity_register_resource_map(array(
'uri' => '/res/pkg/da416e1c/differential.pkg.js',
'type' => 'js',
),
'fd3dc470' =>
array (
'name' => 'core.pkg.css',
'symbols' =>
array (
0 => 'phabricator-core-css',
1 => 'phabricator-core-buttons-css',
2 => 'phabricator-standard-page-view',
3 => 'aphront-dialog-view-css',
4 => 'aphront-form-view-css',
5 => 'aphront-panel-view-css',
6 => 'aphront-side-nav-view-css',
7 => 'aphront-table-view-css',
8 => 'aphront-crumbs-view-css',
9 => 'aphront-tokenizer-control-css',
10 => 'aphront-typeahead-control-css',
11 => 'aphront-list-filter-view-css',
12 => 'phabricator-directory-css',
13 => 'phabricator-remarkup-css',
14 => 'syntax-highlighting-css',
),
'uri' => '/res/pkg/fd3dc470/core.pkg.css',
'type' => 'css',
),
),
'reverse' =>
array (
'aphront-crumbs-view-css' => '8e9024dc',
'aphront-dialog-view-css' => '8e9024dc',
'aphront-form-view-css' => '8e9024dc',
'aphront-list-filter-view-css' => '8e9024dc',
'aphront-panel-view-css' => '8e9024dc',
'aphront-side-nav-view-css' => '8e9024dc',
'aphront-table-view-css' => '8e9024dc',
'aphront-tokenizer-control-css' => '8e9024dc',
'aphront-typeahead-control-css' => '8e9024dc',
'aphront-crumbs-view-css' => 'fd3dc470',
'aphront-dialog-view-css' => 'fd3dc470',
'aphront-form-view-css' => 'fd3dc470',
'aphront-list-filter-view-css' => 'fd3dc470',
'aphront-panel-view-css' => 'fd3dc470',
'aphront-side-nav-view-css' => 'fd3dc470',
'aphront-table-view-css' => 'fd3dc470',
'aphront-tokenizer-control-css' => 'fd3dc470',
'aphront-typeahead-control-css' => 'fd3dc470',
'differential-changeset-view-css' => '95b66c1a',
'differential-core-view-css' => '95b66c1a',
'differential-revision-add-comment-css' => '95b66c1a',
@ -1302,13 +1302,13 @@ celerity_register_resource_map(array(
'javelin-util' => '307df223',
'javelin-vector' => '307df223',
'javelin-workflow' => 'd0713563',
'phabricator-core-buttons-css' => '8e9024dc',
'phabricator-core-css' => '8e9024dc',
'phabricator-directory-css' => '8e9024dc',
'phabricator-core-buttons-css' => 'fd3dc470',
'phabricator-core-css' => 'fd3dc470',
'phabricator-directory-css' => 'fd3dc470',
'phabricator-keyboard-shortcut' => 'd0713563',
'phabricator-keyboard-shortcut-manager' => 'd0713563',
'phabricator-remarkup-css' => '8e9024dc',
'phabricator-standard-page-view' => '8e9024dc',
'syntax-highlighting-css' => '8e9024dc',
'phabricator-remarkup-css' => 'fd3dc470',
'phabricator-standard-page-view' => 'fd3dc470',
'syntax-highlighting-css' => 'fd3dc470',
),
));

View file

@ -110,7 +110,9 @@ class PhabricatorSlowvotePollController
$poll->getAuthorPHID(),
));
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
$query = new PhabricatorObjectHandleData($phids);
$handles = $query->loadHandles();
$objects = $query->loadObjects();
if ($poll->getShuffle()) {
shuffle($options);
@ -129,8 +131,8 @@ class PhabricatorSlowvotePollController
switch ($poll->getMethod()) {
case PhabricatorSlowvotePoll::METHOD_PLURALITY:
$choice_ids = array();
foreach ($choices_by_user as $user_phid => $choices) {
$choice_ids[$user_phid] = head($choices)->getOptionID();
foreach ($choices_by_user as $user_phid => $user_choices) {
$choice_ids[$user_phid] = head($user_choices)->getOptionID();
}
foreach ($comments as $comment) {
$choice = idx($choice_ids, $comment->getAuthorPHID());
@ -154,7 +156,8 @@ class PhabricatorSlowvotePollController
$viewer_choices,
$choices_by_option,
$comments_by_option,
$handles);
$handles,
$objects);
if ($viewer_choices) {
$instructions =
@ -350,7 +353,8 @@ class PhabricatorSlowvotePollController
array $viewer_choices,
array $choices_by_option,
array $comments_by_option,
array $handles) {
array $handles,
array $objects) {
$viewer_phid = $this->getRequest()->getUser()->getPHID();
@ -392,7 +396,25 @@ class PhabricatorSlowvotePollController
if ($users) {
$user_markup = array();
foreach ($users as $handle) {
$user_markup[] = $handle->renderLink();
$object = idx($objects, $handle->getPHID());
if (!$object) {
continue;
}
$profile_image = PhabricatorFileURI::getViewURIForPHID(
$object->getProfileImagePHID());
$user_markup[] = phutil_render_tag(
'a',
array(
'href' => $handle->getURI(),
'class' => 'phabricator-slowvote-facepile',
),
phutil_render_tag(
'img',
array(
'src' => $profile_image,
)));
}
$user_markup = implode('', $user_markup);
} else {
@ -416,6 +438,7 @@ class PhabricatorSlowvotePollController
'<h1>'.phutil_escape_html($option->getName()).'</h1>'.
'<hr class="phabricator-slowvote-hr" />'.
$user_markup.
'<div style="clear: both;">'.
'<hr class="phabricator-slowvote-hr" />'.
$comment_markup.
'</div>');

View file

@ -9,6 +9,7 @@
phutil_require_module('phabricator', 'aphront/response/404');
phutil_require_module('phabricator', 'aphront/response/redirect');
phutil_require_module('phabricator', 'applications/differential/parser/markup');
phutil_require_module('phabricator', 'applications/files/uri');
phutil_require_module('phabricator', 'applications/phid/handle/data');
phutil_require_module('phabricator', 'applications/slowvote/controller/base');
phutil_require_module('phabricator', 'applications/slowvote/storage/choice');

View file

@ -58,3 +58,12 @@
width: auto;
margin-right: 12px;
}
.phabricator-slowvote-facepile {
width: 50px;
height: 50px;
overflow: hidden;
position: relative;
float: left;
margin: 0px 4px 6px 0px;
}