Skip to content

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

Merged
merged 3 commits into from
Dec 21, 2016

Conversation

jeff-phillips-18
Copy link
Member

No description provided.

@jeff-phillips-18
Copy link
Member Author

@dtaylor113
Copy link
Member

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.

@jeff-phillips-18
Copy link
Member Author

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.

@waldenraines
Copy link

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 .form-horizontal markup?

@jeff-phillips-18
Copy link
Member Author

Sorry, what is abnormal about form-horizontal?

@waldenraines
Copy link

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.

@jeff-phillips-18
Copy link
Member Author

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.

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.
@waldenraines
Copy link

waldenraines commented Dec 20, 2016

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.

Exactly. This was originally copy/pasted from Katello where we were using horizontal and never updated to be more flexible.

Copy link
Member

@dgutride dgutride left a 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
*
Copy link
Member

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;
Copy link
Member

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) {
Copy link
Member

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

@jeff-phillips-18
Copy link
Member Author

@dgutride Remaining characters count is not a component. Not sure how we would convert it.

@jeff-phillips-18
Copy link
Member Author

@dgutride Updated per your comments.

Copy link
Member

@dlabrecq dlabrecq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dgutride dgutride merged commit 629ecea into patternfly:branch-4.0-dev Dec 21, 2016
</pf-form-group>
</form>
<p>Horizontal Form</p>
<form class="form-horizontal">

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>

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)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the example code. It shows both normal and horizontal forms:

image

@waldenraines
Copy link

Ah, missed the boat. I thought we were going to change the form groups to not be .form-horizontal centric?

@jeff-phillips-18
Copy link
Member Author

The are no longer .form-horizontal centric.

@waldenraines
Copy link

The are no longer .form-horizontal centric.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants