mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 01:02:42 +01:00
Inset view controller for inset elements of forms.
Summary: T937 suggests 'inset' could have its own view controller. It has the following methods: - setTitle for title - setRightbutton if you have to place something (preferably a button) on the right side of the form - setDescription if you want to describe what it does - setContent for the main content - addDivAttributes REALLY not sure about this one but it had to be included because of a single controller (see owners/controller/edit/PhabricatorOwnersEditController.php:238) - appendChild works as usual if your form is complex but you still want to remove ->appendChild('<div class..') ->appendChild('</div>'); It might be an overkill so maybe some could be dropped: - addDivAttributes() and just rewrite how PhabricatorOwnersEditController.php works - setContent() and use appendChild for the main content? Test Plan: - Looked at the controllers in phabricator - Changed the controller - Opened the page in another tab - If something didnd't look the same I fixed it. Reviewers: epriestley Reviewed By: epriestley CC: aran, epriestley Differential Revision: https://secure.phabricator.com/D1926
This commit is contained in:
parent
7c67b5e600
commit
fffc1e51d0
13 changed files with 243 additions and 123 deletions
|
@ -34,6 +34,7 @@ phutil_register_library_map(array(
|
|||
'AphrontFormDividerControl' => 'view/form/control/divider',
|
||||
'AphrontFormDragAndDropUploadControl' => 'view/form/control/draganddropupload',
|
||||
'AphrontFormFileControl' => 'view/form/control/file',
|
||||
'AphrontFormInsetView' => 'view/form/inset',
|
||||
'AphrontFormLayoutView' => 'view/form/layout',
|
||||
'AphrontFormMarkupControl' => 'view/form/control/markup',
|
||||
'AphrontFormPasswordControl' => 'view/form/control/password',
|
||||
|
@ -935,6 +936,7 @@ phutil_register_library_map(array(
|
|||
'AphrontFormDividerControl' => 'AphrontFormControl',
|
||||
'AphrontFormDragAndDropUploadControl' => 'AphrontFormControl',
|
||||
'AphrontFormFileControl' => 'AphrontFormControl',
|
||||
'AphrontFormInsetView' => 'AphrontView',
|
||||
'AphrontFormLayoutView' => 'AphrontView',
|
||||
'AphrontFormMarkupControl' => 'AphrontFormControl',
|
||||
'AphrontFormPasswordControl' => 'AphrontFormControl',
|
||||
|
|
|
@ -165,34 +165,31 @@ final class HeraldRuleController extends HeraldController {
|
|||
"This <strong>${rule_type_name}</strong> rule triggers for " .
|
||||
"<strong>${content_type_name}</strong>."))
|
||||
->appendChild(
|
||||
'<h1>Conditions</h1>'.
|
||||
'<div class="aphront-form-inset">'.
|
||||
'<div style="float: right;">'.
|
||||
javelin_render_tag(
|
||||
id(new AphrontFormInsetView())
|
||||
->setTitle('Conditions')
|
||||
->setRightButton(javelin_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '#',
|
||||
'class' => 'button green',
|
||||
'sigil' => 'create-condition',
|
||||
'mustcapture' => true,
|
||||
'mustcapture' => true
|
||||
),
|
||||
'Create New Condition').
|
||||
'</div>'.
|
||||
'<p>When '.$must_match_selector.' these conditions are met:</p>'.
|
||||
'<div style="clear: both;"></div>'.
|
||||
javelin_render_tag(
|
||||
'Create New Condition'))
|
||||
->setDescription(
|
||||
'When '.$must_match_selector .
|
||||
' these conditions are met:')
|
||||
->setContent(javelin_render_tag(
|
||||
'table',
|
||||
array(
|
||||
'sigil' => 'rule-conditions',
|
||||
'class' => 'herald-condition-table',
|
||||
'class' => 'herald-condition-table'
|
||||
),
|
||||
'').
|
||||
'</div>')
|
||||
'')))
|
||||
->appendChild(
|
||||
'<h1>Action</h1>'.
|
||||
'<div class="aphront-form-inset">'.
|
||||
'<div style="float: right;">'.
|
||||
javelin_render_tag(
|
||||
id(new AphrontFormInsetView())
|
||||
->setTitle('Action')
|
||||
->setRightButton(javelin_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '#',
|
||||
|
@ -200,20 +197,16 @@ final class HeraldRuleController extends HeraldController {
|
|||
'sigil' => 'create-action',
|
||||
'mustcapture' => true,
|
||||
),
|
||||
'Create New Action').
|
||||
'</div>'.
|
||||
'<p>'.
|
||||
'Take these actions '.$repetition_selector.' this rule matches:'.
|
||||
'</p>'.
|
||||
'<div style="clear: both;"></div>'.
|
||||
javelin_render_tag(
|
||||
'Create New Action'))
|
||||
->setDescription('Take these actions '.$repetition_selector.
|
||||
' this rule matches:')
|
||||
->setContent(javelin_render_tag(
|
||||
'table',
|
||||
array(
|
||||
'sigil' => 'rule-actions',
|
||||
'class' => 'herald-action-table',
|
||||
),
|
||||
'').
|
||||
'</div>')
|
||||
'')))
|
||||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
->setValue('Save Rule')
|
||||
|
|
|
@ -28,6 +28,7 @@ phutil_require_module('phabricator', 'view/form/control/markup');
|
|||
phutil_require_module('phabricator', 'view/form/control/submit');
|
||||
phutil_require_module('phabricator', 'view/form/control/text');
|
||||
phutil_require_module('phabricator', 'view/form/error');
|
||||
phutil_require_module('phabricator', 'view/form/inset');
|
||||
phutil_require_module('phabricator', 'view/layout/panel');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
|
|
|
@ -104,10 +104,9 @@ final class ManiphestBatchEditController extends ManiphestController {
|
|||
$form->appendChild('<p>These tasks will be edited:</p>');
|
||||
$form->appendChild($list);
|
||||
$form->appendChild(
|
||||
'<h1>Actions</h1>'.
|
||||
'<div class="aphront-form-inset">'.
|
||||
'<div style="float: right;">'.
|
||||
javelin_render_tag(
|
||||
id(new AphrontFormInsetView())
|
||||
->setTitle('Actions')
|
||||
->setRightButton(javelin_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '#',
|
||||
|
@ -115,17 +114,14 @@ final class ManiphestBatchEditController extends ManiphestController {
|
|||
'sigil' => 'add-action',
|
||||
'mustcapture' => true,
|
||||
),
|
||||
'Add Another Action').
|
||||
'</div>'.
|
||||
'<div style="clear: both;"></div>'.
|
||||
javelin_render_tag(
|
||||
'Add Another Action'))
|
||||
->setContent(javelin_render_tag(
|
||||
'table',
|
||||
array(
|
||||
'sigil' => 'maniphest-batch-actions',
|
||||
'class' => 'maniphest-batch-actions-table',
|
||||
),
|
||||
'').
|
||||
'</div>')
|
||||
'')))
|
||||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
->setValue('Update Tasks')
|
||||
|
|
|
@ -20,6 +20,7 @@ phutil_require_module('phabricator', 'infrastructure/javelin/markup');
|
|||
phutil_require_module('phabricator', 'view/control/tokenizer');
|
||||
phutil_require_module('phabricator', 'view/form/base');
|
||||
phutil_require_module('phabricator', 'view/form/control/submit');
|
||||
phutil_require_module('phabricator', 'view/form/inset');
|
||||
phutil_require_module('phabricator', 'view/layout/panel');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
|
|
|
@ -233,10 +233,10 @@ final class PhabricatorOwnersEditController
|
|||
? 'enabled'
|
||||
: 'disabled'))
|
||||
->appendChild(
|
||||
'<h1>Paths</h1>'.
|
||||
'<div class="aphront-form-inset" id="path-editor">'.
|
||||
'<div style="float: right;">'.
|
||||
javelin_render_tag(
|
||||
id(new AphrontFormInsetView())
|
||||
->setTitle('Paths')
|
||||
->addDivAttributes(array('id' => 'path-editor'))
|
||||
->setRightButton(javelin_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '#',
|
||||
|
@ -244,19 +244,16 @@ final class PhabricatorOwnersEditController
|
|||
'sigil' => 'addpath',
|
||||
'mustcapture' => true,
|
||||
),
|
||||
'Add New Path').
|
||||
'</div>'.
|
||||
'<p>Specify the files and directories which comprise this '.
|
||||
'package.</p>'.
|
||||
'<div style="clear: both;"></div>'.
|
||||
javelin_render_tag(
|
||||
'Add New Path'))
|
||||
->setDescription('Specify the files and directories which comprise '.
|
||||
'this package.')
|
||||
->setContent(javelin_render_tag(
|
||||
'table',
|
||||
array(
|
||||
'class' => 'owners-path-editor-table',
|
||||
'sigil' => 'paths',
|
||||
),
|
||||
'').
|
||||
'</div>')
|
||||
'')))
|
||||
->appendChild(
|
||||
id(new AphrontFormTextAreaControl())
|
||||
->setLabel('Description')
|
||||
|
|
|
@ -23,6 +23,7 @@ phutil_require_module('phabricator', 'view/form/control/text');
|
|||
phutil_require_module('phabricator', 'view/form/control/textarea');
|
||||
phutil_require_module('phabricator', 'view/form/control/tokenizer');
|
||||
phutil_require_module('phabricator', 'view/form/error');
|
||||
phutil_require_module('phabricator', 'view/form/inset');
|
||||
phutil_require_module('phabricator', 'view/layout/panel');
|
||||
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
|
|
@ -258,11 +258,9 @@ final class PhabricatorProjectProfileEditController
|
|||
->setError($e_image)
|
||||
->setCaption('Supported formats: '.implode(', ', $supported_formats)))
|
||||
->appendChild(
|
||||
'<h1>Resources</h1>'.
|
||||
'<input type="hidden" name="resources" id="resources" />'.
|
||||
'<div class="aphront-form-inset">'.
|
||||
'<div style="float: right;">'.
|
||||
javelin_render_tag(
|
||||
id(new AphrontFormInsetView())
|
||||
->setTitle('Resources')
|
||||
->setRightButton(javelin_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '#',
|
||||
|
@ -270,18 +268,15 @@ final class PhabricatorProjectProfileEditController
|
|||
'sigil' => 'add-resource',
|
||||
'mustcapture' => true,
|
||||
),
|
||||
'Add New Resource').
|
||||
'</div>'.
|
||||
'<p></p>'.
|
||||
'<div style="clear: both;"></div>'.
|
||||
javelin_render_tag(
|
||||
'Add New Resource'))
|
||||
->addHiddenInput('resources', 'resources')
|
||||
->setContent(javelin_render_tag(
|
||||
'table',
|
||||
array(
|
||||
'sigil' => 'resources',
|
||||
'class' => 'project-resource-table',
|
||||
),
|
||||
'').
|
||||
'</div>')
|
||||
'')))
|
||||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
->addCancelButton('/project/view/'.$project->getID().'/')
|
||||
|
|
|
@ -31,6 +31,7 @@ phutil_require_module('phabricator', 'view/form/control/text');
|
|||
phutil_require_module('phabricator', 'view/form/control/textarea');
|
||||
phutil_require_module('phabricator', 'view/form/control/tokenizer');
|
||||
phutil_require_module('phabricator', 'view/form/error');
|
||||
phutil_require_module('phabricator', 'view/form/inset');
|
||||
phutil_require_module('phabricator', 'view/layout/panel');
|
||||
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
|
|
@ -389,13 +389,12 @@ final class PhabricatorRepositoryEditController
|
|||
|
||||
$form
|
||||
->appendChild(
|
||||
'<h1>Basics</h1><div class="aphront-form-inset">')
|
||||
->appendChild(
|
||||
id(new AphrontFormStaticControl())
|
||||
id(new AphrontFormInsetView())
|
||||
->setTitle('Basics')
|
||||
->appendChild(id(new AphrontFormStaticControl())
|
||||
->setLabel('Repository Name')
|
||||
->setValue($repository->getName()))
|
||||
->appendChild(
|
||||
id(new AphrontFormSelectControl())
|
||||
->appendChild(id(new AphrontFormSelectControl())
|
||||
->setName('tracking')
|
||||
->setLabel('Tracking')
|
||||
->setOptions(array(
|
||||
|
@ -405,12 +404,10 @@ final class PhabricatorRepositoryEditController
|
|||
->setValue(
|
||||
$repository->isTracked()
|
||||
? 'enabled'
|
||||
: 'disabled'))
|
||||
->appendChild('</div>');
|
||||
: 'disabled')));
|
||||
|
||||
$form->appendChild(
|
||||
'<h1>Remote URI</h1>'.
|
||||
'<div class="aphront-form-inset">');
|
||||
$inset = new AphrontFormInsetView();
|
||||
$inset->setTitle('Remote URI');
|
||||
|
||||
$clone_command = null;
|
||||
$fetch_command = null;
|
||||
|
@ -435,7 +432,7 @@ final class PhabricatorRepositoryEditController
|
|||
'Enter the URI to clone this repository from. It should look '.
|
||||
'something like <tt>ssh://user@host.com/hg/example</tt>';
|
||||
}
|
||||
$form->appendChild(
|
||||
$inset->appendChild(
|
||||
'<p class="aphront-form-instructions">'.$instructions.'</p>');
|
||||
} else if ($is_svn) {
|
||||
$instructions =
|
||||
|
@ -444,12 +441,12 @@ final class PhabricatorRepositoryEditController
|
|||
'the value in the <tt>Repository Root</tt> field. It should be a URI '.
|
||||
'and look like <tt>http://svn.example.org/svn/</tt> or '.
|
||||
'<tt>svn+ssh://svn.example.com/svnroot/</tt>';
|
||||
$form->appendChild(
|
||||
$inset->appendChild(
|
||||
'<p class="aphront-form-instructions">'.$instructions.'</p>');
|
||||
$uri_label = 'Repository Root';
|
||||
}
|
||||
|
||||
$form
|
||||
$inset
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setName('uri')
|
||||
|
@ -458,14 +455,14 @@ final class PhabricatorRepositoryEditController
|
|||
->setValue($repository->getDetail('remote-uri'))
|
||||
->setError($e_uri));
|
||||
|
||||
$form->appendChild(
|
||||
$inset->appendChild(
|
||||
'<div class="aphront-form-instructions">'.
|
||||
'If you want to connect to this repository over SSH, enter the '.
|
||||
'username and private key to use. You can leave these fields blank if '.
|
||||
'the repository does not use SSH.'.
|
||||
'</div>');
|
||||
|
||||
$form
|
||||
$inset
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setName('ssh-login')
|
||||
|
@ -490,7 +487,7 @@ final class PhabricatorRepositoryEditController
|
|||
'look for a private key.'));
|
||||
|
||||
if ($has_http_support) {
|
||||
$form
|
||||
$inset
|
||||
->appendChild(
|
||||
'<div class="aphront-form-instructions">'.
|
||||
'If you want to connect to this repository over HTTP Basic Auth, '.
|
||||
|
@ -509,7 +506,7 @@ final class PhabricatorRepositoryEditController
|
|||
->setValue($repository->getDetail('http-pass')));
|
||||
}
|
||||
|
||||
$form
|
||||
$inset
|
||||
->appendChild(
|
||||
'<div class="aphront-form-important">'.
|
||||
'To test your authentication configuration, <strong>save this '.
|
||||
|
@ -523,33 +520,32 @@ final class PhabricatorRepositoryEditController
|
|||
'from it.'.
|
||||
'</div>');
|
||||
|
||||
$form->appendChild('</div>');
|
||||
$form->appendChild($inset);
|
||||
|
||||
$form->appendChild(
|
||||
'<h1>Importing Repository Information</h1>'.
|
||||
'<div class="aphront-form-inset">');
|
||||
$inset = new AphrontFormInsetView();
|
||||
$inset->setTitle('Repository Information');
|
||||
|
||||
if ($has_local) {
|
||||
$form->appendChild(
|
||||
$inset->appendChild(
|
||||
'<p class="aphront-form-instructions">Select a path on local disk '.
|
||||
'which the daemons should <tt>'.$clone_command.'</tt> the repository '.
|
||||
'into. This must be readable and writable by the daemons, and '.
|
||||
'readable by the webserver. The daemons will <tt>'.$fetch_command.
|
||||
'</tt> and keep this repository up to date.</p>');
|
||||
$form->appendChild(
|
||||
$inset->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setName('path')
|
||||
->setLabel('Local Path')
|
||||
->setValue($repository->getDetail('local-path'))
|
||||
->setError($e_path));
|
||||
} else if ($is_svn) {
|
||||
$form->appendChild(
|
||||
$inset->appendChild(
|
||||
'<p class="aphront-form-instructions">If you only want to parse one '.
|
||||
'subpath of the repository, specify it here, relative to the '.
|
||||
'repository root (e.g., <tt>trunk/</tt> or <tt>projects/wheel/</tt>). '.
|
||||
'If you want to parse multiple subdirectories, create a separate '.
|
||||
'Phabricator repository for each one.</p>');
|
||||
$form->appendChild(
|
||||
$inset->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setName('svn-subpath')
|
||||
->setLabel('Subpath')
|
||||
|
@ -561,7 +557,7 @@ final class PhabricatorRepositoryEditController
|
|||
$branch_filter_str = implode(
|
||||
', ',
|
||||
array_keys($repository->getDetail('branch-filter', array())));
|
||||
$form
|
||||
$inset
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setName('branch-filter')
|
||||
|
@ -573,7 +569,7 @@ final class PhabricatorRepositoryEditController
|
|||
'Example: <tt>master, release</tt>'));
|
||||
}
|
||||
|
||||
$form
|
||||
$inset
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setName('frequency')
|
||||
|
@ -583,11 +579,10 @@ final class PhabricatorRepositoryEditController
|
|||
'Number of seconds daemon should sleep between requests. Larger '.
|
||||
'numbers reduce load but also decrease responsiveness.'));
|
||||
|
||||
$form->appendChild('</div>');
|
||||
$form->appendChild($inset);
|
||||
|
||||
$form->appendChild(
|
||||
'<h1>Application Configuration</h1>'.
|
||||
'<div class="aphront-form-inset">');
|
||||
$inset = new AphrontFormInsetView();
|
||||
$inset->setTitle('Application Configuration');
|
||||
|
||||
if ($has_branches) {
|
||||
|
||||
|
@ -598,7 +593,7 @@ final class PhabricatorRepositoryEditController
|
|||
$default_branch_name = 'master';
|
||||
}
|
||||
|
||||
$form
|
||||
$inset
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setName('default-branch')
|
||||
|
@ -612,7 +607,7 @@ final class PhabricatorRepositoryEditController
|
|||
'Default branch to show in Diffusion.'));
|
||||
}
|
||||
|
||||
$form
|
||||
$inset
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setName('default-owners-path')
|
||||
|
@ -623,7 +618,7 @@ final class PhabricatorRepositoryEditController
|
|||
'/'))
|
||||
->setCaption('Default path in Owners tool.'));
|
||||
|
||||
$form
|
||||
$inset
|
||||
->appendChild(
|
||||
id(new AphrontFormSelectControl())
|
||||
->setName('herald-disabled')
|
||||
|
@ -643,7 +638,7 @@ final class PhabricatorRepositoryEditController
|
|||
->selectSymbolsWithoutLoading();
|
||||
$parsers = ipull($parsers, 'name', 'name');
|
||||
|
||||
$form
|
||||
$inset
|
||||
->appendChild(
|
||||
'<p class="aphront-form-instructions">If you extend the commit '.
|
||||
'message format, you can provide a new parser which will extract '.
|
||||
|
@ -661,7 +656,7 @@ final class PhabricatorRepositoryEditController
|
|||
'PhabricatorRepositoryDefaultCommitMessageDetailParser')));
|
||||
|
||||
if ($is_svn) {
|
||||
$form
|
||||
$inset
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setName('uuid')
|
||||
|
@ -670,7 +665,7 @@ final class PhabricatorRepositoryEditController
|
|||
->setCaption('Repository UUID from <tt>svn info</tt>.'));
|
||||
}
|
||||
|
||||
$form->appendChild('</div>');
|
||||
$form->appendChild($inset);
|
||||
|
||||
$form
|
||||
->appendChild(
|
||||
|
|
|
@ -20,6 +20,7 @@ phutil_require_module('phabricator', 'view/form/control/submit');
|
|||
phutil_require_module('phabricator', 'view/form/control/text');
|
||||
phutil_require_module('phabricator', 'view/form/control/textarea');
|
||||
phutil_require_module('phabricator', 'view/form/error');
|
||||
phutil_require_module('phabricator', 'view/form/inset');
|
||||
phutil_require_module('phabricator', 'view/layout/panel');
|
||||
phutil_require_module('phabricator', 'view/layout/sidenav');
|
||||
|
||||
|
|
123
src/view/form/inset/AphrontFormInsetView.php
Normal file
123
src/view/form/inset/AphrontFormInsetView.php
Normal file
|
@ -0,0 +1,123 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
final class AphrontFormInsetView extends AphrontView {
|
||||
|
||||
private $title;
|
||||
private $description;
|
||||
private $rightButton;
|
||||
private $content;
|
||||
private $hidden = array();
|
||||
|
||||
private $divAttributes;
|
||||
|
||||
public function setTitle($title) {
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setDescription($description) {
|
||||
$this->description = $description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setRightButton($button) {
|
||||
$this->rightButton = $button;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setContent($content) {
|
||||
$this->content = $content;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addHiddenInput($key, $value) {
|
||||
if (is_array($value)) {
|
||||
foreach ($value as $hidden_key => $hidden_value) {
|
||||
$this->hidden[] = array($key.'['.$hidden_key.']', $hidden_value);
|
||||
}
|
||||
} else {
|
||||
$this->hidden[] = array($key, $value);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addDivAttributes(array $attributes) {
|
||||
$this->divAttributes = $attributes;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function render() {
|
||||
|
||||
$title = $hidden_inputs = $right_button = $desc = $content = '';
|
||||
|
||||
if ($this->title) {
|
||||
$title = '<h1>'.phutil_escape_html($this->title).'</h1>';
|
||||
}
|
||||
|
||||
$hidden_inputs = array();
|
||||
foreach ($this->hidden as $inp) {
|
||||
list($key, $value) = $inp;
|
||||
$hidden_inputs[] = phutil_render_tag(
|
||||
'input',
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => $key,
|
||||
'value' => $value,
|
||||
));
|
||||
}
|
||||
$hidden_inputs = implode("\n", $hidden_inputs);
|
||||
|
||||
if ($this->rightButton) {
|
||||
$right_button = phutil_render_tag(
|
||||
'div',
|
||||
array(
|
||||
'style' => 'float: right;',
|
||||
),
|
||||
$this->rightButton);
|
||||
}
|
||||
|
||||
if ($this->description) {
|
||||
$desc = phutil_render_tag(
|
||||
'p',
|
||||
array(),
|
||||
$this->description);
|
||||
|
||||
if ($right_button) {
|
||||
$desc .= '<div style="clear: both;"></div>';
|
||||
}
|
||||
}
|
||||
|
||||
$div_attributes = $this->divAttributes;
|
||||
$classes = array('aphront-form-inset');
|
||||
if (isset($div_attributes['class'])) {
|
||||
$classes[] = $div_attributes['class'];
|
||||
}
|
||||
|
||||
$div_attributes['class'] = implode(' ', $classes);
|
||||
|
||||
if ($this->content) {
|
||||
$content = $this->content;
|
||||
}
|
||||
|
||||
return $title.phutil_render_tag(
|
||||
'div',
|
||||
$div_attributes,
|
||||
$hidden_inputs.$right_button.$desc.$content.$this->renderChildren());
|
||||
}
|
||||
}
|
14
src/view/form/inset/__init__.php
Normal file
14
src/view/form/inset/__init__.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'view/base');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
|
||||
|
||||
phutil_require_source('AphrontFormInsetView.php');
|
Loading…
Reference in a new issue