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
fcb0b76c
Commit
fcb0b76c
authored
Jun 12, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Load last commit for files per 10 items.
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
9fd6c3d5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
3 deletions
+27
-3
app/controllers/projects/refs_controller.rb
app/controllers/projects/refs_controller.rb
+17
-3
app/views/projects/refs/logs_tree.js.haml
app/views/projects/refs/logs_tree.js.haml
+10
-0
No files found.
app/controllers/projects/refs_controller.rb
View file @
fcb0b76c
...
@@ -31,9 +31,23 @@ class Projects::RefsController < Projects::ApplicationController
...
@@ -31,9 +31,23 @@ class Projects::RefsController < Projects::ApplicationController
end
end
def
logs_tree
def
logs_tree
contents
=
tree
.
entries
@offset
=
if
params
[
:offset
].
present?
@logs
=
contents
.
map
do
|
content
|
params
[
:offset
].
to_i
file
=
params
[
:path
]
?
File
.
join
(
params
[
:path
],
content
.
name
)
:
content
.
name
else
0
end
@limit
=
10
@path
=
params
[
:path
]
contents
=
[]
contents
+=
tree
.
trees
contents
+=
tree
.
blobs
contents
+=
tree
.
submodules
@logs
=
contents
[
@offset
,
@limit
].
to_a
.
map
do
|
content
|
file
=
@path
?
File
.
join
(
@path
,
content
.
name
)
:
content
.
name
last_commit
=
@repo
.
last_commit_for_path
(
@commit
.
id
,
file
)
last_commit
=
@repo
.
last_commit_for_path
(
@commit
.
id
,
file
)
{
{
file_name:
content
.
name
,
file_name:
content
.
name
,
...
...
app/views/projects/refs/logs_tree.js.haml
View file @
fcb0b76c
...
@@ -7,3 +7,13 @@
...
@@ -7,3 +7,13 @@
var row = $("table.table_
#{
@hex_path
}
tr.file_
#{
hexdigest
(
file_name
)
}
");
var row = $("table.table_
#{
@hex_path
}
tr.file_
#{
hexdigest
(
file_name
)
}
");
row.find("td.tree_time_ago").html('
#{
escape_javascript
time_ago_with_tooltip
(
commit
.
committed_date
)
}
');
row.find("td.tree_time_ago").html('
#{
escape_javascript
time_ago_with_tooltip
(
commit
.
committed_date
)
}
');
row.find("td.tree_commit").html('
#{
escape_javascript
render
(
"projects/tree/tree_commit_column"
,
commit:
commit
)
}
');
row.find("td.tree_commit").html('
#{
escape_javascript
render
(
"projects/tree/tree_commit_column"
,
commit:
commit
)
}
');
-
if
@logs
.
present?
:plain
var current_url = location.href.replace(/\/?$/, '/');
var log_url = '
#{
project_tree_url
(
@project
,
tree_join
(
@ref
,
@path
||
'/'
))
}
'.replace(/\/?$/, '/');
if(current_url == log_url) {
// Load 10 more commit log for each file in tree
// if we still on the same page
ajaxGet('
#{
logs_file_project_ref_path
(
@project
,
@ref
,
@path
||
'/'
,
offset:
(
@offset
+
@limit
))
}
');
}
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