summaryrefslogtreecommitdiff
path: root/app/views/projects/blob
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/projects/blob')
-rw-r--r--app/views/projects/blob/_actions.html.haml26
-rw-r--r--app/views/projects/blob/_blob.html.haml10
-rw-r--r--app/views/projects/blob/_header.html.haml39
-rw-r--r--app/views/projects/blob/_image.html.haml2
-rw-r--r--app/views/projects/blob/_text.html.haml14
-rw-r--r--app/views/projects/blob/edit.html.haml2
6 files changed, 49 insertions, 44 deletions
diff --git a/app/views/projects/blob/_actions.html.haml b/app/views/projects/blob/_actions.html.haml
deleted file mode 100644
index 14d42f7d9ec..00000000000
--- a/app/views/projects/blob/_actions.html.haml
+++ /dev/null
@@ -1,26 +0,0 @@
-- if @environment
- .btn-group<
- = view_on_environment_button(@commit.sha, @path, @environment)
-
-.btn-group{ role: "group" }<
- = link_to 'Raw', namespace_project_raw_path(@project.namespace, @project, @id),
- class: 'btn btn-sm', target: '_blank'
- -# 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
diff --git a/app/views/projects/blob/_blob.html.haml b/app/views/projects/blob/_blob.html.haml
index bf8801bb1e3..2b2ee6ed987 100644
--- a/app/views/projects/blob/_blob.html.haml
+++ b/app/views/projects/blob/_blob.html.haml
@@ -24,13 +24,5 @@
#blob-content-holder.blob-content-holder
%article.file-holder
- .js-file-title.file-title-flex-parent
- .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 "projects/blob/header", blob: blob
= render blob.to_partial_path(@project), blob: blob
diff --git a/app/views/projects/blob/_header.html.haml b/app/views/projects/blob/_header.html.haml
new file mode 100644
index 00000000000..deeeae3d64a
--- /dev/null
+++ b/app/views/projects/blob/_header.html.haml
@@ -0,0 +1,39 @@
+.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
diff --git a/app/views/projects/blob/_image.html.haml b/app/views/projects/blob/_image.html.haml
index f864702d862..ea3cecb86a9 100644
--- a/app/views/projects/blob/_image.html.haml
+++ b/app/views/projects/blob/_image.html.haml
@@ -9,7 +9,7 @@
- else
.nothing-here-block
The SVG could not be displayed as it is too large, you can
- #{link_to('view the raw file', namespace_project_raw_path(@project.namespace, @project, @id), target: '_blank')}
+ #{link_to('view the raw file', namespace_project_raw_path(@project.namespace, @project, @id), target: '_blank', rel: 'noopener noreferrer')}
instead.
- else
%img{ src: namespace_project_raw_path(@project.namespace, @project, tree_join(@commit.id, blob.path)), alt: "#{blob.name}" }
diff --git a/app/views/projects/blob/_text.html.haml b/app/views/projects/blob/_text.html.haml
index 58524418a67..7b16d266982 100644
--- a/app/views/projects/blob/_text.html.haml
+++ b/app/views/projects/blob/_text.html.haml
@@ -3,17 +3,17 @@
.nothing-here-block
File too large, you can
= succeed '.' do
- = link_to 'view the raw file', namespace_project_raw_path(@project.namespace, @project, @id), target: '_blank'
+ = link_to 'view the raw file', namespace_project_raw_path(@project.namespace, @project, @id), target: '_blank', rel: 'noopener noreferrer'
- else
- blob.load_all_data!(@repository)
- - if markup?(blob.name)
- .file-content.wiki
- = render_markup(blob.name, blob.data)
+ - if blob.empty?
+ .file-content.code
+ .nothing-here-block Empty file
- else
- - if blob.empty?
- .file-content.code
- .nothing-here-block Empty file
+ - if markup?(blob.name)
+ .file-content.wiki
+ = render_markup(blob.name, blob.data)
- else
= render 'shared/file_highlight', blob: blob, repository: @repository
diff --git a/app/views/projects/blob/edit.html.haml b/app/views/projects/blob/edit.html.haml
index 8853801016b..3bcddcb37f1 100644
--- a/app/views/projects/blob/edit.html.haml
+++ b/app/views/projects/blob/edit.html.haml
@@ -9,7 +9,7 @@
- if @conflict
.alert.alert-danger
Someone edited the file the same time you did. Please check out
- = link_to "the file", namespace_project_blob_path(@project.namespace, @project, tree_join(@target_branch, @file_path)), target: "_blank"
+ = link_to "the file", namespace_project_blob_path(@project.namespace, @project, tree_join(@target_branch, @file_path)), target: "_blank", rel: 'noopener noreferrer'
and make sure your changes will not unintentionally remove theirs.
.file-editor