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
Léo-Paul Géneau
gitlab-ce
Commits
5db2622a
Commit
5db2622a
authored
Mar 19, 2016
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Assign current user when no user is assigned link
parent
f6491260
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
40 deletions
+77
-40
app/assets/javascripts/labels_select.js.coffee
app/assets/javascripts/labels_select.js.coffee
+10
-11
app/assets/javascripts/users_select.js.coffee
app/assets/javascripts/users_select.js.coffee
+55
-26
app/assets/stylesheets/pages/issuable.scss
app/assets/stylesheets/pages/issuable.scss
+6
-0
app/views/shared/issuable/_sidebar.html.haml
app/views/shared/issuable/_sidebar.html.haml
+6
-3
No files found.
app/assets/javascripts/labels_select.js.coffee
View file @
5db2622a
...
@@ -31,17 +31,16 @@ class @LabelsSelect
...
@@ -31,17 +31,16 @@ class @LabelsSelect
issueURLSplit
=
issueUpdateURL
.
split
(
'/'
)
if
issueUpdateURL
?
issueURLSplit
=
issueUpdateURL
.
split
(
'/'
)
if
issueUpdateURL
?
if
issueUpdateURL
if
issueUpdateURL
labelHTMLTemplate
=
_
.
template
(
labelHTMLTemplate
=
_
.
template
(
'<% _.each(labels, function(label){ %>'
+
'<% _.each(labels, function(label){ %>
'<a href="'
+
<a href="
[
''
,
issueURLSplit
[
1
],
issueURLSplit
[
2
],
''
].
join
(
'/'
)
+
#{["",issueURLSplit[1], issueURLSplit[2],""].join("/")}
'issues?label_name=<%= label.title %>">'
+
issues?label_name=<%= label.title %>">
'<span class="label color-label" '
+
<span class="label color-label" style="background-color: <%= label.color %>; color: #FFFFFF">
'style="background-color: <%= label.color %>; '
+
<%= label.title %>
'color: #FFFFFF">'
+
</span>
'<%= label.title %>'
+
</a>
'</span>'
+
<% }); %>'
'</a>'
+
);
'<% }); %>'
);
labelNoneHTMLTemplate
=
_
.
template
(
'<div class="light">None</div>'
)
labelNoneHTMLTemplate
=
_
.
template
(
'<div class="light">None</div>'
)
if
newLabelField
.
length
and
$dropdown
.
hasClass
'js-extra-options'
if
newLabelField
.
length
and
$dropdown
.
hasClass
'js-extra-options'
...
...
app/assets/javascripts/users_select.js.coffee
View file @
5db2622a
...
@@ -19,6 +19,27 @@ class @UsersSelect
...
@@ -19,6 +19,27 @@ class @UsersSelect
$value
=
$block
.
find
(
'.value'
)
$value
=
$block
.
find
(
'.value'
)
$loading
=
$block
.
find
(
'.block-loading'
).
fadeOut
()
$loading
=
$block
.
find
(
'.block-loading'
).
fadeOut
()
noAssigneeTemplate
=
_
.
template
(
'<% if (username) { %>
<a class="author_link " href="/u/<%= username %>">
<% if( avatar ) { %>
<img width="32" class="avatar avatar-inline s32" alt="" src="<%= avatar %>">
<% } %>
<span class="author"><%= name %></span>
<span class="username">
@<%= username %>
</span>
</a>
<% } else { %>
<span class="assign-yourself">
No assignee -
<a href="#" class="js-assign-yourself">
assign yourself
</a>
</span>
<% } %>'
)
$dropdown
.
glDropdown
(
$dropdown
.
glDropdown
(
data
:
(
term
,
callback
)
=>
data
:
(
term
,
callback
)
=>
@
users
term
,
(
users
)
=>
@
users
term
,
(
users
)
=>
...
@@ -100,21 +121,21 @@ class @UsersSelect
...
@@ -100,21 +121,21 @@ class @UsersSelect
).
done
(
data
)
->
).
done
(
data
)
->
$loading
.
fadeOut
()
$loading
.
fadeOut
()
$selectbox
.
hide
()
$selectbox
.
hide
()
href
=
$value
.
show
()
if
data
.
assignee
.
find
(
'.author'
)
user
=
.
text
(
data
.
assignee
.
name
)
name
:
data
.
assignee
.
name
.
end
()
username
:
data
.
assignee
.
username
.
find
(
'.username'
)
avatar
:
data
.
assignee
.
avatar
.
url
.
text
(
"@
#{
data
.
assignee
.
username
}
"
)
else
.
end
()
user
=
.
find
(
'a'
)
name
:
'Unassigned'
.
attr
(
'href'
)
username
:
''
splitHref
=
href
.
split
(
'/'
)
avatar
:
''
splitHref
[
splitHref
.
length
-
1
]
=
data
.
assignee
.
username
$value
$value
.
html
(
noAssigneeTemplate
(
user
))
.
find
(
'a
'
)
$value
.
find
(
'a'
).
attr
(
'href
'
)
.
attr
(
'href'
,
splitHref
.
join
(
'/'
))
renderRow
:
(
user
)
->
renderRow
:
(
user
)
->
username
=
if
user
.
username
then
"@
#{
user
.
username
}
"
else
""
username
=
if
user
.
username
then
"@
#{
user
.
username
}
"
else
""
avatar
=
if
user
.
avatar_url
then
user
.
avatar_url
else
false
avatar
=
if
user
.
avatar_url
then
user
.
avatar_url
else
false
...
@@ -131,17 +152,25 @@ class @UsersSelect
...
@@ -131,17 +152,25 @@ class @UsersSelect
if
avatar
if
avatar
img
=
"<img src='
#{
avatar
}
' class='avatar avatar-inline' width='30' />"
img
=
"<img src='
#{
avatar
}
' class='avatar avatar-inline' width='30' />"
"<li>
# split into three parts so we can remove the username section if nessesary
<a href='#' class='dropdown-menu-user-link
#{
selected
}
'>
listWithName
=
"<li>
#{
img
}
<a href='#' class='dropdown-menu-user-link
#{
selected
}
'>
<strong class='dropdown-menu-user-full-name'>
#{
img
}
#{
user
.
name
}
<strong class='dropdown-menu-user-full-name'>
</strong>
#{
user
.
name
}
<span class='dropdown-menu-user-username'>
</strong>"
#{
username
}
</span>
listWithUserName
=
"<span class='dropdown-menu-user-username'>
</a>
#{
username
}
</li>"
</span>"
listClosingTags
=
"</a>
</li>"
if
username
is
''
listWithUserName
=
''
listWithName
+
listWithUserName
+
listClosingTags
)
)
$
(
'.ajax-users-select'
).
each
(
i
,
select
)
=>
$
(
'.ajax-users-select'
).
each
(
i
,
select
)
=>
...
...
app/assets/stylesheets/pages/issuable.scss
View file @
5db2622a
...
@@ -133,6 +133,12 @@
...
@@ -133,6 +133,12 @@
.value
{
.value
{
line-height
:
1
;
line-height
:
1
;
.assign-yourself
{
margin-top
:
10px
;
font-weight
:
normal
;
display
:
block
;
}
}
}
.bold
{
.bold
{
...
...
app/views/shared/issuable/_sidebar.html.haml
View file @
5db2622a
...
@@ -44,11 +44,14 @@
...
@@ -44,11 +44,14 @@
%span
.username
%span
.username
=
issuable
.
assignee
.
to_reference
=
issuable
.
assignee
.
to_reference
-
else
-
else
.light
None
%span
.assign-yourself
No assignee -
%a
.js-assign-yourself
{
href
:'#'
}
assign yourself
.selectbox.hide-collapsed
.selectbox.hide-collapsed
=
f
.
hidden_field
'assignee_id'
,
value:
issuable
.
assignee_id
,
id:
nil
=
f
.
hidden_field
'assignee_id'
,
value:
issuable
.
assignee_id
,
id:
'issue_assignee_id'
=
dropdown_tag
(
'Select assignee'
,
options:
{
toggle_class:
'js-user-search js-author-search'
,
title:
'Assign user'
,
filter:
true
,
dropdown_class:
'dropdown-menu-user dropdown-menu-selectable dropdown-menu-author'
,
placeholder:
'Search users'
,
data:
{
first_user:
(
current_user
.
username
if
current_user
),
current_user:
true
,
project_id:
(
@project
.
id
if
@project
),
field_name:
"
#{
issuable
.
to_ability_name
}
[assignee_id]"
,
issue_update:
issuable_url
,
ability_name:
issuable
.
to_ability_name
}
})
=
dropdown_tag
(
'Select assignee'
,
options:
{
toggle_class:
'js-user-search js-author-search'
,
title:
'Assign user'
,
filter:
true
,
dropdown_class:
'dropdown-menu-user dropdown-menu-selectable dropdown-menu-author'
,
placeholder:
'Search users'
,
data:
{
first_user:
(
current_user
.
username
if
current_user
),
current_user:
true
,
project_id:
(
@project
.
id
if
@project
),
field_name:
"
#{
issuable
.
to_ability_name
}
[assignee_id]"
,
issue_update:
issuable_url
,
ability_name:
issuable
.
to_ability_name
,
null_user:
true
}
})
.block.milestone
.block.milestone
.sidebar-collapsed-icon
.sidebar-collapsed-icon
...
...
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