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
201101df
Commit
201101df
authored
Mar 19, 2016
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Assign to me button and unassigned.
parent
5db2622a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
31 deletions
+39
-31
app/assets/javascripts/issuable_context.js.coffee
app/assets/javascripts/issuable_context.js.coffee
+1
-2
app/assets/javascripts/users_select.js.coffee
app/assets/javascripts/users_select.js.coffee
+37
-28
app/views/shared/issuable/_sidebar.html.haml
app/views/shared/issuable/_sidebar.html.haml
+1
-1
No files found.
app/assets/javascripts/issuable_context.js.coffee
View file @
201101df
class
@
IssuableContext
constructor
:
->
@
initParticipants
()
new
UsersSelect
()
new
UsersSelect
(
currentUser
)
$
(
'select.select2'
).
select2
({
width
:
'resolve'
,
dropdownAutoWidth
:
true
})
$
(
".issuable-sidebar .inline-update"
).
on
"change"
,
"select"
,
->
...
...
app/assets/javascripts/users_select.js.coffee
View file @
201101df
class
@
UsersSelect
constructor
:
->
constructor
:
(
currentUser
)
->
@
usersPath
=
"/autocomplete/users.json"
@
userPath
=
"/autocomplete/users/:id.json"
@
currentUser
=
JSON
.
parse
(
currentUser
)
$
(
'.js-user-search'
).
each
(
i
,
dropdown
)
=>
$dropdown
=
$
(
dropdown
)
...
...
@@ -19,6 +20,40 @@ class @UsersSelect
$value
=
$block
.
find
(
'.value'
)
$loading
=
$block
.
find
(
'.block-loading'
).
fadeOut
()
$block
.
on
(
'click'
,
'.js-assign-yourself'
,
(
e
)
=>
e
.
preventDefault
()
assignTo
(
@
currentUser
.
id
)
)
assignTo
=
(
selected
)
->
data
=
{}
data
[
abilityName
]
=
{}
data
[
abilityName
].
assignee_id
=
selected
$loading
.
fadeIn
()
$
.
ajax
(
type
:
'PUT'
dataType
:
'json'
url
:
issueURL
data
:
data
).
done
(
data
)
->
$loading
.
fadeOut
()
$selectbox
.
hide
()
if
data
.
assignee
user
=
name
:
data
.
assignee
.
name
username
:
data
.
assignee
.
username
avatar
:
data
.
assignee
.
avatar
.
url
else
user
=
name
:
'Unassigned'
username
:
''
avatar
:
''
$value
.
html
(
noAssigneeTemplate
(
user
))
$value
.
find
(
'a'
).
attr
(
'href'
)
noAssigneeTemplate
=
_
.
template
(
'<% if (username) { %>
<a class="author_link " href="/u/<%= username %>">
...
...
@@ -108,33 +143,7 @@ class @UsersSelect
selected
=
$dropdown
.
closest
(
'.selectbox'
)
.
find
(
"input[name='
#{
$dropdown
.
data
(
'field-name'
)
}
']"
).
val
()
data
=
{}
data
[
abilityName
]
=
{}
data
[
abilityName
].
assignee_id
=
selected
$loading
.
fadeIn
()
$
.
ajax
(
type
:
'PUT'
dataType
:
'json'
url
:
issueURL
data
:
data
).
done
(
data
)
->
$loading
.
fadeOut
()
$selectbox
.
hide
()
if
data
.
assignee
user
=
name
:
data
.
assignee
.
name
username
:
data
.
assignee
.
username
avatar
:
data
.
assignee
.
avatar
.
url
else
user
=
name
:
'Unassigned'
username
:
''
avatar
:
''
$value
.
html
(
noAssigneeTemplate
(
user
))
$value
.
find
(
'a'
).
attr
(
'href'
)
assignTo
(
selected
)
renderRow
:
(
user
)
->
username
=
if
user
.
username
then
"@
#{
user
.
username
}
"
else
""
...
...
app/views/shared/issuable/_sidebar.html.haml
View file @
201101df
...
...
@@ -152,5 +152,5 @@
:javascript
new
MilestoneSelect
();
new
LabelsSelect
();
new
IssuableContext
();
new
IssuableContext
(
'
#{
current_user
.
to_json
(
only:
[
:username
,
:id
,
:name
])
}
'
);
new
Subscription
(
'
.subscription
'
)
\ No newline at end of file
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