mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-25 05:58:21 +01:00
195def15b0
Summary: Ref T5482. Instead of editing icons and details seaparetly, use a bunch of Javascript to pop a dialog instead. Test Plan: {F170528} Reviewers: chad Reviewed By: chad Subscribers: epriestley Maniphest Tasks: T5482 Differential Revision: https://secure.phabricator.com/D9743
96 lines
2 KiB
PHP
96 lines
2 KiB
PHP
<?php
|
|
|
|
final class AphrontFormChooseButtonControl extends AphrontFormControl {
|
|
|
|
private $displayValue;
|
|
private $buttonText;
|
|
private $chooseURI;
|
|
|
|
public function setDisplayValue($display_value) {
|
|
$this->displayValue = $display_value;
|
|
return $this;
|
|
}
|
|
|
|
public function getDisplayValue() {
|
|
return $this->displayValue;
|
|
}
|
|
|
|
public function setButtonText($text) {
|
|
$this->buttonText = $text;
|
|
return $this;
|
|
}
|
|
|
|
public function setChooseURI($choose_uri) {
|
|
$this->chooseURI = $choose_uri;
|
|
return $this;
|
|
}
|
|
|
|
protected function getCustomControlClass() {
|
|
return 'aphront-form-control-choose-button';
|
|
}
|
|
|
|
protected function renderInput() {
|
|
Javelin::initBehavior('choose-control');
|
|
|
|
$input_id = celerity_generate_unique_node_id();
|
|
$display_id = celerity_generate_unique_node_id();
|
|
|
|
$display_value = $this->displayValue;
|
|
$button = javelin_tag(
|
|
'a',
|
|
array(
|
|
'href' => '#',
|
|
'class' => 'button grey',
|
|
'sigil' => 'aphront-form-choose-button',
|
|
),
|
|
nonempty($this->buttonText, pht('Choose...')));
|
|
|
|
$display_cell = phutil_tag(
|
|
'td',
|
|
array(
|
|
'class' => 'aphront-form-choose-display-cell',
|
|
'id' => $display_id,
|
|
),
|
|
$display_value);
|
|
|
|
$button_cell = phutil_tag(
|
|
'td',
|
|
array(
|
|
'class' => 'aphront-form-choose-button-cell',
|
|
),
|
|
$button);
|
|
|
|
$row = phutil_tag(
|
|
'tr',
|
|
array(),
|
|
array($display_cell, $button_cell));
|
|
|
|
$layout = javelin_tag(
|
|
'table',
|
|
array(
|
|
'class' => 'aphront-form-choose-table',
|
|
'sigil' => 'aphront-form-choose',
|
|
'meta' => array(
|
|
'uri' => $this->chooseURI,
|
|
'inputID' => $input_id,
|
|
'displayID' => $display_id,
|
|
),
|
|
),
|
|
$row);
|
|
|
|
$hidden_input = phutil_tag(
|
|
'input',
|
|
array(
|
|
'type' => 'hidden',
|
|
'name' => $this->getName(),
|
|
'value' => $this->getValue(),
|
|
'id' => $input_id,
|
|
));
|
|
|
|
return array(
|
|
$hidden_input,
|
|
$layout,
|
|
);
|
|
}
|
|
|
|
}
|