-
Notifications
You must be signed in to change notification settings - Fork 90
Convert patternfly.form module directives to components. #375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert patternfly.form module directives to components. #375
Conversation
LGTM. Whjy are things moved into 'src/form/examples/', directives in 'examples' seem to be core directives (form-buttons, form-group, remain char count.), not examples. |
Only the ng-doc examples where moved there. I think this makes it easier to read the real component code and not have to look past all the ng-doc stuff. |
I know that you didn't write this originally but what are your thoughts on changing the form components to use normal BS3 form markup instead of |
Sorry, what is abnormal about form-horizontal? |
It's not that there is anything abnormal about it but I think the default should be the normal form and if we want a horizontal form we should have a different directive or different option for that. |
Probably a better way to go. Currently we default classes for the label and input components which really force the form-horizontal use. If we don't do that, the application could use either but will have to set the pfLabelClass and pfInputClass to use horizontal. |
880e312
to
be38c16
Compare
Remove the default classes added to the label and input fields. This allows usage in any type of bootstrap form. Applications can simply add the classes via the pfLabelClass and pfInputClass bindings to use in a horizontal form. Added examples of both use cases.
be38c16
to
2717b76
Compare
Exactly. This was originally copy/pasted from Katello where we were using horizontal and never updated to be more flexible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good - will remaining chars count be converted as well?
/** | ||
* @ngdoc directive | ||
* @name patternfly.form.directive:pfFormGroup | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
restrict E should be in the header
var ctrl = this; | ||
|
||
if (ctrl.pfWorking === undefined) { | ||
ctrl.pfWorking = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally any initialization code should be moved to $onInit
transclude: true, | ||
templateUrl: 'form/form-group/form-group.html', | ||
|
||
controller: function ($scope, $element) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$scope should be removed from the function
@dgutride Remaining characters count is not a component. Not sure how we would convert it. |
@dgutride Updated per your comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
</pf-form-group> | ||
</form> | ||
<p>Horizontal Form</p> | ||
<form class="form-horizontal"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be updated to reflect the discussed changes to pf-form-group
(i.e. to remove the horizontal form specific classes)?
<label for="{{ pfField }}" class="control-label {{ pfLabelClass }}">{{ pfLabel }}</label> | ||
<div class="{{ pfInputClass }}"> | ||
<div class="form-group" ng-class="{ 'has-error' : $ctrl.hasErrors() }"> | ||
<label for="{{ $ctrl.pfField }}" class="control-label {{ $ctrl.pfLabelClass }}">{{ $ctrl.pfLabel }}</label> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be updated to reflect the discussed changes to pf-form-group
(i.e. to remove the horizontal form specific classes)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, missed the boat. I thought we were going to change the form groups to not be |
The are no longer .form-horizontal centric. |
👍 |
No description provided.