Skip to content

Commit c2276f1

Browse files
committed
Port files_versions to vue
Simplify code and make it use our standard components Signed-off-by: Carl Schwan <[email protected]>
1 parent 6435191 commit c2276f1

16 files changed

+326
-654
lines changed

apps/files_versions/src/css/versions.css

Lines changed: 0 additions & 70 deletions
This file was deleted.

apps/files_versions/src/files_versions.js

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/**
2+
* @copyright 2022 Carl Schwan <[email protected]>
3+
* @license AGPL-3.0-or-later
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Affero General Public License as
7+
* published by the Free Software Foundation, either version 3 of the
8+
* License, or (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU Affero General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Affero General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*
18+
*/
19+
20+
import Vue from 'vue'
21+
import { translate as t, translatePlural as n } from '@nextcloud/l10n'
22+
23+
import VersionTab from './views/VersionTab.vue'
24+
import VTooltip from 'v-tooltip'
25+
26+
Vue.prototype.t = t
27+
Vue.prototype.n = n
28+
29+
Vue.use(VTooltip)
30+
31+
// Init Sharing tab component
32+
const View = Vue.extend(VersionTab)
33+
let TabInstance = null
34+
35+
window.addEventListener('DOMContentLoaded', function() {
36+
if (OCA.Files && OCA.Files.Sidebar) {
37+
OCA.Files.Sidebar.registerTab(new OCA.Files.Sidebar.Tab({
38+
id: 'version_vue',
39+
name: t('files_versions', 'Version'),
40+
icon: 'icon-history',
41+
42+
async mount(el, fileInfo, context) {
43+
if (TabInstance) {
44+
TabInstance.$destroy()
45+
}
46+
TabInstance = new View({
47+
// Better integration with vue parent component
48+
parent: context,
49+
})
50+
// Only mount after we have all the info we need
51+
await TabInstance.update(fileInfo)
52+
TabInstance.$mount(el)
53+
},
54+
update(fileInfo) {
55+
TabInstance.update(fileInfo)
56+
},
57+
destroy() {
58+
TabInstance.$destroy()
59+
TabInstance = null
60+
},
61+
}))
62+
}
63+
})

apps/files_versions/src/filesplugin.js

Lines changed: 0 additions & 46 deletions
This file was deleted.

apps/files_versions/src/templates/item.handlebars

Lines changed: 0 additions & 22 deletions
This file was deleted.

apps/files_versions/src/templates/template.handlebars

Lines changed: 0 additions & 10 deletions
This file was deleted.

apps/files_versions/src/versioncollection.js

Lines changed: 0 additions & 97 deletions
This file was deleted.

0 commit comments

Comments
 (0)