2018-03-20 14:12:48 +00:00
|
|
|
<script>
|
2018-04-18 13:14:45 +00:00
|
|
|
import Icon from '~/vue_shared/components/icon.vue';
|
2018-03-22 10:14:27 +00:00
|
|
|
import tooltip from '~/vue_shared/directives/tooltip';
|
2018-04-06 18:40:49 +00:00
|
|
|
import { sprintf, n__, __ } from '~/locale';
|
2018-03-20 14:12:48 +00:00
|
|
|
|
2018-03-21 10:05:08 +00:00
|
|
|
export default {
|
|
|
|
components: {
|
2018-04-18 13:14:45 +00:00
|
|
|
Icon,
|
2018-03-21 10:05:08 +00:00
|
|
|
},
|
2018-03-22 10:14:27 +00:00
|
|
|
directives: {
|
|
|
|
tooltip,
|
|
|
|
},
|
2018-03-21 10:05:08 +00:00
|
|
|
props: {
|
|
|
|
files: {
|
|
|
|
type: Array,
|
|
|
|
required: true,
|
2018-03-20 14:12:48 +00:00
|
|
|
},
|
2018-04-18 13:14:45 +00:00
|
|
|
iconName: {
|
2018-03-21 10:05:08 +00:00
|
|
|
type: String,
|
|
|
|
required: true,
|
2018-03-20 14:12:48 +00:00
|
|
|
},
|
2018-03-22 10:14:27 +00:00
|
|
|
title: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
2018-03-21 10:05:08 +00:00
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
addedFilesLength() {
|
|
|
|
return this.files.filter(f => f.tempFile).length;
|
|
|
|
},
|
|
|
|
modifiedFilesLength() {
|
|
|
|
return this.files.filter(f => !f.tempFile).length;
|
|
|
|
},
|
|
|
|
addedFilesIconClass() {
|
|
|
|
return this.addedFilesLength ? 'multi-file-addition' : '';
|
|
|
|
},
|
|
|
|
modifiedFilesClass() {
|
|
|
|
return this.modifiedFilesLength ? 'multi-file-modified' : '';
|
|
|
|
},
|
2018-03-22 10:14:27 +00:00
|
|
|
additionsTooltip() {
|
2018-05-07 16:36:38 +00:00
|
|
|
return sprintf(n__('1 %{type} addition', '%{count} %{type} additions', this.addedFilesLength), {
|
2018-04-06 18:40:49 +00:00
|
|
|
type: this.title.toLowerCase(),
|
2018-05-07 16:36:38 +00:00
|
|
|
count: this.addedFilesLength,
|
2018-04-06 18:40:49 +00:00
|
|
|
});
|
2018-03-22 10:14:27 +00:00
|
|
|
},
|
|
|
|
modifiedTooltip() {
|
|
|
|
return sprintf(
|
2018-05-07 16:36:38 +00:00
|
|
|
n__('1 %{type} modification', '%{count} %{type} modifications', this.modifiedFilesLength), {
|
|
|
|
type: this.title.toLowerCase(),
|
|
|
|
count: this.modifiedFilesLength,
|
|
|
|
},
|
2018-03-22 10:14:27 +00:00
|
|
|
);
|
|
|
|
},
|
|
|
|
titleTooltip() {
|
2018-04-06 18:40:49 +00:00
|
|
|
return sprintf(__('%{title} changes'), { title: this.title });
|
2018-03-22 10:14:27 +00:00
|
|
|
},
|
2018-04-09 15:05:21 +00:00
|
|
|
additionIconName() {
|
2018-04-18 13:14:45 +00:00
|
|
|
return this.title.toLowerCase() === 'staged' ? 'file-addition-solid' : 'file-addition';
|
2018-04-09 15:05:21 +00:00
|
|
|
},
|
|
|
|
modifiedIconName() {
|
|
|
|
return this.title.toLowerCase() === 'staged' ? 'file-modified-solid' : 'file-modified';
|
|
|
|
},
|
2018-03-21 10:05:08 +00:00
|
|
|
},
|
|
|
|
};
|
2018-03-20 14:12:48 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div
|
|
|
|
class="multi-file-commit-list-collapsed text-center"
|
|
|
|
>
|
2018-03-22 10:14:27 +00:00
|
|
|
<div
|
|
|
|
v-tooltip
|
|
|
|
:title="titleTooltip"
|
|
|
|
data-container="body"
|
|
|
|
data-placement="left"
|
|
|
|
class="append-bottom-15"
|
|
|
|
>
|
|
|
|
<icon
|
|
|
|
v-once
|
2018-04-18 13:14:45 +00:00
|
|
|
:name="iconName"
|
2018-03-22 10:14:27 +00:00
|
|
|
:size="18"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
v-tooltip
|
|
|
|
:title="additionsTooltip"
|
|
|
|
data-container="body"
|
|
|
|
data-placement="left"
|
|
|
|
class="append-bottom-10"
|
|
|
|
>
|
|
|
|
<icon
|
2018-04-09 15:05:21 +00:00
|
|
|
:name="additionIconName"
|
2018-03-22 10:14:27 +00:00
|
|
|
:size="18"
|
|
|
|
:css-classes="addedFilesIconClass"
|
|
|
|
/>
|
|
|
|
</div>
|
2018-03-21 10:05:08 +00:00
|
|
|
{{ addedFilesLength }}
|
2018-03-22 10:14:27 +00:00
|
|
|
<div
|
|
|
|
v-tooltip
|
|
|
|
:title="modifiedTooltip"
|
|
|
|
data-container="body"
|
|
|
|
data-placement="left"
|
|
|
|
class="prepend-top-10 append-bottom-10"
|
|
|
|
>
|
|
|
|
<icon
|
2018-04-09 15:05:21 +00:00
|
|
|
:name="modifiedIconName"
|
2018-03-22 10:14:27 +00:00
|
|
|
:size="18"
|
|
|
|
:css-classes="modifiedFilesClass"
|
|
|
|
/>
|
|
|
|
</div>
|
2018-03-21 10:05:08 +00:00
|
|
|
{{ modifiedFilesLength }}
|
2018-03-20 14:12:48 +00:00
|
|
|
</div>
|
|
|
|
</template>
|