diff options
author | Arinde Eniola <eniolaarinde1@gmail.com> | 2016-04-12 16:41:34 +0300 |
---|---|---|
committer | Arinde Eniola <eniolaarinde1@gmail.com> | 2016-04-12 16:41:34 +0300 |
commit | 050110c9c90d39ea9c128ac183c13a37250fd7a1 (patch) | |
tree | d123ba978842f53c8f5f42b1f71c842682e47c01 /app/assets/javascripts/behaviors | |
parent | e933a0b058cdddf0319bd2318cdf0af69fa141ed (diff) |
hide help block when user is creating a new project inside a group
Diffstat (limited to 'app/assets/javascripts/behaviors')
-rw-r--r-- | app/assets/javascripts/behaviors/requires_input.js.coffee | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/app/assets/javascripts/behaviors/requires_input.js.coffee b/app/assets/javascripts/behaviors/requires_input.js.coffee index 79d750d1847..0faa570ce13 100644 --- a/app/assets/javascripts/behaviors/requires_input.js.coffee +++ b/app/assets/javascripts/behaviors/requires_input.js.coffee @@ -35,4 +35,18 @@ $.fn.requiresInput = -> $form.on 'change input', fieldSelector, requireInput $ -> - $('form.js-requires-input').requiresInput() + $form = $('form.js-requires-input') + $form.requiresInput() + + # Hide or Show the help block when creating a new project + # based on the option selected + hideOrShowHelpBlock = (form) -> + selected = $('.js-select-namespace option:selected') + if selected.length and selected.data('options-parent') is 'groups' + return form.find('.help-block').hide() + else if selected.length + form.find('.help-block').show() + + hideOrShowHelpBlock($form) + + $('.select2.js-select-namespace').change -> hideOrShowHelpBlock($form) |