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:
committed by
epriestley
parent
7c67b5e600
commit
fffc1e51d0
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user