summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2016-12-08 11:48:19 +0000
committerFilipa Lacerda <filipa@gitlab.com>2016-12-09 10:14:48 +0000
commit1c5291715adfb38d0d54417827e4f0a4289e6788 (patch)
treecf777b0da66c0ae1481e4066d0603d12a3e035e1
parent70cb27926b225f71ccd4bba2342abbc3962da7e9 (diff)
downloadgitlab-ce-1c5291715adfb38d0d54417827e4f0a4289e6788.tar.gz
Replace commit icon svg logic
-rw-r--r--app/assets/javascripts/environments/components/environment_item.js.es63
-rw-r--r--app/assets/javascripts/vue_common_component/commit.js.es625
2 files changed, 8 insertions, 20 deletions
diff --git a/app/assets/javascripts/environments/components/environment_item.js.es6 b/app/assets/javascripts/environments/components/environment_item.js.es6
index 4e672bf6b58..177ffcb3785 100644
--- a/app/assets/javascripts/environments/components/environment_item.js.es6
+++ b/app/assets/javascripts/environments/components/environment_item.js.es6
@@ -465,7 +465,8 @@
:commit_url="commitUrl"
:short_sha="commitShortSha"
:title="commitTitle"
- :author="commitAuthor">
+ :author="commitAuthor"
+ :commit-icon-svg="commitIconSvg">
</commit-component>
</div>
<p v-if="!isFolder && !hasLastDeploymentKey" class="commit-title">
diff --git a/app/assets/javascripts/vue_common_component/commit.js.es6 b/app/assets/javascripts/vue_common_component/commit.js.es6
index 2ef2959cbf4..2b67521d022 100644
--- a/app/assets/javascripts/vue_common_component/commit.js.es6
+++ b/app/assets/javascripts/vue_common_component/commit.js.es6
@@ -68,6 +68,11 @@
required: false,
default: () => ({}),
},
+
+ commitIconSvg: {
+ type: String,
+ required: false,
+ },
},
computed: {
@@ -110,24 +115,6 @@
},
},
- /**
- * In order to reuse the svg instead of copy and paste in this template
- * we need to render it outside this component using =custom_icon partial.
- * Make sure it has this structure:
- * .commit-icon-svg.hidden
- * svg
- *
- * TODO: Find a better way to include SVG
- */
- mounted() {
- const commitIconContainer = this.$el.querySelector('.commit-icon-container');
- const commitIcon = document.querySelector('.commit-icon-svg.hidden svg');
-
- if (commitIconContainer && commitIcon) {
- commitIconContainer.appendChild(commitIcon.cloneNode(true));
- }
- },
-
template: `
<div class="branch-commit">
@@ -142,7 +129,7 @@
{{commit_ref.name}}
</a>
- <div class="icon-container commit-icon commit-icon-container"></div>
+ <div v-html="commitIconSvg" class="commit-icon"></div>
<a class="commit-id monospace"
:href="commit_url">