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
78b01068
Commit
78b01068
authored
Jan 12, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move issuable reference display to a helper method
parent
0e14a2f2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
4 deletions
+46
-4
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+4
-0
app/views/projects/issues/_issue.html.haml
app/views/projects/issues/_issue.html.haml
+1
-2
app/views/projects/merge_requests/_merge_request.html.haml
app/views/projects/merge_requests/_merge_request.html.haml
+1
-2
spec/helpers/issuables_helper_spec.rb
spec/helpers/issuables_helper_spec.rb
+40
-0
No files found.
app/helpers/issuables_helper.rb
View file @
78b01068
...
...
@@ -162,6 +162,10 @@ module IssuablesHelper
]
end
def
issuable_reference
(
issuable
)
@show_full_reference
?
issuable
.
to_reference
(
full:
true
)
:
issuable
.
to_reference
(
@group
||
@project
)
end
def
issuable_filter_present?
issuable_filter_params
.
any?
{
|
k
|
params
.
key?
(
k
)
}
end
...
...
app/views/projects/issues/_issue.html.haml
View file @
78b01068
...
...
@@ -34,8 +34,7 @@
=
note_count
.issue-info
=
@show_full_reference
?
issue
.
to_reference
(
full:
true
)
:
issue
.
to_reference
(
@group
||
@project
)
·
#{
issuable_reference
(
issue
)
}
·
opened
#{
time_ago_with_tooltip
(
issue
.
created_at
,
placement:
'bottom'
)
}
by
#{
link_to_member
(
@project
,
issue
.
author
,
avatar:
false
)
}
-
if
issue
.
milestone
...
...
app/views/projects/merge_requests/_merge_request.html.haml
View file @
78b01068
...
...
@@ -46,8 +46,7 @@
=
note_count
.merge-request-info
=
@show_full_reference
?
merge_request
.
to_reference
(
full:
true
)
:
merge_request
.
to_reference
(
@group
||
@project
)
·
#{
issuable_reference
(
merge_request
)
}
·
opened
#{
time_ago_with_tooltip
(
merge_request
.
created_at
,
placement:
'bottom'
)
}
by
#{
link_to_member
(
@project
,
merge_request
.
author
,
avatar:
false
)
}
-
if
merge_request
.
target_project
.
default_branch
!=
merge_request
.
target_branch
...
...
spec/helpers/issuables_helper_spec.rb
View file @
78b01068
...
...
@@ -115,6 +115,46 @@ describe IssuablesHelper do
end
end
describe
'#issuable_reference'
do
context
'when show_full_reference truthy'
do
it
'display issuable full reference'
do
assign
(
:show_full_reference
,
true
)
issue
=
build_stubbed
(
:issue
)
expect
(
helper
.
issuable_reference
(
issue
)).
to
eql
(
issue
.
to_reference
(
full:
true
))
end
end
context
'when show_full_reference falsey'
do
context
'when @group present'
do
it
'display issuable reference to @group'
do
project
=
build_stubbed
(
:project
)
assign
(
:show_full_reference
,
nil
)
assign
(
:group
,
project
.
namespace
)
issue
=
build_stubbed
(
:issue
)
expect
(
helper
.
issuable_reference
(
issue
)).
to
eql
(
issue
.
to_reference
(
project
.
namespace
))
end
end
context
'when @project present'
do
it
'display issuable reference to @project'
do
project
=
build_stubbed
(
:project
)
assign
(
:show_full_reference
,
nil
)
assign
(
:group
,
nil
)
assign
(
:project
,
project
)
issue
=
build_stubbed
(
:issue
)
expect
(
helper
.
issuable_reference
(
issue
)).
to
eql
(
issue
.
to_reference
(
project
))
end
end
end
end
describe
'#issuable_filter_present?'
do
it
'returns true when any key is present'
do
allow
(
helper
).
to
receive
(
:params
).
and_return
(
...
...
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