Adde TotalTimeComponent as global component

This commit is contained in:
Alfredo Sumaran 2016-11-16 16:07:47 -05:00
parent 06fd2879ee
commit fe5ae3b0af
3 changed files with 33 additions and 8 deletions

View file

@ -45,14 +45,7 @@
</span>
</div>
<div class="item-time">
<span class="hours" v-if="issue.totalTime.hours">
{{ issue.totalTime.hours }}
<abbr title="Hours">hr</abbr>
</span>
<span class="minutes" v-if="issue.totalTime.minutes">
{{ issue.totalTime.minutes }}
<abbr title="Minutes">mins</abbr>
</span>
<total-time :time="issue.totalTime"></total-time>
</div>
</div>
`,

View file

@ -0,0 +1,29 @@
((global) => {
global.cycleAnalytics = global.cycleAnalytics || {};
global.cycleAnalytics.TotalTimeComponent = Vue.extend({
props: {
time: Object,
},
template: `
<span>
<span class="days" v-if="time.days">
{{ time.days }}
<abbr title="Days">{{ time.days === 1 ? 'day' : 'days' }}</abbr>
</span>
<span class="hours" v-if="time.hours">
{{ time.hours }}
<abbr title="Hours">hr</abbr>
</span>
<span class="mins" v-if="time.mins">
{{ time.mins }}
<abbr title="Minutes">mins</abbr>
</span>
<span class="seconds hide" v-if="time.seconds">
{{ time.seconds }}
<abbr title="Seconds">s</abbr>
</span>
</span>
`,
});
})(window.gl || (window.gl = {}));

View file

@ -115,4 +115,7 @@ $(() => {
},
},
});
// Register global components
Vue.component('total-time', gl.cycleAnalytics.TotalTimeComponent);
});