Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
d1867c1c7a2c
Commit
d1867c1c
authored
Jan 10, 2017
by
Oswaldo Ferreira
Browse files
Present group and dashboard MR list without grouping by project
parent
d54b3da7a362
Changes
8
Hide whitespace changes
Inline
Side-by-side
app/controllers/dashboard_controller.rb
View file @
d1867c1c
...
...
@@ -4,6 +4,7 @@
before_action
:event_filter
,
only: :activity
before_action
:projects
,
only:
[
:issues
,
:merge_requests
]
before_action
:set_show_full_reference
,
only:
[
:issues
,
:merge_requests
]
respond_to
:html
...
...
@@ -34,4 +35,8 @@
@events
=
@event_filter
.
apply_filter
(
@events
).
with_associations
@events
=
@events
.
limit
(
20
).
offset
(
params
[
:offset
]
||
0
)
end
def
set_show_full_reference
@show_full_reference
=
true
end
end
app/models/issue.rb
View file @
d1867c1c
...
...
@@ -97,6 +97,6 @@
end
end
def
to_reference
(
from
=
nil
,
full
_path
:
false
)
def
to_reference
(
from
=
nil
,
full:
false
)
reference
=
"
#{
self
.
class
.
reference_prefix
}#{
iid
}
"
...
...
@@ -101,6 +101,6 @@
reference
=
"
#{
self
.
class
.
reference_prefix
}#{
iid
}
"
"
#{
project
.
to_reference
(
from
,
full
_path
:
full
_path
)
}#{
reference
}
"
"
#{
project
.
to_reference
(
from
,
full:
full
)
}#{
reference
}
"
end
def
referenced_merge_requests
(
current_user
=
nil
)
...
...
app/models/project.rb
View file @
d1867c1c
...
...
@@ -591,10 +591,12 @@
end
end
def
to_reference
(
from
=
nil
,
full_path:
false
)
return
path_with_namespace
if
full_path
path_from
(
from
)
def
to_reference
(
from
=
nil
,
full:
false
)
if
full
||
cross_namespace_reference?
(
from
)
path_with_namespace
elsif
cross_project_reference?
(
from
)
path
end
end
def
to_human_reference
(
from_project
=
nil
)
...
...
@@ -1289,12 +1291,4 @@
private
def
path_from
(
from
)
if
cross_namespace_reference?
(
from
)
path_with_namespace
elsif
cross_project_reference?
(
from
)
path
end
end
def
cross_namespace_reference?
(
from
)
...
...
@@ -1300,8 +1294,9 @@
def
cross_namespace_reference?
(
from
)
if
from
.
is_a?
(
Project
)
from
&&
namespace
!=
from
.
namespace
else
from
&&
namespace
!=
from
case
from
when
Project
namespace
!=
from
.
namespace
when
Namespace
namespace
!=
from
end
end
...
...
app/views/projects/issues/_issue.html.haml
View file @
d1867c1c
...
...
@@ -34,9 +34,5 @@
=
note_count
.issue-info
-
if
controller_name
==
"dashboard"
#{
issue
.
to_reference
(
full_path:
true
)
}
-
else
#{
issue
.
to_reference
(
@group
||
@project
)
}
=
@show_full_reference
?
issue
.
to_reference
(
full:
true
)
:
issue
.
to_reference
(
@group
||
@project
)
·
...
...
@@ -42,5 +38,4 @@
·
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 @
d1867c1c
...
...
@@ -46,7 +46,8 @@
=
note_count
.merge-request-info
#{
merge_request
.
to_reference
}
·
=
@show_full_reference
?
merge_request
.
to_reference
(
full:
true
)
:
merge_request
.
to_reference
(
@group
||
@project
)
·
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
...
...
app/views/shared/_merge_requests.html.haml
View file @
d1867c1c
-
if
@merge_requests
.
to_a
.
any?
-
@merge_requests
.
group_by
(
&
:target_project
).
each
do
|
group
|
.panel.panel-default.panel-small
-
project
=
group
[
0
]
.panel-heading
=
link_to
project
.
name_with_namespace
,
namespace_project_merge_requests_path
(
project
.
namespace
,
project
)
-
if
can?
(
current_user
,
:create_merge_request
,
project
)
.pull-right
=
link_to
'New merge request'
,
new_namespace_project_merge_request_path
(
project
.
namespace
,
project
)
.panel.panel-default.panel-small
%ul
.content-list.mr-list
=
render
partial:
'projects/merge_requests/merge_request'
,
collection:
@merge_requests
...
...
@@ -10,7 +5,4 @@
%ul
.content-list.mr-list
-
group
[
1
].
each
do
|
merge_request
|
=
render
'projects/merge_requests/merge_request'
,
merge_request:
merge_request
=
paginate
@merge_requests
,
theme:
"gitlab"
-
else
...
...
spec/models/issue_spec.rb
View file @
d1867c1c
...
...
@@ -34,5 +34,5 @@
end
end
context
'when full
_path
is true'
do
context
'when full is true'
do
it
'returns complete path to the issue'
do
...
...
@@ -38,7 +38,7 @@
it
'returns complete path to the issue'
do
expect
(
issue
.
to_reference
(
full
_path
:
true
)).
to
eq
'sample-namespace/sample-project#1'
expect
(
issue
.
to_reference
(
project
,
full
_path
:
true
)).
to
eq
'sample-namespace/sample-project#1'
expect
(
issue
.
to_reference
(
group
,
full
_path
:
true
)).
to
eq
'sample-namespace/sample-project#1'
expect
(
issue
.
to_reference
(
full:
true
)).
to
eq
'sample-namespace/sample-project#1'
expect
(
issue
.
to_reference
(
project
,
full:
true
)).
to
eq
'sample-namespace/sample-project#1'
expect
(
issue
.
to_reference
(
group
,
full:
true
)).
to
eq
'sample-namespace/sample-project#1'
end
end
...
...
spec/models/project_spec.rb
View file @
d1867c1c
...
...
@@ -293,5 +293,5 @@
end
end
context
'when full
_path
is true'
do
context
'when full is true'
do
it
'returns complete path to the project'
do
...
...
@@ -297,7 +297,7 @@
it
'returns complete path to the project'
do
expect
(
project
.
to_reference
(
full
_path
:
true
)).
to
eq
'sample-namespace/sample-project'
expect
(
project
.
to_reference
(
project
,
full
_path
:
true
)).
to
eq
'sample-namespace/sample-project'
expect
(
project
.
to_reference
(
group
,
full
_path
:
true
)).
to
eq
'sample-namespace/sample-project'
expect
(
project
.
to_reference
(
full:
true
)).
to
eq
'sample-namespace/sample-project'
expect
(
project
.
to_reference
(
project
,
full:
true
)).
to
eq
'sample-namespace/sample-project'
expect
(
project
.
to_reference
(
group
,
full:
true
)).
to
eq
'sample-namespace/sample-project'
end
end
...
...
Write
Preview
Supports
Markdown
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