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
Tatuya Kamada
gitlab-ce
Commits
4f143aa8
Commit
4f143aa8
authored
Feb 22, 2017
by
Simon Knox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
re-add Assign to Me link on new MR/Issue forms
parent
9f908cfc
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
55 additions
and
23 deletions
+55
-23
app/assets/javascripts/users_select.js
app/assets/javascripts/users_select.js
+21
-2
app/assets/stylesheets/pages/merge_requests.scss
app/assets/stylesheets/pages/merge_requests.scss
+5
-0
app/views/projects/issues/_form.html.haml
app/views/projects/issues/_form.html.haml
+0
-6
app/views/projects/merge_requests/_form.html.haml
app/views/projects/merge_requests/_form.html.haml
+0
-6
app/views/projects/merge_requests/_new_submit.html.haml
app/views/projects/merge_requests/_new_submit.html.haml
+0
-5
app/views/shared/issuable/form/_metadata.html.haml
app/views/shared/issuable/form/_metadata.html.haml
+2
-2
changelogs/unreleased/23948-assign-to-me.yml
changelogs/unreleased/23948-assign-to-me.yml
+4
-0
lib/gitlab/gon_helper.rb
lib/gitlab/gon_helper.rb
+1
-0
spec/features/issues/form_spec.rb
spec/features/issues/form_spec.rb
+13
-1
spec/features/merge_requests/form_spec.rb
spec/features/merge_requests/form_spec.rb
+9
-1
No files found.
app/assets/javascripts/users_select.js
View file @
4f143aa8
...
...
@@ -60,6 +60,15 @@
});
};
$
(
'
.assign-to-me-link
'
).
on
(
'
click
'
,
(
e
)
=>
{
e
.
preventDefault
();
$
(
e
.
currentTarget
).
hide
();
const
$input
=
$
(
`input[name="
${
$dropdown
.
data
(
'
field-name
'
)}
"]`
);
$input
.
val
(
gon
.
current_user_id
);
selectedId
=
$input
.
val
();
$dropdown
.
find
(
'
.dropdown-toggle-text
'
).
text
(
gon
.
current_user_fullname
).
removeClass
(
'
is-default
'
);
});
$block
.
on
(
'
click
'
,
'
.js-assign-yourself
'
,
function
(
e
)
{
e
.
preventDefault
();
...
...
@@ -199,6 +208,11 @@
if
(
$dropdown
.
hasClass
(
'
js-filter-bulk-update
'
)
||
$dropdown
.
hasClass
(
'
js-issuable-form-dropdown
'
))
{
e
.
preventDefault
();
selectedId
=
user
.
id
;
if
(
selectedId
===
gon
.
current_user_id
)
{
$
(
'
.assign-to-me-link
'
).
hide
();
}
else
{
$
(
'
.assign-to-me-link
'
).
show
();
}
return
;
}
if
(
$el
.
closest
(
'
.add-issues-modal
'
).
length
)
{
...
...
@@ -234,11 +248,16 @@
id
:
function
(
user
)
{
return
user
.
id
;
},
opened
:
function
(
e
)
{
const
$el
=
$
(
e
.
currentTarget
);
$el
.
find
(
'
.is-active
'
).
removeClass
(
'
is-active
'
);
$el
.
find
(
`li[data-user-id="
${
selectedId
}
"] .dropdown-menu-user-link`
).
addClass
(
'
is-active
'
);
},
renderRow
:
function
(
user
)
{
var
avatar
,
img
,
listClosingTags
,
listWithName
,
listWithUserName
,
selected
,
username
;
username
=
user
.
username
?
"
@
"
+
user
.
username
:
""
;
avatar
=
user
.
avatar_url
?
user
.
avatar_url
:
false
;
selected
=
user
.
id
===
selectedId
?
"
is-active
"
:
""
;
selected
=
user
.
id
===
parseInt
(
selectedId
,
10
)
?
"
is-active
"
:
""
;
img
=
""
;
if
(
user
.
beforeDivider
!=
null
)
{
"
<li> <a href='#' class='
"
+
selected
+
"
'>
"
+
user
.
name
+
"
</a> </li>
"
;
...
...
@@ -248,7 +267,7 @@
}
}
// split into three parts so we can remove the username section if nessesary
listWithName
=
"
<li> <a href='#' class='dropdown-menu-user-link
"
+
selected
+
"
'>
"
+
img
+
"
<strong class='dropdown-menu-user-full-name'>
"
+
user
.
name
+
"
</strong>
"
;
listWithName
=
"
<li
data-user-id=
"
+
user
.
id
+
"
> <a href='#' class='dropdown-menu-user-link
"
+
selected
+
"
'>
"
+
img
+
"
<strong class='dropdown-menu-user-full-name'>
"
+
user
.
name
+
"
</strong>
"
;
listWithUserName
=
"
<span class='dropdown-menu-user-username'>
"
+
username
+
"
</span>
"
;
listClosingTags
=
"
</a> </li>
"
;
if
(
username
===
''
)
{
...
...
app/assets/stylesheets/pages/merge_requests.scss
View file @
4f143aa8
...
...
@@ -426,6 +426,11 @@
}
}
.assign-to-me-link
{
padding-left
:
12px
;
white-space
:
nowrap
;
}
.table-holder
{
.ci-table
{
...
...
app/views/projects/issues/_form.html.haml
View file @
4f143aa8
=
form_for
[
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
@issue
],
html:
{
class:
'form-horizontal issue-form common-note-form js-quick-submit js-requires-input'
}
do
|
f
|
=
render
'shared/issuable/form'
,
f:
f
,
issuable:
@issue
:javascript
$
(
'
.assign-to-me-link
'
).
on
(
'
click
'
,
function
(
e
){
$
(
'
#issue_assignee_id
'
).
val
(
"
#{
current_user
.
id
}
"
).
trigger
(
"
change
"
);
e
.
preventDefault
();
});
app/views/projects/merge_requests/_form.html.haml
View file @
4f143aa8
=
form_for
[
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
@merge_request
],
html:
{
class:
'merge-request-form form-horizontal common-note-form js-requires-input js-quick-submit'
}
do
|
f
|
=
render
'shared/issuable/form'
,
f:
f
,
issuable:
@merge_request
:javascript
$
(
'
.assign-to-me-link
'
).
on
(
'
click
'
,
function
(
e
){
$
(
'
#merge_request_assignee_id
'
).
val
(
"
#{
current_user
.
id
}
"
).
trigger
(
"
change
"
);
e
.
preventDefault
();
});
app/views/projects/merge_requests/_new_submit.html.haml
View file @
4f143aa8
...
...
@@ -51,11 +51,6 @@
.mr-loading-status
=
spinner
:javascript
$
(
'
.assign-to-me-link
'
).
on
(
'
click
'
,
function
(
e
){
$
(
'
#merge_request_assignee_id
'
).
val
(
"
#{
current_user
.
id
}
"
).
trigger
(
"
change
"
);
e
.
preventDefault
();
});
:javascript
var
merge_request
=
new
MergeRequest
({
action
:
"
#{
(
@show_changes_tab
?
'new/diffs'
:
'new'
)
}
"
...
...
app/views/shared/issuable/form/_metadata.html.haml
View file @
4f143aa8
...
...
@@ -13,10 +13,10 @@
=
form
.
label
:assignee_id
,
"Assignee"
,
class:
"control-label
#{
"col-lg-4"
if
has_due_date
}
"
.col-sm-10
{
class:
(
"col-lg-8"
if
has_due_date
)
}
.issuable-form-select-holder
-
if
issuable
.
assignee_id
=
form
.
hidden_field
:assignee_id
=
dropdown_tag
(
user_dropdown_label
(
issuable
.
assignee_id
,
"Assignee"
),
options:
{
toggle_class:
"js-dropdown-keep-input js-user-search js-issuable-form-dropdown js-assignee-search"
,
title:
"Select assignee"
,
filter:
true
,
dropdown_class:
"dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee js-filter-submit"
,
placeholder:
"Search assignee"
,
data:
{
first_user:
current_user
.
try
(
:username
),
null_user:
true
,
current_user:
true
,
project_id:
issuable
.
project
.
try
(
:id
),
selected:
issuable
.
assignee_id
,
field_name:
"
#{
issuable
.
class
.
model_name
.
param_key
}
[assignee_id]"
,
default_label:
"Assignee"
}
})
=
link_to
'Assign to me'
,
'#'
,
class:
"assign-to-me-link
#{
'hide'
if
issuable
.
assignee_id
==
current_user
.
id
}
"
.form-group.issue-milestone
=
form
.
label
:milestone_id
,
"Milestone"
,
class:
"control-label
#{
"col-lg-4"
if
has_due_date
}
"
.col-sm-10
{
class:
(
"col-lg-8"
if
has_due_date
)
}
...
...
changelogs/unreleased/23948-assign-to-me.yml
0 → 100644
View file @
4f143aa8
---
title
:
Re-add Assign to me link to Merge Request and Issues
merge_request
:
author
:
lib/gitlab/gon_helper.rb
View file @
4f143aa8
...
...
@@ -14,6 +14,7 @@ module Gitlab
if
current_user
gon
.
current_user_id
=
current_user
.
id
gon
.
current_username
=
current_user
.
username
gon
.
current_user_fullname
=
current_user
.
name
end
end
end
...
...
spec/features/issues/form_spec.rb
View file @
4f143aa8
...
...
@@ -3,6 +3,7 @@ require 'rails_helper'
describe
'New/edit issue'
,
feature:
true
,
js:
true
do
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:user
)
{
create
(
:user
)}
let!
(
:user2
)
{
create
(
:user
)}
let!
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let!
(
:label
)
{
create
(
:label
,
project:
project
)
}
let!
(
:label2
)
{
create
(
:label
,
project:
project
)
}
...
...
@@ -10,6 +11,7 @@ describe 'New/edit issue', feature: true, js: true do
before
do
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user2
,
:master
]
login_as
(
user
)
end
...
...
@@ -22,14 +24,23 @@ describe 'New/edit issue', feature: true, js: true do
fill_in
'issue_title'
,
with:
'title'
fill_in
'issue_description'
,
with:
'title'
expect
(
find
(
'a'
,
text:
'Assign to me'
)).
to
be_visible
click_button
'Assignee'
page
.
within
'.dropdown-menu-user'
do
click_link
user
.
name
click_link
user
2
.
name
end
expect
(
find
(
'input[name="issue[assignee_id]"]'
,
visible:
false
).
value
).
to
match
(
user2
.
id
.
to_s
)
page
.
within
'.js-assignee-search'
do
expect
(
page
).
to
have_content
user2
.
name
end
expect
(
find
(
'a'
,
text:
'Assign to me'
)).
to
be_visible
click_link
'Assign to me'
expect
(
find
(
'input[name="issue[assignee_id]"]'
,
visible:
false
).
value
).
to
match
(
user
.
id
.
to_s
)
page
.
within
'.js-assignee-search'
do
expect
(
page
).
to
have_content
user
.
name
end
expect
(
find
(
'a'
,
text:
'Assign to me'
,
visible:
false
)).
not_to
be_visible
click_button
'Milestone'
page
.
within
'.issue-milestone'
do
...
...
@@ -94,6 +105,7 @@ describe 'New/edit issue', feature: true, js: true do
it
'allows user to update issue'
do
expect
(
find
(
'input[name="issue[assignee_id]"]'
,
visible:
false
).
value
).
to
match
(
user
.
id
.
to_s
)
expect
(
find
(
'input[name="issue[milestone_id]"]'
,
visible:
false
).
value
).
to
match
(
milestone
.
id
.
to_s
)
expect
(
find
(
'a'
,
text:
'Assign to me'
,
visible:
false
)).
not_to
be_visible
page
.
within
'.js-user-search'
do
expect
(
page
).
to
have_content
user
.
name
...
...
spec/features/merge_requests/form_spec.rb
View file @
4f143aa8
...
...
@@ -4,12 +4,14 @@ describe 'New/edit merge request', feature: true, js: true do
let!
(
:project
)
{
create
(
:project
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
}
let
(
:fork_project
)
{
create
(
:project
,
forked_from_project:
project
)
}
let!
(
:user
)
{
create
(
:user
)}
let!
(
:user2
)
{
create
(
:user
)}
let!
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let!
(
:label
)
{
create
(
:label
,
project:
project
)
}
let!
(
:label2
)
{
create
(
:label
,
project:
project
)
}
before
do
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user2
,
:master
]
end
context
'owned projects'
do
...
...
@@ -33,8 +35,14 @@ describe 'New/edit merge request', feature: true, js: true do
it
'creates new merge request'
do
click_button
'Assignee'
page
.
within
'.dropdown-menu-user'
do
click_link
user
.
name
click_link
user2
.
name
end
expect
(
find
(
'input[name="merge_request[assignee_id]"]'
,
visible:
false
).
value
).
to
match
(
user2
.
id
.
to_s
)
page
.
within
'.js-assignee-search'
do
expect
(
page
).
to
have_content
user2
.
name
end
click_link
'Assign to me'
expect
(
find
(
'input[name="merge_request[assignee_id]"]'
,
visible:
false
).
value
).
to
match
(
user
.
id
.
to_s
)
page
.
within
'.js-assignee-search'
do
expect
(
page
).
to
have_content
user
.
name
...
...
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