Skip to content
This repository has been archived by the owner on Apr 30, 2018. It is now read-only.

custom field class #398

Closed
Evanion opened this issue Jul 24, 2015 · 6 comments
Closed

custom field class #398

Evanion opened this issue Jul 24, 2015 · 6 comments

Comments

@Evanion
Copy link

Evanion commented Jul 24, 2015

I'm working on a uikit module for angular-formly, but I have 2 issues:

  • The field repeat class is hard coded, I would like a way to add a custom class to the 'formly-field' directive.
  • Similarly I would like a way to add a custom class to the ngTransclude that wraps the transcluded content from the page template.

This is somewhat related to #276.

@kentcdodds
Copy link
Member

You can add a class to the formly-field element via the className property. I could add the ability to have a custom class to the ngTransclude element. That would be quite simple to implement actually if you're interested in making a PR. You'd basically do the same thing here as is done in several other places (like here). The test would look similar to this one. Should be pretty simple.

@kentcdodds
Copy link
Member

Also, if you like, I can create a shell repo under the fromly-js organization for you to fill out with the library. Or you can just develop it under your own account. Whatever you like :-)

@Evanion
Copy link
Author

Evanion commented Jul 27, 2015

Right now I'm working on this repo: https://github.com/Evanion/angular-formly-templates-uikit
Once I get it to a beta stage we can migrate it to an official repo.
I will take a look at making a PR.

@kentcdodds
Copy link
Member

@Evanion, do you mind holding off on that PR? I'd like to reserve this one for a new-comer as I've done in the past #343 #358.

kentcdodds pushed a commit that referenced this issue Jul 27, 2015
@kentcdodds
Copy link
Member

Like with #343 and #358, I've created tests for this feature and I'm going to give someone a shot at contributing to open source for the first time :-) So I will only accept a PR from someone who's never contributed to open source before.

Instructions:

  • Watch this video to learn what you need to do to get things setup
  • Go to these tests and change describe.skip to describe.only
  • Run $ npm test
  • Notice that some of the tests are failing
  • Update the formlyFormGetTemplate function to add the class if it's specified on the attrs. I recommend doing pretty much the same thing that's done for the form name except your function should look more like this.
  • Once the tests are passing, change the describe.onlys to describe so all the tests run.
  • Commit your changes to the src/ directory mentioning issue Add a hook to transform field config before forms are compiled #343 (note it may take a second... it runs all the tests...)
  • Push your changes to your fork, create a PR, get merged, celebrate 🎉

I'm happy to hold your hand through this if you need help. Catch me on gitter.

DevanB pushed a commit to DevanB/angular-formly that referenced this issue Jul 27, 2015
DevanB pushed a commit to DevanB/angular-formly that referenced this issue Jul 27, 2015
Corrected commit message. Added ability to add custom class to ngTransclude. Fixes formly-js#398.

Added ability to add custom class to ngTransclude. Fixes formly-js#343.
kentcdodds pushed a commit that referenced this issue Jul 27, 2015
Added ability to add custom class to ngTransclude. Fixes #398.
@kentcdodds
Copy link
Member

This has been released in the official 6.21.0 release.

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

No branches or pull requests

2 participants