Differential D17861 Diff 43049 src/infrastructure/diff/view/PHUIDiffTwoUpInlineCommentRowScaffold.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/diff/view/PHUIDiffTwoUpInlineCommentRowScaffold.php
Show All 21 Lines | if (count($inlines) > 2) { | ||||
pht('Two-up inline row scaffold must have at most two inline views.')); | pht('Two-up inline row scaffold must have at most two inline views.')); | ||||
} | } | ||||
if (count($inlines) == 1) { | if (count($inlines) == 1) { | ||||
$inline = head($inlines); | $inline = head($inlines); | ||||
if ($inline->getIsOnRight()) { | if ($inline->getIsOnRight()) { | ||||
$left_side = null; | $left_side = null; | ||||
$right_side = $inline; | $right_side = $inline; | ||||
$left_hidden = null; | |||||
$right_hidden = $inline->newHiddenIcon(); | |||||
} else { | } else { | ||||
$left_side = $inline; | $left_side = $inline; | ||||
$right_side = null; | $right_side = null; | ||||
$left_hidden = $inline->newHiddenIcon(); | |||||
$right_hidden = null; | |||||
} | } | ||||
} else { | } else { | ||||
list($u, $v) = $inlines; | list($u, $v) = $inlines; | ||||
if ($u->getIsOnRight() == $v->getIsOnRight()) { | if ($u->getIsOnRight() == $v->getIsOnRight()) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Two-up inline row scaffold must have one comment on the left and '. | 'Two-up inline row scaffold must have one comment on the left and '. | ||||
'one comment on the right when showing two comments.')); | 'one comment on the right when showing two comments.')); | ||||
} | } | ||||
if ($v->getIsOnRight()) { | if ($v->getIsOnRight()) { | ||||
$left_side = $u; | $left_side = $u; | ||||
$right_side = $v; | $right_side = $v; | ||||
} else { | } else { | ||||
$left_side = $v; | $left_side = $v; | ||||
$right_side = $u; | $right_side = $u; | ||||
} | } | ||||
$left_hidden = null; | |||||
$right_hidden = null; | |||||
} | } | ||||
$left_attrs = array( | $left_attrs = array( | ||||
'class' => 'left', | 'class' => 'left', | ||||
'id' => ($left_side ? $left_side->getScaffoldCellID() : null), | 'id' => ($left_side ? $left_side->getScaffoldCellID() : null), | ||||
); | ); | ||||
$right_attrs = array( | $right_attrs = array( | ||||
'colspan' => 3, | 'colspan' => 3, | ||||
'class' => 'right3', | 'class' => 'right3', | ||||
'id' => ($right_side ? $right_side->getScaffoldCellID() : null), | 'id' => ($right_side ? $right_side->getScaffoldCellID() : null), | ||||
); | ); | ||||
$cells = array( | $cells = array( | ||||
phutil_tag('th', array()), | phutil_tag('th', array(), $left_hidden), | ||||
phutil_tag('td', $left_attrs, $left_side), | phutil_tag('td', $left_attrs, $left_side), | ||||
phutil_tag('th', array()), | phutil_tag('th', array(), $right_hidden), | ||||
phutil_tag('td', $right_attrs, $right_side), | phutil_tag('td', $right_attrs, $right_side), | ||||
); | ); | ||||
return javelin_tag('tr', $this->getRowAttributes(), $cells); | return javelin_tag('tr', $this->getRowAttributes(), $cells); | ||||
} | } | ||||
} | } |