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
Jérome Perrin
gitlab-ce
Commits
ac669df5
Commit
ac669df5
authored
Mar 09, 2017
by
mhasbini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
link issuable reference to itself in header
parent
f5c174a4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
1 deletion
+43
-1
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+18
-1
changelogs/unreleased/24137-issuable-permalink.yml
changelogs/unreleased/24137-issuable-permalink.yml
+4
-0
spec/features/issues/form_spec.rb
spec/features/issues/form_spec.rb
+10
-0
spec/features/merge_requests/form_spec.rb
spec/features/merge_requests/form_spec.rb
+11
-0
No files found.
app/helpers/issuables_helper.rb
View file @
ac669df5
module
IssuablesHelper
include
GitlabRoutingHelper
def
sidebar_gutter_toggle_icon
sidebar_gutter_collapsed?
?
icon
(
'angle-double-left'
,
{
'aria-hidden'
:
'true'
})
:
icon
(
'angle-double-right'
,
{
'aria-hidden'
:
'true'
})
end
...
...
@@ -95,8 +97,23 @@ module IssuablesHelper
h
(
milestone_title
.
presence
||
default_label
)
end
def
to_url_reference
(
issuable
)
case
issuable
when
Issue
link_to
issuable
.
to_reference
,
issue_url
(
issuable
)
when
MergeRequest
link_to
issuable
.
to_reference
,
merge_request_url
(
issuable
)
else
issuable
.
to_reference
end
end
def
issuable_meta
(
issuable
,
project
,
text
)
output
=
content_tag
:strong
,
"
#{
text
}
#{
issuable
.
to_reference
}
"
,
class:
"identifier"
output
=
content_tag
(
:strong
,
class:
"identifier"
)
do
concat
(
"
#{
text
}
"
)
concat
(
to_url_reference
(
issuable
))
end
output
<<
" opened
#{
time_ago_with_tooltip
(
issuable
.
created_at
)
}
by "
.
html_safe
output
<<
content_tag
(
:strong
)
do
author_output
=
link_to_member
(
project
,
issuable
.
author
,
size:
24
,
mobile_classes:
"hidden-xs"
,
tooltip:
true
)
...
...
changelogs/unreleased/24137-issuable-permalink.yml
0 → 100644
View file @
ac669df5
---
title
:
Link issuable reference to itself in meta-header
merge_request
:
9641
author
:
mhasbini
spec/features/issues/form_spec.rb
View file @
ac669df5
require
'rails_helper'
describe
'New/edit issue'
,
feature:
true
,
js:
true
do
include
GitlabRoutingHelper
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:user
)
{
create
(
:user
)}
let!
(
:user2
)
{
create
(
:user
)}
...
...
@@ -78,6 +80,14 @@ describe 'New/edit issue', feature: true, js: true do
expect
(
page
).
to
have_content
label2
.
title
end
end
page
.
within
'.issuable-meta'
do
issue
=
Issue
.
find_by
(
title:
'title'
)
expect
(
page
).
to
have_text
(
"Issue
#{
issue
.
to_reference
}
"
)
# compare paths because the host differ in test
expect
(
find_link
(
issue
.
to_reference
)[
:href
]).
to
end_with
(
issue_path
(
issue
))
end
end
it
'correctly updates the dropdown toggle when removing a label'
do
...
...
spec/features/merge_requests/form_spec.rb
View file @
ac669df5
require
'rails_helper'
describe
'New/edit merge request'
,
feature:
true
,
js:
true
do
include
GitlabRoutingHelper
let!
(
:project
)
{
create
(
:project
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
}
let
(
:fork_project
)
{
create
(
:project
,
forked_from_project:
project
)
}
let!
(
:user
)
{
create
(
:user
)}
...
...
@@ -84,6 +86,15 @@ describe 'New/edit merge request', feature: true, js: true do
expect
(
page
).
to
have_content
label2
.
title
end
end
page
.
within
'.issuable-meta'
do
merge_request
=
MergeRequest
.
find_by
(
source_branch:
'fix'
)
expect
(
page
).
to
have_text
(
"Merge Request
#{
merge_request
.
to_reference
}
"
)
# compare paths because the host differ in test
expect
(
find_link
(
merge_request
.
to_reference
)[
:href
])
.
to
end_with
(
merge_request_path
(
merge_request
))
end
end
end
...
...
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