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
Boxiang Sun
gitlab-ce
Commits
c52fead0
Commit
c52fead0
authored
Mar 14, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix spec
parent
95b3b685
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
97 additions
and
76 deletions
+97
-76
app/controllers/projects/blame_controller.rb
app/controllers/projects/blame_controller.rb
+4
-1
app/helpers/blob_helper.rb
app/helpers/blob_helper.rb
+14
-0
app/views/projects/blame/show.html.haml
app/views/projects/blame/show.html.haml
+2
-7
app/views/projects/blob/_actions.html.haml
app/views/projects/blob/_actions.html.haml
+0
-28
app/views/projects/blob/_blob.html.haml
app/views/projects/blob/_blob.html.haml
+1
-9
app/views/projects/blob/_header.html.haml
app/views/projects/blob/_header.html.haml
+39
-0
app/views/projects/blob/_text.html.haml
app/views/projects/blob/_text.html.haml
+6
-6
app/views/projects/diffs/_file_header.html.haml
app/views/projects/diffs/_file_header.html.haml
+5
-2
app/views/projects/snippets/show.html.haml
app/views/projects/snippets/show.html.haml
+1
-7
app/views/shared/snippets/_blob.html.haml
app/views/shared/snippets/_blob.html.haml
+21
-6
app/views/snippets/show.html.haml
app/views/snippets/show.html.haml
+3
-9
features/steps/project/source/browse_files.rb
features/steps/project/source/browse_files.rb
+1
-1
No files found.
app/controllers/projects/blame_controller.rb
View file @
c52fead0
...
@@ -11,6 +11,9 @@ class Projects::BlameController < Projects::ApplicationController
...
@@ -11,6 +11,9 @@ class Projects::BlameController < Projects::ApplicationController
return
render_404
unless
@blob
return
render_404
unless
@blob
environment_params
=
@repository
.
branch_exists?
(
@ref
)
?
{
ref:
@ref
}
:
{
commit:
@commit
}
@environment
=
EnvironmentsFinder
.
new
(
@project
,
current_user
,
environment_params
).
execute
.
last
@blame_groups
=
Gitlab
::
Blame
.
new
(
@blob
,
@commit
).
groups
@blame_groups
=
Gitlab
::
Blame
.
new
(
@blob
,
@commit
).
groups
end
end
end
end
app/helpers/blob_helper.rb
View file @
c52fead0
...
@@ -203,4 +203,18 @@ module BlobHelper
...
@@ -203,4 +203,18 @@ module BlobHelper
'blob-language'
=>
@blob
&&
@blob
.
language
.
try
(
:ace_mode
)
'blob-language'
=>
@blob
&&
@blob
.
language
.
try
(
:ace_mode
)
}
}
end
end
def
copy_file_path_button
(
file_path
)
clipboard_button
(
clipboard_text:
file_path
,
class:
'btn-clipboard btn-transparent prepend-left-5'
,
title:
'Copy file path to clipboard'
)
end
def
copy_blob_content_button
(
blob
)
return
if
markup?
(
blob
.
name
)
clipboard_button
(
clipboard_target:
".blob-content[data-blob-id='
#{
blob
.
id
}
']"
,
class:
"btn btn-sm"
,
title:
"Copy content to clipboard"
)
end
def
open_raw_file_button
(
path
)
link_to
icon
(
'file-text-o'
),
path
,
class:
'btn btn-sm has-tooltip'
,
target:
'_blank'
,
title:
'Open raw'
,
data:
{
container:
'body'
}
end
end
end
app/views/projects/blame/show.html.haml
View file @
c52fead0
...
@@ -7,13 +7,8 @@
...
@@ -7,13 +7,8 @@
#blob-content-holder
.tree-holder
#blob-content-holder
.tree-holder
.file-holder
.file-holder
.js-file-title.file-title
=
render
"projects/blob/header"
,
blob:
@blob
=
blob_icon
@blob
.
mode
,
@blob
.
name
%strong
=
@path
%small
=
number_to_human_size
@blob
.
size
.file-actions
=
render
"projects/blob/actions"
.table-responsive.file-content.blame.code.js-syntax-highlight
.table-responsive.file-content.blame.code.js-syntax-highlight
%table
%table
-
current_line
=
1
-
current_line
=
1
...
...
app/views/projects/blob/_actions.html.haml
deleted
100644 → 0
View file @
95b3b685
.btn-group
{
role:
"group"
}
<
=
clipboard_button
(
clipboard_target:
".blob-content[data-blob-id='
#{
@blob
.
id
}
']"
,
class:
"btn btn-sm"
)
=
link_to
icon
(
'download'
),
namespace_project_raw_path
(
@project
.
namespace
,
@project
,
@id
),
class:
'btn btn-sm has-tooltip'
,
target:
'_blank'
,
title:
'Download raw'
,
data:
{
container:
'body'
}
-
if
@environment
=
view_on_environment_button
(
@commit
.
sha
,
@path
,
@environment
)
.btn-group
{
role:
"group"
}
<
-# only show normal/blame view links for text files
-
if
blob_text_viewable?
(
@blob
)
-
if
current_page?
namespace_project_blame_path
(
@project
.
namespace
,
@project
,
@id
)
=
link_to
'Normal View'
,
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
@id
),
class:
'btn btn-sm'
-
else
=
link_to
'Blame'
,
namespace_project_blame_path
(
@project
.
namespace
,
@project
,
@id
),
class:
'btn btn-sm js-blob-blame-link'
unless
@blob
.
empty?
=
link_to
'History'
,
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@id
),
class:
'btn btn-sm'
=
link_to
'Permalink'
,
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
tree_join
(
@commit
.
sha
,
@path
)),
class:
'btn btn-sm js-data-file-blob-permalink-url'
-
if
current_user
.btn-group
{
role:
"group"
}
<
-
if
blob_text_viewable?
(
@blob
)
=
edit_blob_link
=
replace_blob_link
=
delete_blob_link
app/views/projects/blob/_blob.html.haml
View file @
c52fead0
...
@@ -24,13 +24,5 @@
...
@@ -24,13 +24,5 @@
#blob-content-holder
.blob-content-holder
#blob-content-holder
.blob-content-holder
%article
.file-holder
%article
.file-holder
.js-file-title.file-title-flex-parent
=
render
"projects/blob/header"
,
blob:
blob
.file-header-content
=
blob_icon
blob
.
mode
,
blob
.
name
%strong
.file-title-name
=
blob
.
name
%small
=
number_to_human_size
(
blob_size
(
blob
))
.file-actions.hidden-xs
=
render
"actions"
=
render
blob
.
to_partial_path
(
@project
),
blob:
blob
=
render
blob
.
to_partial_path
(
@project
),
blob:
blob
app/views/projects/blob/_header.html.haml
0 → 100644
View file @
c52fead0
.js-file-title.file-title-flex-parent
.file-header-content
=
blob_icon
blob
.
mode
,
blob
.
name
%strong
.file-title-name
=
blob
.
name
=
copy_file_path_button
(
blob
.
path
)
%small
=
number_to_human_size
(
blob_size
(
blob
))
.file-actions.hidden-xs
.btn-group
{
role:
"group"
}
<
=
copy_blob_content_button
(
blob
)
if
blob_text_viewable?
(
blob
)
=
open_raw_file_button
(
namespace_project_raw_path
(
@project
.
namespace
,
@project
,
@id
))
=
view_on_environment_button
(
@commit
.
sha
,
@path
,
@environment
)
if
@environment
.btn-group
{
role:
"group"
}
<
-# only show normal/blame view links for text files
-
if
blob_text_viewable?
(
blob
)
-
if
current_page?
namespace_project_blame_path
(
@project
.
namespace
,
@project
,
@id
)
=
link_to
'Normal View'
,
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
@id
),
class:
'btn btn-sm'
-
else
=
link_to
'Blame'
,
namespace_project_blame_path
(
@project
.
namespace
,
@project
,
@id
),
class:
'btn btn-sm js-blob-blame-link'
unless
blob
.
empty?
=
link_to
'History'
,
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@id
),
class:
'btn btn-sm'
=
link_to
'Permalink'
,
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
tree_join
(
@commit
.
sha
,
@path
)),
class:
'btn btn-sm js-data-file-blob-permalink-url'
-
if
current_user
.btn-group
{
role:
"group"
}
<
=
edit_blob_link
if
blob_text_viewable?
(
blob
)
=
replace_blob_link
=
delete_blob_link
app/views/projects/blob/_text.html.haml
View file @
c52fead0
...
@@ -8,12 +8,12 @@
...
@@ -8,12 +8,12 @@
-
else
-
else
-
blob
.
load_all_data!
(
@repository
)
-
blob
.
load_all_data!
(
@repository
)
-
if
markup?
(
blob
.
name
)
.file-content.wiki
=
render_markup
(
blob
.
name
,
blob
.
data
)
-
else
-
if
blob
.
empty?
-
if
blob
.
empty?
.file-content.code
.file-content.code
.nothing-here-block
Empty file
.nothing-here-block
Empty file
-
else
-
if
markup?
(
blob
.
name
)
.file-content.wiki
=
render_markup
(
blob
.
name
,
blob
.
data
)
-
else
-
else
=
render
'shared/file_highlight'
,
blob:
blob
,
repository:
@repository
=
render
'shared/file_highlight'
,
blob:
blob
,
repository:
@repository
app/views/projects/diffs/_file_header.html.haml
View file @
c52fead0
...
@@ -2,8 +2,11 @@
...
@@ -2,8 +2,11 @@
-
if
defined?
(
blob
)
&&
blob
&&
diff_file
.
submodule?
-
if
defined?
(
blob
)
&&
blob
&&
diff_file
.
submodule?
%span
%span
=
icon
(
'archive fw'
)
=
icon
(
'archive fw'
)
%span
%strong
.file-title-name
=
submodule_link
(
blob
,
diff_commit
.
id
,
project
.
repository
)
=
submodule_link
(
blob
,
diff_commit
.
id
,
project
.
repository
)
=
copy_file_path_button
(
blob
.
path
)
-
else
-
else
=
conditional_link_to
url
.
present?
,
url
do
=
conditional_link_to
url
.
present?
,
url
do
=
blob_icon
diff_file
.
b_mode
,
diff_file
.
file_path
=
blob_icon
diff_file
.
b_mode
,
diff_file
.
file_path
...
@@ -21,7 +24,7 @@
...
@@ -21,7 +24,7 @@
-
if
diff_file
.
deleted_file
-
if
diff_file
.
deleted_file
deleted
deleted
=
c
lipboard_button
(
clipboard_text:
diff_file
.
new_path
,
class:
'btn-clipboard btn-transparent prepend-left-5'
,
title:
'Copy file path to clipboard'
)
=
c
opy_file_path_button
(
diff_file
.
new_path
)
-
if
diff_file
.
mode_changed?
-
if
diff_file
.
mode_changed?
%small
%small
...
...
app/views/projects/snippets/show.html.haml
View file @
c52fead0
...
@@ -4,13 +4,7 @@
...
@@ -4,13 +4,7 @@
.project-snippets
.project-snippets
%article
.file-holder.snippet-file-content
%article
.file-holder.snippet-file-content
.js-file-title.file-title
=
render
'shared/snippets/blob'
,
raw_path:
raw_namespace_project_snippet_path
(
@project
.
namespace
,
@project
,
@snippet
)
=
blob_icon
0
,
@snippet
.
file_name
=
@snippet
.
file_name
.file-actions
=
clipboard_button
(
clipboard_target:
".blob-content[data-blob-id='
#{
@snippet
.
id
}
']"
,
class:
"btn btn-sm"
)
=
link_to
'Raw'
,
raw_namespace_project_snippet_path
(
@project
.
namespace
,
@project
,
@snippet
),
class:
"btn btn-sm"
,
target:
"_blank"
=
render
'shared/snippets/blob'
.row-content-block.top-block.content-component-block
.row-content-block.top-block.content-component-block
=
render
'award_emoji/awards_block'
,
awardable:
@snippet
,
inline:
true
=
render
'award_emoji/awards_block'
,
awardable:
@snippet
,
inline:
true
...
...
app/views/shared/snippets/_blob.html.haml
View file @
c52fead0
-
unless
@snippet
.
content
.
empty?
.js-file-title.file-title-flex-parent
.file-header-content
=
blob_icon
@snippet
.
mode
,
@snippet
.
path
%strong
.file-title-name
=
@snippet
.
path
=
copy_file_path_button
(
@snippet
.
path
)
.file-actions.hidden-xs
.btn-group
{
role:
"group"
}
<
=
copy_blob_content_button
(
@snippet
)
=
open_raw_file_button
(
raw_path
)
-
if
defined?
(
download_path
)
&&
download_path
=
link_to
icon
(
'download'
),
download_path
,
class:
"btn btn-sm has-tooltip"
,
title:
'Download'
,
data:
{
container:
'body'
}
-
if
@snippet
.
content
.
empty?
.file-content.code
.nothing-here-block
Empty
file
-
else
-
if
markup?
(
@snippet
.
file_name
)
-
if
markup?
(
@snippet
.
file_name
)
%textarea
.markdown-snippet-copy.blob-content
{
data:
{
blob_id:
@snippet
.
id
}
}
=
@snippet
.
content
.file-content.wiki
.file-content.wiki
-
if
gitlab_markdown?
(
@snippet
.
file_name
)
-
if
gitlab_markdown?
(
@snippet
.
file_name
)
=
preserve
(
markdown_field
(
@snippet
,
:content
))
=
preserve
(
markdown_field
(
@snippet
,
:content
))
...
@@ -9,6 +27,3 @@
...
@@ -9,6 +27,3 @@
=
render_markup
(
@snippet
.
file_name
,
@snippet
.
content
)
=
render_markup
(
@snippet
.
file_name
,
@snippet
.
content
)
-
else
-
else
=
render
'shared/file_highlight'
,
blob:
@snippet
=
render
'shared/file_highlight'
,
blob:
@snippet
-
else
.file-content.code
.nothing-here-block
Empty file
app/views/snippets/show.html.haml
View file @
c52fead0
...
@@ -3,13 +3,7 @@
...
@@ -3,13 +3,7 @@
=
render
'shared/snippets/header'
=
render
'shared/snippets/header'
%article
.file-holder.snippet-file-content
%article
.file-holder.snippet-file-content
.js-file-title.file-title
=
render
'shared/snippets/blob'
,
raw_path:
raw_snippet_path
(
@snippet
),
download_path:
download_snippet_path
(
@snippet
)
=
blob_icon
0
,
@snippet
.
file_name
=
@snippet
.
file_name
.file-actions
=
clipboard_button
(
clipboard_target:
".blob-content[data-blob-id='
#{
@snippet
.
id
}
']"
,
class:
"btn btn-sm"
)
=
link_to
'Raw'
,
raw_snippet_path
(
@snippet
),
class:
"btn btn-sm"
,
target:
"_blank"
=
link_to
'Download'
,
download_snippet_path
(
@snippet
),
class:
"btn btn-sm"
=
render
'shared/snippets/blob'
=
render
'award_emoji/awards_block'
,
awardable:
@snippet
,
inline:
true
.row-content-block.top-block.content-component-block
=
render
'award_emoji/awards_block'
,
awardable:
@snippet
,
inline:
true
features/steps/project/source/browse_files.rb
View file @
c52fead0
...
@@ -356,7 +356,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
...
@@ -356,7 +356,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
step
'I should see buttons for allowed commands'
do
step
'I should see buttons for allowed commands'
do
page
.
within
'.content'
do
page
.
within
'.content'
do
expect
(
page
).
to
have_
content
'R
aw'
expect
(
page
).
to
have_
link
'Download r
aw'
expect
(
page
).
to
have_content
'History'
expect
(
page
).
to
have_content
'History'
expect
(
page
).
to
have_content
'Permalink'
expect
(
page
).
to
have_content
'Permalink'
expect
(
page
).
not_to
have_content
'Edit'
expect
(
page
).
not_to
have_content
'Edit'
...
...
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