mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-18 21:02:41 +01:00
Add smarter UI for form errors
Summary: Just makes the UI cleaner on full width or dialog forms (and mobile) Test Plan: run into a bunch of errors, test mobile breakpoints. {F281585} Reviewers: btrahan, epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D11638
This commit is contained in:
parent
ad1ea033e7
commit
70cddaae32
3 changed files with 36 additions and 24 deletions
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
return array(
|
return array(
|
||||||
'names' => array(
|
'names' => array(
|
||||||
'core.pkg.css' => 'fabafbdb',
|
'core.pkg.css' => '8be366b7',
|
||||||
'core.pkg.js' => '65e04767',
|
'core.pkg.js' => '65e04767',
|
||||||
'darkconsole.pkg.js' => '8ab24e01',
|
'darkconsole.pkg.js' => '8ab24e01',
|
||||||
'differential.pkg.css' => '8af45893',
|
'differential.pkg.css' => '8af45893',
|
||||||
|
@ -129,7 +129,7 @@ return array(
|
||||||
'rsrc/css/phui/phui-error-view.css' => 'ad042fdd',
|
'rsrc/css/phui/phui-error-view.css' => 'ad042fdd',
|
||||||
'rsrc/css/phui/phui-feed-story.css' => 'c9f3a0b5',
|
'rsrc/css/phui/phui-feed-story.css' => 'c9f3a0b5',
|
||||||
'rsrc/css/phui/phui-fontkit.css' => '9ae12677',
|
'rsrc/css/phui/phui-fontkit.css' => '9ae12677',
|
||||||
'rsrc/css/phui/phui-form-view.css' => 'aad06f2a',
|
'rsrc/css/phui/phui-form-view.css' => '8b78a986',
|
||||||
'rsrc/css/phui/phui-form.css' => '9aecbda1',
|
'rsrc/css/phui/phui-form.css' => '9aecbda1',
|
||||||
'rsrc/css/phui/phui-header-view.css' => '083669db',
|
'rsrc/css/phui/phui-header-view.css' => '083669db',
|
||||||
'rsrc/css/phui/phui-icon.css' => 'd35aa857',
|
'rsrc/css/phui/phui-icon.css' => 'd35aa857',
|
||||||
|
@ -778,7 +778,7 @@ return array(
|
||||||
'phui-font-icon-base-css' => '3dad2ae3',
|
'phui-font-icon-base-css' => '3dad2ae3',
|
||||||
'phui-fontkit-css' => '9ae12677',
|
'phui-fontkit-css' => '9ae12677',
|
||||||
'phui-form-css' => '9aecbda1',
|
'phui-form-css' => '9aecbda1',
|
||||||
'phui-form-view-css' => 'aad06f2a',
|
'phui-form-view-css' => '8b78a986',
|
||||||
'phui-header-view-css' => '083669db',
|
'phui-header-view-css' => '083669db',
|
||||||
'phui-icon-view-css' => 'd35aa857',
|
'phui-icon-view-css' => 'd35aa857',
|
||||||
'phui-image-mask-css' => '5a8b09c8',
|
'phui-image-mask-css' => '5a8b09c8',
|
||||||
|
|
|
@ -181,6 +181,22 @@ abstract class AphrontFormControl extends AphrontView {
|
||||||
array('class' => 'aphront-form-input'),
|
array('class' => 'aphront-form-input'),
|
||||||
$this->renderInput());
|
$this->renderInput());
|
||||||
|
|
||||||
|
$error = null;
|
||||||
|
if (strlen($this->getError())) {
|
||||||
|
$error = $this->getError();
|
||||||
|
if ($error === true) {
|
||||||
|
$error = phutil_tag(
|
||||||
|
'span',
|
||||||
|
array('class' => 'aphront-form-error aphront-form-required'),
|
||||||
|
pht('Required'));
|
||||||
|
} else {
|
||||||
|
$error = phutil_tag(
|
||||||
|
'span',
|
||||||
|
array('class' => 'aphront-form-error'),
|
||||||
|
$error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (strlen($this->getLabel())) {
|
if (strlen($this->getLabel())) {
|
||||||
$label = phutil_tag(
|
$label = phutil_tag(
|
||||||
'label',
|
'label',
|
||||||
|
@ -188,29 +204,14 @@ abstract class AphrontFormControl extends AphrontView {
|
||||||
'class' => 'aphront-form-label',
|
'class' => 'aphront-form-label',
|
||||||
'for' => $this->getID(),
|
'for' => $this->getID(),
|
||||||
),
|
),
|
||||||
$this->getLabel());
|
array(
|
||||||
|
$this->getLabel(),
|
||||||
|
$error,));
|
||||||
} else {
|
} else {
|
||||||
$label = null;
|
$label = null;
|
||||||
$custom_class .= ' aphront-form-control-nolabel';
|
$custom_class .= ' aphront-form-control-nolabel';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen($this->getError())) {
|
|
||||||
$error = $this->getError();
|
|
||||||
if ($error === true) {
|
|
||||||
$error = phutil_tag(
|
|
||||||
'div',
|
|
||||||
array('class' => 'aphront-form-error aphront-form-required'),
|
|
||||||
pht('Required'));
|
|
||||||
} else {
|
|
||||||
$error = phutil_tag(
|
|
||||||
'div',
|
|
||||||
array('class' => 'aphront-form-error'),
|
|
||||||
$error);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$error = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strlen($this->getCaption())) {
|
if (strlen($this->getCaption())) {
|
||||||
$caption = phutil_tag(
|
$caption = phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
|
@ -222,6 +223,7 @@ abstract class AphrontFormControl extends AphrontView {
|
||||||
|
|
||||||
$classes = array();
|
$classes = array();
|
||||||
$classes[] = 'aphront-form-control';
|
$classes[] = 'aphront-form-control';
|
||||||
|
$classes[] = 'grouped';
|
||||||
$classes[] = $custom_class;
|
$classes[] = $custom_class;
|
||||||
|
|
||||||
$style = $this->controlStyle;
|
$style = $this->controlStyle;
|
||||||
|
@ -241,7 +243,6 @@ abstract class AphrontFormControl extends AphrontView {
|
||||||
$error,
|
$error,
|
||||||
$input,
|
$input,
|
||||||
$caption,
|
$caption,
|
||||||
phutil_tag('div', array('style' => 'clear: both;'), ''),
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,10 @@
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.aphront-form-label .aphront-form-error {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.aphront-dialog-body .phui-form-full-width {
|
.aphront-dialog-body .phui-form-full-width {
|
||||||
margin-top: -10px;
|
margin-top: -10px;
|
||||||
}
|
}
|
||||||
|
@ -81,8 +85,15 @@
|
||||||
|
|
||||||
.device-phone .aphront-form-error,
|
.device-phone .aphront-form-error,
|
||||||
.phui-form-full-width .aphront-form-error {
|
.phui-form-full-width .aphront-form-error {
|
||||||
float: none;
|
display: none;
|
||||||
width: 100%;
|
}
|
||||||
|
|
||||||
|
.device-phone .aphront-form-label .aphront-form-error,
|
||||||
|
.phui-form-full-width .aphront-form-label .aphront-form-error {
|
||||||
|
display: block;
|
||||||
|
float: right;
|
||||||
|
padding: 0;
|
||||||
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.device-phone .aphront-form-drag-and-drop-upload {
|
.device-phone .aphront-form-drag-and-drop-upload {
|
||||||
|
|
Loading…
Reference in a new issue