Tags (filters) saves when pressing Enter instead of deleting

This is for https://github.com/HabitRPG/habitrpg/issues/3983. The issue was that when editing a tag, when you pressed Enter, it would delete the tag you were editing. It was a legitimate annoyance. Now hitting enter instead saves the changes instead of deleting.
Technical details: when using < button >, if you don't set a type it will default to type="submit". When the < button > is a submit, and especially if it's a single input outside of the button, Enter is assumed to be a submission AND is considered a mouse click. Changing the button's type to type="button" however stops the Enter key from submitting. From there, just setup a ng-keyup function to check for the Enter key, and if so, save.
Good point; much better than my thing. Not sure how to update that commit
and all though to do that.

On Mon, Oct 27, 2014 at 1:15 PM, Tyler Renelle <notifications@github.com>
wrote:

> In views/main/filters.jade:
>
> > @@ -26,8 +26,8 @@
> >          ul(ng-if='_editing')
> >            li.filters-edit(ng-class='{active: user.filters[tag.id]}', ng-repeat='tag in user.tags', bindonce='user.tags')
> >              form.hrpg-input-group
> > -              input(type='text', ng-model='tag.name')
> > -              button(ng-click='user.ops.deleteTag({params:{id:tag.id}})')
> > +              input(type='text', ng-model='tag.name', ng-keyup='checkKeyForSaving($event)')
>
> Could we just use ui-keyup="{'13': 'saveOrEdit()'}" here and do away with
> the controller method?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/HabitRPG/habitrpg/pull/4141/files#r19433879>.
>



-- 
Glen E. Joyner Jr.
B.S Computer Science, Clemson University
Gaming Enthusiast, Developer