Skip to content

Commit

Permalink
fixup! Add a trashbin for calendars and events
Browse files Browse the repository at this point in the history
Signed-off-by: greta <[email protected]>
  • Loading branch information
GretaD committed May 31, 2021
1 parent a971107 commit b0e1a01
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
29 changes: 29 additions & 0 deletions src/components/AppNavigation/CalendarList/Moment.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<template>
<span class="live-relative-timestamp" :data-timestamp="timestamp * 1000" :title="title">{{ formatted }}</span>
</template>

<script>
import moment from '@nextcloud/moment'
export default {
name: 'Moment',
props: {
timestamp: {
type: Number,
required: true,
},
format: {
type: String,
default: 'LLL',
},
},
computed: {
title() {
return moment.unix(this.timestamp).format(this.format)
},
formatted() {
return moment.unix(this.timestamp).fromNow()
},
},
}
</script>
4 changes: 3 additions & 1 deletion src/components/AppNavigation/CalendarList/Trashbin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<tr v-for="item in items" :key="item.url">
<td>{{ item.name }}</td>
<td class="deletedAt">
{{ item.deletedAt }}
<Moment class="timestamp" :timestamp="item.deletedAt"> </Moment>
</td>
<td>
<button @click="restore(item)">
Expand All @@ -62,12 +62,14 @@ import Modal from '@nextcloud/vue/dist/Components/Modal'
import logger from '../../../utils/logger'
import { showError } from '@nextcloud/dialogs'
import { mapGetters } from 'vuex'
import Moment from "./Moment";
export default {
name: 'Trashbin',
components: {
AppNavigationItem,
Modal,
Moment,
},
data() {
return {
Expand Down

0 comments on commit b0e1a01

Please sign in to comment.