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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
e9fad8cf
Commit
e9fad8cf
authored
Feb 03, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'tune_commit_page' into 'master'
Tune commit page: async load of branch info See merge request !1462
parents
7bf20368
19f39b42
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
21 deletions
+43
-21
CHANGELOG
CHANGELOG
+1
-1
app/controllers/projects/commit_controller.rb
app/controllers/projects/commit_controller.rb
+6
-2
app/views/projects/commit/_commit_box.html.haml
app/views/projects/commit/_commit_box.html.haml
+6
-17
app/views/projects/commit/branches.html.haml
app/views/projects/commit/branches.html.haml
+16
-0
config/routes.rb
config/routes.rb
+5
-1
spec/controllers/commit_controller_spec.rb
spec/controllers/commit_controller_spec.rb
+9
-0
No files found.
CHANGELOG
View file @
e9fad8cf
...
@@ -28,7 +28,7 @@ v 7.8.0
...
@@ -28,7 +28,7 @@ v 7.8.0
- Added Rubocop for code style checks
- Added Rubocop for code style checks
- Fix commits pagination
- Fix commits pagination
-
-
-
-
Async load a branch information at the commit page
-
-
-
-
- Add a commit calendar to the user profile (Hannes Rosenögger)
- Add a commit calendar to the user profile (Hannes Rosenögger)
...
...
app/controllers/projects/commit_controller.rb
View file @
e9fad8cf
...
@@ -11,8 +11,6 @@ class Projects::CommitController < Projects::ApplicationController
...
@@ -11,8 +11,6 @@ class Projects::CommitController < Projects::ApplicationController
return
git_not_found!
unless
@commit
return
git_not_found!
unless
@commit
@line_notes
=
@project
.
notes
.
for_commit_id
(
commit
.
id
).
inline
@line_notes
=
@project
.
notes
.
for_commit_id
(
commit
.
id
).
inline
@branches
=
@project
.
repository
.
branch_names_contains
(
commit
.
id
)
@tags
=
@project
.
repository
.
tag_names_contains
(
commit
.
id
)
@diffs
=
@commit
.
diffs
@diffs
=
@commit
.
diffs
@note
=
@project
.
build_commit_note
(
commit
)
@note
=
@project
.
build_commit_note
(
commit
)
@notes_count
=
@project
.
notes
.
for_commit_id
(
commit
.
id
).
count
@notes_count
=
@project
.
notes
.
for_commit_id
(
commit
.
id
).
count
...
@@ -31,6 +29,12 @@ class Projects::CommitController < Projects::ApplicationController
...
@@ -31,6 +29,12 @@ class Projects::CommitController < Projects::ApplicationController
end
end
end
end
def
branches
@branches
=
@project
.
repository
.
branch_names_contains
(
commit
.
id
)
@tags
=
@project
.
repository
.
tag_names_contains
(
commit
.
id
)
render
layout:
false
end
def
commit
def
commit
@commit
||=
@project
.
repository
.
commit
(
params
[
:id
])
@commit
||=
@project
.
repository
.
commit
(
params
[
:id
])
end
end
...
...
app/views/projects/commit/_commit_box.html.haml
View file @
e9fad8cf
...
@@ -37,23 +37,8 @@
...
@@ -37,23 +37,8 @@
-
@commit
.
parents
.
each
do
|
parent
|
-
@commit
.
parents
.
each
do
|
parent
|
=
link_to
parent
.
short_id
,
project_commit_path
(
@project
,
parent
)
=
link_to
parent
.
short_id
,
project_commit_path
(
@project
,
parent
)
.commit-info-row
.commit-info-row.branches
-
if
@branches
.
any?
%i
.fa.fa-spinner.fa-spin
%span
-
branch
=
commit_default_branch
(
@project
,
@branches
)
=
link_to
(
project_tree_path
(
@project
,
branch
))
do
%span
.label.label-gray
%i
.fa.fa-code-fork
=
branch
-
if
@branches
.
any?
||
@tags
.
any?
=
link_to
(
"#"
,
class:
"js-details-expand"
)
do
%span
.label.label-gray
\...
%span
.js-details-content.hide
-
if
@branches
.
any?
=
commit_branches_links
(
@project
,
@branches
)
-
if
@tags
.
any?
=
commit_tags_links
(
@project
,
@tags
)
.commit-box
.commit-box
%h3
.commit-title
%h3
.commit-title
...
@@ -61,3 +46,7 @@
...
@@ -61,3 +46,7 @@
-
if
@commit
.
description
.
present?
-
if
@commit
.
description
.
present?
%pre
.commit-description
%pre
.commit-description
=
preserve
(
gfm
(
escape_once
(
@commit
.
description
)))
=
preserve
(
gfm
(
escape_once
(
@commit
.
description
)))
:coffeescript
$ ->
$(".commit-info-row.branches").load("
#{
branches_project_commit_path
(
@project
,
@commit
.
id
)
}
")
\ No newline at end of file
app/views/projects/commit/branches.html.haml
0 → 100644
View file @
e9fad8cf
-
if
@branches
.
any?
%span
-
branch
=
commit_default_branch
(
@project
,
@branches
)
=
link_to
(
project_tree_path
(
@project
,
branch
))
do
%span
.label.label-gray
%i
.fa.fa-code-fork
=
branch
-
if
@branches
.
any?
||
@tags
.
any?
=
link_to
(
"#"
,
class:
"js-details-expand"
)
do
%span
.label.label-gray
\...
%span
.js-details-content.hide
-
if
@branches
.
any?
=
commit_branches_links
(
@project
,
@branches
)
-
if
@tags
.
any?
=
commit_tags_links
(
@project
,
@tags
)
\ No newline at end of file
config/routes.rb
View file @
e9fad8cf
...
@@ -228,7 +228,11 @@ Gitlab::Application.routes.draw do
...
@@ -228,7 +228,11 @@ Gitlab::Application.routes.draw do
resources
:raw
,
only:
[
:show
],
constraints:
{
id:
/.+/
}
resources
:raw
,
only:
[
:show
],
constraints:
{
id:
/.+/
}
resources
:tree
,
only:
[
:show
],
constraints:
{
id:
/.+/
,
format:
/(html|js)/
}
resources
:tree
,
only:
[
:show
],
constraints:
{
id:
/.+/
,
format:
/(html|js)/
}
resource
:avatar
,
only:
[
:show
,
:destroy
]
resource
:avatar
,
only:
[
:show
,
:destroy
]
resources
:commit
,
only:
[
:show
],
constraints:
{
id:
/[[:alnum:]]{6,40}/
}
resources
:commit
,
only:
[
:show
],
constraints:
{
id:
/[[:alnum:]]{6,40}/
}
do
get
:branches
,
on: :member
end
resources
:commits
,
only:
[
:show
],
constraints:
{
id:
/(?:[^.]|\.(?!atom$))+/
,
format:
/atom/
}
resources
:commits
,
only:
[
:show
],
constraints:
{
id:
/(?:[^.]|\.(?!atom$))+/
,
format:
/atom/
}
resources
:compare
,
only:
[
:index
,
:create
]
resources
:compare
,
only:
[
:index
,
:create
]
resources
:blame
,
only:
[
:show
],
constraints:
{
id:
/.+/
}
resources
:blame
,
only:
[
:show
],
constraints:
{
id:
/.+/
}
...
...
spec/controllers/commit_controller_spec.rb
View file @
e9fad8cf
...
@@ -70,4 +70,13 @@ describe Projects::CommitController do
...
@@ -70,4 +70,13 @@ describe Projects::CommitController do
end
end
end
end
end
end
describe
"#branches"
do
it
"contains branch and tags information"
do
get
:branches
,
project_id:
project
.
to_param
,
id:
commit
.
id
expect
(
assigns
(
:branches
)).
to
include
(
"master"
,
"feature_conflict"
)
expect
(
assigns
(
:tags
)).
to
include
(
"v1.1.0"
)
end
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