uttesh / ngletteravatar

directive for the letter avatar for the given string like gmail, first letter of the given data will be the avatar .
http://uttesh.github.io/ngletteravatar/
MIT License
136 stars 36 forks source link

Adding selection and number of characters to display #18

Closed akougblenou closed 8 years ago

akougblenou commented 8 years ago

Hi I think your directive is really helpful. However, I had some requirements in terms of how it would behave for example I wanted different display for different naming type:

'uttesh Ranjit' ==> UR
'Aidan Vandier Sat' ==> AV
'Gael Magma Do Borneo' ==> GM
'Adrian Di Bisumbio' ==> AB
"Antoine" ==> AN
"Antoine Kouroki" ==> AK
"Adrien Kou" ==> AK 

for that I built and tested the function in the following pull request The code might not be the most efficient but it does the job, if you are okay with it I was wondering if it could be added to your directive?

sudhindrapc commented 8 years ago

Thanks @AKFourSeven for the update, just a small correction is needed in the code add this value in params object multiWord : attrs.multiword

and your html will accept an extra attribute for multiword which will look like this

<ng-letter-avatar data="C" height="70" width="70" shape="round" avatarborder="true" multiWord="true"></ng-letter-avatar>

@uttesh great job dude.

uttesh commented 8 years ago

@AKFourSeven thanks for the PR man, need to check with other changes i'm doing on this plugin, planing to add this feature in the new/existing, working on revamp of the plugin with code clean up.

akougblenou commented 8 years ago

@sudhindrapc @uttesh thanks for both of your feedback. I have updated the code with multiWord missing. Lemme know how this goes, I would be happy to have an update of this directive with this feature out of the box!

uttesh commented 8 years ago

@AKFourSeven updated the library with first name and last name avatar changes, setting the existing attribute 'charCount' to '2' will generate the first name and last name combined avatar. if only first name is present and charCount is 2 then it will generate for the first 2 letters.

akougblenou commented 8 years ago

Meaning you have accepted the pull request ?

uttesh commented 8 years ago

@AKFourSeven no , there was a branch conflict and i made few other changes code cleanup/format and functions. thanks

akougblenou commented 8 years ago

@uttesh okay I see, well glad it still did help.