jquery-maskmoney icon indicating copy to clipboard operation
jquery-maskmoney copied to clipboard

allow removal of thousands separator

Open gbass84 opened this issue 10 years ago • 21 comments

I thought it would be nice to allow a setting to remove the thousands separator on blur. I added it to the settings with default to "thousandsStay: true" and to the blurEvent function to string replacement.

I'm using intelliJ Idea, and it reformatted some indentation, so I apologize for the diff showing more changes than there really are.

gbass84 avatar Oct 21 '14 16:10 gbass84

I just forked this repository to make this same change for my own purposes. Definitely seems like a useful feature so that decimal values can be parsed from masked fields.

Nannoises avatar Oct 21 '14 17:10 Nannoises

I'm not sure why it's saying that the change event isn't firing, btw. I reviewed the code and it looks fine. The logic for the input.change() is preserved....

gbass84 avatar Oct 21 '14 17:10 gbass84

I'm not sure either, I've created a pull request for my similar solution to see if the tests pass.

Nannoises avatar Oct 21 '14 19:10 Nannoises

That did make it pass, but I'm not all that happy about setting and reading from the input twice. This solution does it a maximum of twice, I believe yours does it 2-3 times (1 is extraneous I think), but really it should only need to be done once. I'm still not sure what was causing the single access method to fail though.

gbass84 avatar Oct 21 '14 23:10 gbass84

My solution will only read and set from the input once, even if both affixStay and thousandsStay are set to false.

Nannoises avatar Oct 21 '14 23:10 Nannoises

excellent, i may have misread then! I was pretty sure that I could make it work with one, but I haven't figured out how to send something to CI without committing, which is really annoying. Isn't there a "run all tests" feature?

gbass84 avatar Oct 22 '14 00:10 gbass84

I didn't try running the tests locally, I just committed and the tests were run. Open the /test/index.html file in a browser though, and it should run your tests and display the results. Neatly done!

Nannoises avatar Oct 22 '14 13:10 Nannoises

Nice, good to know. I was trying to use github as editor and VCS, instead of using git as version control, and I think that was a source of many problems. I'm actually setting up git in my IDE so I can just import projects and work on them as intended.

I went back and looked at your fix again and I think I was reading the diffs wrong, the colors came out better on the second computer I used and made it clear what I was reading wrong.

This pull request can be closed, please merge #146 EDIT: Further testing revealed inadequate functionality, updated below

gbass84 avatar Oct 22 '14 14:10 gbass84

Ok, this it. Works as intended, one read and one write, now works to remove multiple separators for numbers over 999,999.99

gbass84 avatar Oct 22 '14 17:10 gbass84

Good catch!

Nannoises avatar Oct 22 '14 18:10 Nannoises

@gbass84 , did you see my pull request to your repo? Was hoping we could merge our efforts.

Nannoises avatar Oct 30 '14 12:10 Nannoises

I didn't until now, sorry. I'll get it merged tonight.

gbass84 avatar Oct 30 '14 14:10 gbass84

btw, when I reproduce the tests in alive environment on my machine, the test scenarios past. I'm not on my normal dev machine now to check the tests in the browser, but it might be that the test need to be fixed/changed, because I can definitely successfully unmask a negative 0-precision value with a prefix and suffix

gbass84 avatar Nov 19 '14 21:11 gbass84

Yea the automatic testing server is inconsistent and sometimes fails when the build will pass locally. Makes it difficult to see if there are real problems.

Nannoises avatar Nov 21 '14 18:11 Nannoises

@Nannoises @gbass84 sorry for taking so long to reply guys. we need to fix the tests before this get merged. I will try to take a look at this tomorrow :)

plentz avatar Feb 27 '15 13:02 plentz

Another thing that would be super awesome is to squash your commits(making the 21 commits into one). It's better for the repo history :)

plentz avatar Feb 28 '15 02:02 plentz

don't forget me :crying_cat_face:

plentz avatar Mar 08 '15 22:03 plentz

Since we pooled our efforts into this pull request from @gbass84 , I believe he will need to do the squashing. Let me know if I can help.

Nannoises avatar Mar 10 '15 13:03 Nannoises

Out of curiosity I went looking for how to do this. @gbass84 Will need to follow these instructions to update his pull request. http://eli.thegreenplace.net/2014/02/19/squashing-github-pull-requests-into-a-single-commit

Nannoises avatar Mar 10 '15 13:03 Nannoises

Yeah I'll get it done in the next day or two tops! On Mar 10, 2015 7:28 AM, Matt [email protected] wrote:Since we pooled our efforts into this pull request from @gbass84 , I believe he will need to do the squashing. Let me know if I can help.

—Reply to this email directly or view it on GitHub.

gbass84 avatar Mar 10 '15 13:03 gbass84

This brings it back to last the last good build related to this branch

gbass84 avatar Jun 23 '15 01:06 gbass84