Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
5c4416bb
Commit
5c4416bb
authored
May 16, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Loads move issue dropdown async
Closes #16563
parent
78a67fc4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
3 deletions
+34
-3
app/assets/javascripts/issuable_form.js.coffee
app/assets/javascripts/issuable_form.js.coffee
+17
-0
app/controllers/autocomplete_controller.rb
app/controllers/autocomplete_controller.rb
+15
-0
app/views/shared/issuable/_form.html.haml
app/views/shared/issuable/_form.html.haml
+1
-3
config/routes.rb
config/routes.rb
+1
-0
No files found.
app/assets/javascripts/issuable_form.js.coffee
View file @
5c4416bb
...
...
@@ -19,6 +19,7 @@ class @IssuableForm
@
form
.
on
"click"
,
".btn-cancel"
,
@
resetAutosave
@
initWip
()
@
initMoveDropdown
()
initAutosave
:
->
new
Autosave
@
titleField
,
[
...
...
@@ -80,3 +81,19 @@ class @IssuableForm
addWip
:
->
@
titleField
.
val
"WIP:
#{
@
titleField
.
val
()
}
"
initMoveDropdown
:
->
$moveDropdown
=
$
(
'.js-move-dropdown'
)
if
$moveDropdown
.
length
$
(
'.js-move-dropdown'
).
select2
ajax
:
url
:
$moveDropdown
.
data
(
'projects-url'
)
results
:
(
data
)
->
return
{
results
:
data
}
formatResult
:
(
project
)
->
project
.
name_with_namespace
formatSelection
:
(
project
)
->
project
.
name_with_namespace
app/controllers/autocomplete_controller.rb
View file @
5c4416bb
...
...
@@ -31,6 +31,21 @@ class AutocompleteController < ApplicationController
render
json:
@user
,
only:
[
:name
,
:username
,
:id
],
methods:
[
:avatar_url
]
end
def
projects
project
=
Project
.
find_by_id
(
params
[
:project_id
])
projects
=
current_user
.
authorized_projects
projects
=
projects
.
select
do
|
project
|
current_user
.
can?
(
:admin_issue
,
project
)
end
no_project
=
OpenStruct
.
new
(
id:
0
,
name_with_namespace:
'No project'
)
projects
.
unshift
(
no_project
.
marshal_dump
)
projects
.
delete
(
project
)
render
json:
projects
.
to_json
(
only:
[
:id
,
:name_with_namespace
],
methods: :name_with_namespace
)
end
private
def
find_users
...
...
app/views/shared/issuable/_form.html.haml
View file @
5c4416bb
...
...
@@ -90,9 +90,7 @@
=
label_tag
:move_to_project_id
,
'Move'
,
class:
'control-label'
.col-sm-10
.issuable-form-select-holder
-
projects
=
project_options
(
issuable
,
current_user
,
ability: :admin_issue
)
=
select_tag
(
:move_to_project_id
,
projects
,
include_blank:
true
,
class:
'select2'
,
data:
{
placeholder:
'Select project'
})
=
hidden_field_tag
:move_to_project_id
,
nil
,
class:
'js-move-dropdown'
,
data:
{
placeholder:
'Select project'
,
projects_url:
autocomplete_projects_path
(
project_id:
'1'
)
}
%span
{
data:
{
toggle:
'tooltip'
,
placement:
'auto top'
},
style:
'cursor: default'
,
title:
'Moving an issue will copy the discussion to a different project and close it here. All participants will be notified of the new location.'
}
...
...
config/routes.rb
View file @
5c4416bb
...
...
@@ -56,6 +56,7 @@ Rails.application.routes.draw do
# Autocomplete
get
'/autocomplete/users'
=>
'autocomplete#users'
get
'/autocomplete/users/:id'
=>
'autocomplete#user'
get
'/autocomplete/projects'
=>
'autocomplete#projects'
# Emojis
resources
:emojis
,
only: :index
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment