Skip to content
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

Bootstrap.Forms.Field insists on humanising labels that don't need to be humanised #58

Closed
danpl opened this issue Feb 4, 2013 · 8 comments

Comments

@danpl
Copy link
Contributor

danpl commented Feb 4, 2013

Currently if I assign human-readable text to the label property of a Bootstrap.Forms.Field-derived control, it insists on dicking around with it via the human() function.

And by "dicking around", I mean this:

    // Underscore string
    value = Ember.String.decamelize(value);
    // Replace all _ with spaces
    value = value.replace(/_/g, " ");
    // Capitalize the first letter of every word
    value = value.replace(/(^|\s)([a-z])/g, function(m,p1,p2){ return p1+p2.toUpperCase(); });
    return value;

In my copy of ember-bootstrap, I just commented the call to human() out, but it would make sense to add some sort of additional property that would prevent human() from being called -- or to make that the default behaviour.

@dmathieu
Copy link
Contributor

dmathieu commented Feb 4, 2013

Could you give us an example of handlebars code which does not behaves as expected ?

@danpl
Copy link
Contributor Author

danpl commented Feb 4, 2013

Something like this:

{{view Bootstrap.Forms.TextField valueBinding="baz" label="Name of an animal"}}

-- results in a label of "Name Of An Animal", which aside from looking rather ugly, violates all sorts of grammar rules.

@dmathieu
Copy link
Contributor

dmathieu commented Feb 4, 2013

Yes, this is a bug.
The label should be humanized only if none has been provided and we take it automatically from the value's name.

If you want to work on a pull request, feel free to do so (=> remove the humanize if the label is provided in the tag, but not if it's determined automatically).
Otherwise, I'll look into this in a few days.

@danpl
Copy link
Contributor Author

danpl commented Feb 4, 2013

At the moment, I've just commented out the call to human(), but I've forked the repo, and if I have some time tomorrow, I'll have a go at it.

danpl added a commit to danpl/ember-bootstrap that referenced this issue Feb 4, 2013
@danpl
Copy link
Contributor Author

danpl commented Feb 4, 2013

Had a few spare moments, did a pull request (separate issue, haven't figured out how to link pull requests to an existing issue yet!).

danpl added a commit to danpl/ember-bootstrap that referenced this issue Feb 5, 2013
@danpl
Copy link
Contributor Author

danpl commented Feb 5, 2013

OK, used the labelCache prop this time, and updated the tests so that they test for correct behaviour.

@dmathieu
Copy link
Contributor

dmathieu commented Feb 5, 2013

Awesome ! If you open a pull request with this commit, I merge it this morning :)

dmathieu added a commit that referenced this issue Feb 5, 2013
Better fix for #58, passes tests
@dmathieu
Copy link
Contributor

dmathieu commented Feb 5, 2013

Fixed with PR #60. Thanks @danpl

@dmathieu dmathieu closed this as completed Feb 5, 2013
rtablada pushed a commit to rtablada/ember-bootstrap that referenced this issue Jun 6, 2017
)

This removes the assumption that the modal closer is exactly three parentViews beneath the modal.
rtablada pushed a commit to rtablada/ember-bootstrap that referenced this issue Jun 6, 2017
…s#58)

This allows use cases like custom close buttons or custom submit buttons anywhere in the modal component hierarchy.
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

No branches or pull requests

2 participants