diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index c51860d1604eb6225ac8b72372641067f9097a77..d6aed79fc0bcd94d65fb6716fadbe8ab6f5ba512 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -47,6 +47,7 @@ require('./behaviors/details_behavior'); require('./behaviors/quick_submit'); require('./behaviors/requires_input'); require('./behaviors/toggler_behavior'); +require('./behaviors/bind_in_out'); // blob require('./blob/blob_ci_yaml'); diff --git a/app/assets/javascripts/behaviors/bind_in_out.js.es6 b/app/assets/javascripts/behaviors/bind_in_out.js.es6 index 3cb892451e37d2ae954fbfb2b94f8eb5945b2498..1cc0fc750b5601cbb8e18d180db3e6c7f6a3ad9f 100644 --- a/app/assets/javascripts/behaviors/bind_in_out.js.es6 +++ b/app/assets/javascripts/behaviors/bind_in_out.js.es6 @@ -41,8 +41,4 @@ class BindInOut { } } -const global = window.gl || (window.gl = {}); - -global.BindInOut = BindInOut; - -module.exports = BindInOut; +export default BindInOut; diff --git a/app/assets/javascripts/dispatcher.js.es6 b/app/assets/javascripts/dispatcher.js.es6 index d0b8474f2cc6b76215ea27e02b358aedc6bc9c66..2852417b1c96df0866c4f834b5b1c64e628cb082 100644 --- a/app/assets/javascripts/dispatcher.js.es6 +++ b/app/assets/javascripts/dispatcher.js.es6 @@ -35,6 +35,8 @@ /* global Labels */ /* global Shortcuts */ +import BindInOut from './behaviors/bind_in_out.js.es6'; + const ShortcutsBlob = require('./shortcuts_blob'); const UserCallout = require('./user_callout'); @@ -217,7 +219,9 @@ const UserCallout = require('./user_callout'); break; case 'groups:new': case 'admin:groups:new': - gl.BindInOut.initAll(); + case 'groups:create': + case 'admin:groups:create': + BindInOut.initAll(); case 'groups:new': case 'admin:groups:new': case 'groups:edit': diff --git a/app/views/shared/_group_form.html.haml b/app/views/shared/_group_form.html.haml index 5b8c9a662052675e144190b81d0f6437175f9dd3..c2d9ac87b20419292422a3e677309504d9d7c58d 100644 --- a/app/views/shared/_group_form.html.haml +++ b/app/views/shared/_group_form.html.haml @@ -17,7 +17,7 @@ %strong= parent.full_path + '/' = f.text_field :path, placeholder: 'open-source', class: 'form-control', autofocus: local_assigns[:autofocus] || false, required: true, - pattern: Gitlab::Regex::NAMESPACE_REGEX_STR_SIMPLE, + pattern: Gitlab::Regex::NAMESPACE_REGEX_STR_JS, title: 'Please choose a group name with no special characters.', "data-bind-in" => "#{'create_chat_team' if Gitlab.config.mattermost.enabled}" - if parent diff --git a/spec/javascripts/behaviors/bind_in_out_spec.js.es6 b/spec/javascripts/behaviors/bind_in_out_spec.js.es6 index 69d2460ab1c252bc4e81f25d0df6e33e69c2d0ac..4f889c58bcd1926c056c81e26ea01412df5f2d80 100644 --- a/spec/javascripts/behaviors/bind_in_out_spec.js.es6 +++ b/spec/javascripts/behaviors/bind_in_out_spec.js.es6 @@ -1,5 +1,5 @@ -const BindInOut = require('~/behaviors/bind_in_out'); -const ClassSpecHelper = require('../helpers/class_spec_helper'); +import BindInOut from '~/behaviors/bind_in_out.js.es6'; +import ClassSpecHelper from '../helpers/class_spec_helper.js.es6'; describe('BindInOut', function () { describe('.constructor', function () {