Changeset View
Changeset View
Standalone View
Standalone View
src/applications/slowvote/view/SlowvoteEmbedView.php
Show All 33 Lines | public function render() { | ||||
$options = $poll->getOptions(); | $options = $poll->getOptions(); | ||||
if ($poll->getShuffle()) { | if ($poll->getShuffle()) { | ||||
shuffle($options); | shuffle($options); | ||||
} | } | ||||
require_celerity_resource('phabricator-slowvote-css'); | require_celerity_resource('phabricator-slowvote-css'); | ||||
require_celerity_resource('javelin-behavior-slowvote-embed'); | |||||
$config = array( | |||||
'pollID' => $poll->getID(), | |||||
); | |||||
Javelin::initBehavior('slowvote-embed', $config); | |||||
$user_choices = $poll->getViewerChoices($this->getUser()); | $user_choices = $poll->getViewerChoices($this->getUser()); | ||||
$user_choices = mpull($user_choices, 'getOptionID', 'getOptionID'); | $user_choices = mpull($user_choices, 'getOptionID', 'getOptionID'); | ||||
$out = array(); | $out = array(); | ||||
foreach ($options as $option) { | foreach ($options as $option) { | ||||
$is_selected = isset($user_choices[$option->getID()]); | $is_selected = isset($user_choices[$option->getID()]); | ||||
$out[] = $this->renderLabel($option, $is_selected); | $out[] = $this->renderLabel($option, $is_selected); | ||||
▲ Show 20 Lines • Show All 286 Lines • Show Last 20 Lines |