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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
e8d6c3c1
Commit
e8d6c3c1
authored
Oct 15, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1706 from riyad/refactor-tree-views-and-improve-consistency
Refactor tree views and improve consistency
parents
5509093f
866b9f6d
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
79 additions
and
82 deletions
+79
-82
app/assets/stylesheets/sections/tree.scss
app/assets/stylesheets/sections/tree.scss
+4
-0
app/decorators/tree_decorator.rb
app/decorators/tree_decorator.rb
+0
-13
app/views/blame/show.html.haml
app/views/blame/show.html.haml
+4
-7
app/views/tree/_blob.html.haml
app/views/tree/_blob.html.haml
+13
-0
app/views/tree/_blob_actions.html.haml
app/views/tree/_blob_actions.html.haml
+12
-0
app/views/tree/_readme.html.haml
app/views/tree/_readme.html.haml
+10
-0
app/views/tree/_submodule_item.html.haml
app/views/tree/_submodule_item.html.haml
+1
-1
app/views/tree/_tree.html.haml
app/views/tree/_tree.html.haml
+6
-15
app/views/tree/_tree_file.html.haml
app/views/tree/_tree_file.html.haml
+0
-42
app/views/tree/_tree_item.html.haml
app/views/tree/_tree_item.html.haml
+1
-1
app/views/tree/blob/_download.html.haml
app/views/tree/blob/_download.html.haml
+8
-0
app/views/tree/blob/_image.html.haml
app/views/tree/blob/_image.html.haml
+2
-0
app/views/tree/blob/_text.html.haml
app/views/tree/blob/_text.html.haml
+15
-0
features/steps/project/project_browse_files.rb
features/steps/project/project_browse_files.rb
+2
-2
lib/gitlab/file_editor.rb
lib/gitlab/file_editor.rb
+1
-1
No files found.
app/assets/stylesheets/sections/tree.scss
View file @
e8d6c3c1
...
...
@@ -43,6 +43,10 @@
}
.tree-table
{
th
.btn
{
margin
:
-2px
-1px
;
padding
:
2px
10px
;
}
td
{
background
:
#fafafa
;
}
...
...
app/decorators/tree_decorator.rb
View file @
e8d6c3c1
...
...
@@ -28,17 +28,4 @@ class TreeDecorator < ApplicationDecorator
file
=
File
.
join
(
path
,
".."
)
h
.
project_tree_path
(
project
,
h
.
tree_join
(
ref
,
file
))
end
def
history_path
h
.
project_commits_path
(
project
,
h
.
tree_join
(
ref
,
path
))
end
def
mb_size
size
=
(
tree
.
size
/
1024
)
if
size
<
1024
"
#{
size
}
KB"
else
"
#{
size
/
1024
}
MB"
end
end
end
app/views/blame/show.html.haml
View file @
e8d6c3c1
=
render
"head"
#tree-holder
#tree-holder
.tree-holder
%ul
.breadcrumb
%li
%span
.arrow
...
...
@@ -15,12 +15,9 @@
.file_title
%i
.icon-file
%span
.file_name
=
@tree
.
name
%small
blame
%span
.options
=
link_to
"raw"
,
project_blob_path
(
@project
,
@id
),
class:
"btn very_small"
,
target:
"_blank"
=
link_to
"history"
,
project_commits_path
(
@project
,
@id
),
class:
"btn very_small"
=
link_to
"source"
,
project_tree_path
(
@project
,
@id
),
class:
"btn very_small"
=
@tree
.
name
.
force_encoding
(
'utf-8'
)
%small
=
number_to_human_size
@tree
.
size
%span
.options
=
render
"tree/blob_actions"
.file_content.blame
%table
-
@blame
.
each
do
|
commit
,
lines
|
...
...
app/views/tree/_blob.html.haml
0 → 100644
View file @
e8d6c3c1
.file_holder
.file_title
%i
.icon-file
%span
.file_name
=
blob
.
name
.
force_encoding
(
'utf-8'
)
%small
=
number_to_human_size
blob
.
size
%span
.options
=
render
"tree/blob_actions"
-
if
blob
.
text?
=
render
"tree/blob/text"
,
blob:
blob
-
elsif
blob
.
image?
=
render
"tree/blob/image"
,
blob:
blob
-
else
=
render
"tree/blob/download"
,
blob:
blob
app/views/tree/_blob_actions.html.haml
0 → 100644
View file @
e8d6c3c1
.btn-group.tree-btn-group
-# only show edit link for text files
-
if
@tree
.
text?
=
link_to
"edit"
,
edit_project_tree_path
(
@project
,
@id
),
class:
"btn very_small"
=
link_to
"raw"
,
project_blob_path
(
@project
,
@id
),
class:
"btn very_small"
,
target:
"_blank"
-# only show normal/blame view links for text files
-
if
@tree
.
text?
-
if
current_page?
project_blame_path
(
@project
,
@id
)
=
link_to
"normal view"
,
project_tree_path
(
@project
,
@id
),
class:
"btn very_small"
-
else
=
link_to
"blame"
,
project_blame_path
(
@project
,
@id
),
class:
"btn very_small"
=
link_to
"history"
,
project_commits_path
(
@project
,
@id
),
class:
"btn very_small"
app/views/tree/_readme.html.haml
0 → 100644
View file @
e8d6c3c1
.file_holder
#README
.file_title
%i
.icon-file
=
readme
.
name
.file_content.wiki
-
if
gitlab_markdown?
(
readme
.
name
)
=
preserve
do
=
markdown
(
readme
.
data
)
-
else
=
raw
GitHub
::
Markup
.
render
(
readme
.
name
,
readme
.
data
)
\ No newline at end of file
app/views/tree/_submodule_item.html.haml
View file @
e8d6c3c1
...
...
@@ -7,5 +7,5 @@
%strong
=
truncate
(
name
,
length:
40
)
%td
%code
=
submodule_item
.
id
[
0
..
10
]
%td
%td
{
colspan:
2
}
=
link_to
truncate
(
url
,
length:
40
),
url
app/views/tree/_tree.html.haml
View file @
e8d6c3c1
...
...
@@ -12,15 +12,14 @@
%div
#tree-content-holder
.tree-content-holder
-
if
tree
.
is_blob?
=
render
partial:
"tree/tree_file"
,
object
:
tree
=
render
"tree/blob"
,
blob
:
tree
-
else
%table
#tree-slider
{
class:
"table_#{@hex_path} tree-table"
}
%thead
%th
Name
%th
Last Update
%th
Last commit
=
link_to
"History"
,
tree
.
history_path
,
class:
"right"
%th
Last Commit
%th
=
link_to
"history"
,
project_commits_path
(
@project
,
@id
),
class:
"btn very_small right"
-
if
tree
.
up_dir?
%tr
.tree-item
...
...
@@ -29,20 +28,12 @@
=
link_to
".."
,
tree
.
up_dir_path
%td
%td
%td
=
render_tree
(
tree
.
contents
)
-
if
content
=
tree
.
contents
.
find
{
|
c
|
c
.
is_a?
(
Grit
::
Blob
)
and
c
.
name
=~
/^readme/i
}
.file_holder
#README
.file_title
%i
.icon-file
=
content
.
name
.file_content.wiki
-
if
gitlab_markdown?
(
content
.
name
)
=
preserve
do
=
markdown
(
content
.
data
)
-
else
=
raw
GitHub
::
Markup
.
render
(
content
.
name
,
content
.
data
)
-
if
readme
=
tree
.
contents
.
find
{
|
c
|
c
.
is_a?
(
Grit
::
Blob
)
and
c
.
name
=~
/^readme/i
}
=
render
"tree/readme"
,
readme:
readme
-
unless
tree
.
is_blob?
:javascript
...
...
app/views/tree/_tree_file.html.haml
deleted
100644 → 0
View file @
5509093f
.file_holder
.file_title
%i
.icon-file
%span
.file_name
=
tree_file
.
name
.
force_encoding
(
'utf-8'
)
%small
#{
tree_file
.
mode
}
%span
.options
.btn-group.tree-btn-group
=
link_to
"raw"
,
project_blob_path
(
@project
,
@id
),
class:
"btn very_small"
,
target:
"_blank"
=
link_to
"history"
,
project_commits_path
(
@project
,
@id
),
class:
"btn very_small"
=
link_to
"blame"
,
project_blame_path
(
@project
,
@id
),
class:
"btn very_small"
=
link_to
"edit"
,
edit_project_tree_path
(
@project
,
@id
),
class:
"btn very_small"
-
if
tree_file
.
text?
-
if
gitlab_markdown?
(
tree_file
.
name
)
.file_content.wiki
=
preserve
do
=
markdown
(
tree_file
.
data
)
-
elsif
markup?
(
tree_file
.
name
)
.file_content.wiki
=
raw
GitHub
::
Markup
.
render
(
tree_file
.
name
,
tree_file
.
data
)
-
else
.file_content.code
-
unless
tree_file
.
empty?
%div
{
class:
current_user
.
dark_scheme
?
"black"
:
"white"
}
=
preserve
do
=
raw
tree_file
.
colorize
(
options:
{
linenos:
'True'
})
-
else
%h4
.nothing_here_message
Empty file
-
elsif
tree_file
.
image?
.file_content.image_file
%img
{
src:
"data:#{tree_file.mime_type};base64,#{Base64.encode64(tree_file.data)}"
}
-
else
.file_content.blob_file
%center
=
link_to
project_blob_path
(
@project
,
@id
)
do
%div
.padded
%br
=
image_tag
"download.png"
,
width:
64
%h3
Download (
#{
tree_file
.
mb_size
}
)
app/views/tree/_tree_item.html.haml
View file @
e8d6c3c1
...
...
@@ -6,4 +6,4 @@
%span
.log_loading.hide
Loading commit data...
=
image_tag
"ajax_loader_tree.gif"
,
width:
14
%td
.tree_commit
%td
.tree_commit
{
colspan:
2
}
app/views/tree/blob/_download.html.haml
0 → 100644
View file @
e8d6c3c1
.file_content.blob_file
%center
=
link_to
project_blob_path
(
@project
,
@id
)
do
%div
.padded
%br
=
image_tag
"download.png"
,
width:
64
%h3
Download (
#{
number_to_human_size
blob
.
size
}
)
app/views/tree/blob/_image.html.haml
0 → 100644
View file @
e8d6c3c1
.file_content.image_file
%img
{
src:
"data:#{blob.mime_type};base64,#{Base64.encode64(blob.data)}"
}
app/views/tree/blob/_text.html.haml
0 → 100644
View file @
e8d6c3c1
-
if
gitlab_markdown?
(
blob
.
name
)
.file_content.wiki
=
preserve
do
=
markdown
(
blob
.
data
)
-
elsif
markup?
(
blob
.
name
)
.file_content.wiki
=
raw
GitHub
::
Markup
.
render
(
blob
.
name
,
blob
.
data
)
-
else
.file_content.code
-
unless
blob
.
empty?
%div
{
class:
current_user
.
dark_scheme
?
"black"
:
"white"
}
=
preserve
do
=
raw
blob
.
colorize
(
options:
{
linenos:
'True'
})
-
else
%h4
.nothing_here_message
Empty file
features/steps/project/project_browse_files.rb
View file @
e8d6c3c1
...
...
@@ -5,14 +5,14 @@ class ProjectBrowseFiles < Spinach::FeatureSteps
Then
'I should see files from repository'
do
page
.
should
have_content
"app"
page
.
should
have_content
"
H
istory"
page
.
should
have_content
"
h
istory"
page
.
should
have_content
"Gemfile"
end
Then
'I should see files from repository for "8470d70"'
do
current_path
.
should
==
project_tree_path
(
@project
,
"8470d70"
)
page
.
should
have_content
"app"
page
.
should
have_content
"
H
istory"
page
.
should
have_content
"
h
istory"
page
.
should
have_content
"Gemfile"
end
...
...
lib/gitlab/file_editor.rb
View file @
e8d6c3c1
...
...
@@ -51,7 +51,7 @@ module Gitlab
protected
def
can_edit?
(
path
,
last_commit
)
current_last_commit
=
@project
.
commits
(
ref
,
path
,
1
).
first
.
sha
current_last_commit
=
@project
.
last_commit_for
(
ref
,
path
)
.
sha
last_commit
==
current_last_commit
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