diff options
author | Martin Wortschack <mwortschack@gitlab.com> | 2018-10-30 16:23:47 +0000 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2018-10-30 16:23:47 +0000 |
commit | 66e8ecffa0990651e7bac46ac65120f5a98b1749 (patch) | |
tree | 527d4fc5bc0c341ddab80cd9f27ddaca0b822d11 /app/assets/javascripts/group.js | |
parent | e9814aae809fb057f9126d9574c313fa18836ec0 (diff) | |
download | gitlab-ce-66e8ecffa0990651e7bac46ac65120f5a98b1749.tar.gz |
Resolve "Create new group: Rename form fields and update UI"
Diffstat (limited to 'app/assets/javascripts/group.js')
-rw-r--r-- | app/assets/javascripts/group.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/app/assets/javascripts/group.js b/app/assets/javascripts/group.js index 4365305c168..903c838e266 100644 --- a/app/assets/javascripts/group.js +++ b/app/assets/javascripts/group.js @@ -1,4 +1,5 @@ import $ from 'jquery'; +import { slugifyWithHyphens } from './lib/utils/text_utility'; export default class Group { constructor() { @@ -7,17 +8,18 @@ export default class Group { this.updateHandler = this.update.bind(this); this.resetHandler = this.reset.bind(this); if (this.groupName.val() === '') { - this.groupPath.on('keyup', this.updateHandler); - this.groupName.on('keydown', this.resetHandler); + this.groupName.on('keyup', this.updateHandler); + this.groupPath.on('keydown', this.resetHandler); } } update() { - this.groupName.val(this.groupPath.val()); + const slug = slugifyWithHyphens(this.groupName.val()); + this.groupPath.val(slug); } reset() { - this.groupPath.off('keyup', this.updateHandler); - this.groupName.off('keydown', this.resetHandler); + this.groupName.off('keyup', this.updateHandler); + this.groupPath.off('keydown', this.resetHandler); } } |