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
iv
gitlab-ce
Commits
b9d9ac82
Commit
b9d9ac82
authored
Feb 02, 2015
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit page: async load branches info
Conflicts: config/routes.rb
parent
7bf20368
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
21 deletions
+43
-21
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
+6
-2
spec/controllers/commit_controller_spec.rb
spec/controllers/commit_controller_spec.rb
+9
-0
No files found.
app/controllers/projects/commit_controller.rb
View file @
b9d9ac82
...
...
@@ -11,8 +11,6 @@ class Projects::CommitController < Projects::ApplicationController
return
git_not_found!
unless
@commit
@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
@note
=
@project
.
build_commit_note
(
commit
)
@notes_count
=
@project
.
notes
.
for_commit_id
(
commit
.
id
).
count
...
...
@@ -31,6 +29,12 @@ class Projects::CommitController < Projects::ApplicationController
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
@commit
||=
@project
.
repository
.
commit
(
params
[
:id
])
end
...
...
app/views/projects/commit/_commit_box.html.haml
View file @
b9d9ac82
...
...
@@ -37,23 +37,8 @@
-
@commit
.
parents
.
each
do
|
parent
|
=
link_to
parent
.
short_id
,
project_commit_path
(
@project
,
parent
)
.commit-info-row
-
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
)
.commit-info-row.branches
%i
.fa.fa-spinner.fa-spin
.commit-box
%h3
.commit-title
...
...
@@ -61,3 +46,7 @@
-
if
@commit
.
description
.
present?
%pre
.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 @
b9d9ac82
-
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 @
b9d9ac82
...
...
@@ -228,8 +228,12 @@ Gitlab::Application.routes.draw do
resources
:raw
,
only:
[
:show
],
constraints:
{
id:
/.+/
}
resources
:tree
,
only:
[
:show
],
constraints:
{
id:
/.+/
,
format:
/(html|js)/
}
resource
:avatar
,
only:
[
:show
,
:destroy
]
resources
:commit
,
only:
[
:show
],
constraints:
{
id:
/[[:alnum:]]{6,40}/
}
resources
:commits
,
only:
[
:show
],
constraints:
{
id:
/(?:[^.]|\.(?!atom$))+/
,
format:
/atom/
}
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
:compare
,
only:
[
:index
,
:create
]
resources
:blame
,
only:
[
:show
],
constraints:
{
id:
/.+/
}
resources
:network
,
only:
[
:show
],
constraints:
{
id:
/(?:[^.]|\.(?!json$))+/
,
format:
/json/
}
...
...
spec/controllers/commit_controller_spec.rb
View file @
b9d9ac82
...
...
@@ -70,4 +70,13 @@ describe Projects::CommitController do
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
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