summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ide/components/file_finder/item.vue
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-04-12 12:00:07 +0100
committerPhil Hughes <me@iamphill.com>2018-04-16 09:48:58 +0100
commitb867b33ea8bd39ea7024ab22f3e93f6ee21504bd (patch)
tree13205f21c7c0fdbbdf09119690a06c20091ecd6a /app/assets/javascripts/ide/components/file_finder/item.vue
parenta3566506e3336d174e0fe669bd8c420a45df4a29 (diff)
downloadgitlab-ce-b867b33ea8bd39ea7024ab22f3e93f6ee21504bd.tar.gz
moved CSS into SCSS file
added ellipsis to path but not name
Diffstat (limited to 'app/assets/javascripts/ide/components/file_finder/item.vue')
-rw-r--r--app/assets/javascripts/ide/components/file_finder/item.vue23
1 files changed, 11 insertions, 12 deletions
diff --git a/app/assets/javascripts/ide/components/file_finder/item.vue b/app/assets/javascripts/ide/components/file_finder/item.vue
index 15ba9f3d21c..7d930ce9c01 100644
--- a/app/assets/javascripts/ide/components/file_finder/item.vue
+++ b/app/assets/javascripts/ide/components/file_finder/item.vue
@@ -2,6 +2,8 @@
import fuzzaldrinPlus from 'fuzzaldrin-plus';
import FileIcon from '../../../vue_shared/components/file_icon.vue';
+const MAX_PATH_LENGTH = 60;
+
export default {
components: {
FileIcon,
@@ -24,10 +26,14 @@ export default {
clickRow() {
this.$emit('click', this.file);
},
- highlightText(text) {
- const occurrences = fuzzaldrinPlus.match(text, this.searchText);
+ highlightText(text, addEllipsis) {
+ const maxText =
+ text.length < MAX_PATH_LENGTH || !addEllipsis
+ ? text
+ : `...${text.substr(text.length - MAX_PATH_LENGTH)}`;
+ const occurrences = fuzzaldrinPlus.match(maxText, this.searchText);
- return text
+ return maxText
.split('')
.map(
(char, i) =>
@@ -56,21 +62,14 @@ export default {
<span class="diff-changed-file-content append-right-8">
<strong
class="diff-changed-file-name"
- v-html="highlightText(file.name)"
+ v-html="highlightText(file.name, false)"
>
</strong>
<span
class="diff-changed-file-path prepend-top-5"
- v-html="highlightText(file.path)"
+ v-html="highlightText(file.path, true)"
>
</span>
</span>
</a>
</template>
-
-<style>
-.highlighted {
- color: #1b69b6;
- font-weight: 600;
-}
-</style>