hide help block when user is creating a new project inside a group
This commit is contained in:
parent
e933a0b058
commit
050110c9c9
4 changed files with 27 additions and 4 deletions
|
@ -26,6 +26,7 @@ v 8.7.0 (unreleased)
|
|||
- API: Fix milestone filtering by `iid` (Robert Schilling)
|
||||
- Implement 'Groups View' as an option for dashboard preferences !3379 (Elias W.)
|
||||
- Better errors handling when creating milestones inside groups
|
||||
- Hide `Create a group` help block when creating a new project in a group
|
||||
- Implement 'TODOs View' as an option for dashboard preferences !3379 (Elias W.)
|
||||
- Gracefully handle notes on deleted commits in merge requests (Stan Hu)
|
||||
- Fix creation of merge requests for orphaned branches (Stan Hu)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -3,8 +3,16 @@ module NamespacesHelper
|
|||
groups = current_user.owned_groups + current_user.masters_groups
|
||||
users = [current_user.namespace]
|
||||
|
||||
group_opts = ["Groups", groups.sort_by(&:human_name).map {|g| [display_path ? g.path : g.human_name, g.id]} ]
|
||||
users_opts = [ "Users", users.sort_by(&:human_name).map {|u| [display_path ? u.path : u.human_name, u.id]} ]
|
||||
data_attr_group = { 'data-options-parent' => 'groups' }
|
||||
data_attr_users = { 'data-options-parent' => 'users' }
|
||||
|
||||
group_opts = [
|
||||
"Groups", groups.sort_by(&:human_name).map { |g| [display_path ? g.path : g.human_name, g.id, data_attr_group] }
|
||||
]
|
||||
|
||||
users_opts = [
|
||||
"Users", users.sort_by(&:human_name).map { |u| [display_path ? u.path : u.human_name, u.id, data_attr_users] }
|
||||
]
|
||||
|
||||
options = []
|
||||
options << group_opts
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
- if current_user.can_select_namespace?
|
||||
.input-group-addon
|
||||
= root_url
|
||||
= f.select :namespace_id, namespaces_options(params[:namespace_id] || :current_user, display_path: true), {}, {class: 'select2', tabindex: 1}
|
||||
= f.select :namespace_id, namespaces_options(params[:namespace_id] || :current_user, display_path: true), {}, {class: 'select2 js-select-namespace', tabindex: 1}
|
||||
.input-group-addon
|
||||
\/
|
||||
- else
|
||||
|
|
Loading…
Reference in a new issue