summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/group.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/group.js')
-rw-r--r--app/assets/javascripts/group.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/app/assets/javascripts/group.js b/app/assets/javascripts/group.js
new file mode 100644
index 00000000000..7732edde1e7
--- /dev/null
+++ b/app/assets/javascripts/group.js
@@ -0,0 +1,21 @@
+export default class Group {
+ constructor() {
+ this.groupPath = $('#group_path');
+ this.groupName = $('#group_name');
+ 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);
+ }
+ }
+
+ update() {
+ this.groupName.val(this.groupPath.val());
+ }
+
+ reset() {
+ this.groupPath.off('keyup', this.updateHandler);
+ this.groupName.off('keydown', this.resetHandler);
+ }
+}