Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Eastwood <contact@ericeastwood.com>2017-09-20 23:35:49 +0300
committerEric Eastwood <contact@ericeastwood.com>2017-09-29 22:39:27 +0300
commit3265ccfc5a6a5c9a853956f84554f470286bb5ed (patch)
treefdcfb0fb8d50adf2c01e93bacd87dc3c07b6405d /app/views/projects/artifacts
parentaec1586c05f30c1a81928b441cd63e422752e56c (diff)
Add external link FE for online artifacts
FE for https://gitlab.com/gitlab-org/gitlab-ce/issues/34102
Diffstat (limited to 'app/views/projects/artifacts')
-rw-r--r--app/views/projects/artifacts/_tree_file.html.haml17
1 files changed, 13 insertions, 4 deletions
diff --git a/app/views/projects/artifacts/_tree_file.html.haml b/app/views/projects/artifacts/_tree_file.html.haml
index 8edb9be049a..f5e253f8d54 100644
--- a/app/views/projects/artifacts/_tree_file.html.haml
+++ b/app/views/projects/artifacts/_tree_file.html.haml
@@ -1,10 +1,19 @@
-- path_to_file = file_project_job_artifacts_path(@project, @build, path: file.path)
+- todo_external_artifacts_path = 'https://google.com'
+- is_external_link = !todo_external_artifacts_path.blank?
+- path_to_file = todo_external_artifacts_path || file_project_job_artifacts_path(@project, @build, path: file.path)
-%tr.tree-item{ 'data-link' => path_to_file }
+%tr.tree-item.js-artifact-tree-row{ data: { link: path_to_file, external_link: "#{is_external_link}" } }
- blob = file.blob
%td.tree-item-file-name
= tree_icon('file', blob.mode, blob.name)
- = link_to path_to_file do
- %span.str-truncated= blob.name
+ = link_to path_to_file,
+ class: 'tree-item-file-external-link js-artifact-tree-tooltip',
+ target: ('_blank' if is_external_link),
+ rel: ('noopener noreferrer' if is_external_link),
+ title: ('Opens in a new window' if is_external_link) do
+ %span.str-truncated>= blob.name
+ - if is_external_link
+ = ' '
+ = icon('external-link')
%td
= number_to_human_size(blob.size, precision: 2)