-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
390 additions
and
317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,55 @@ | ||
import Vue from 'vue' | ||
import { translate, translatePlural } from '@nextcloud/l10n' | ||
|
||
import Sidebar from './views/sidebar/Sidebar.vue' | ||
|
||
Vue.prototype.t = translate | ||
Vue.prototype.n = translatePlural | ||
|
||
// Init Sharing tab component | ||
const View = Vue.extend(Sidebar) | ||
let TabInstance = null | ||
import SidebarTab from './views/sidebar/SidebarTab' | ||
import TabContent from './views/sidebar/TabContent' | ||
|
||
window.addEventListener('DOMContentLoaded', () => { | ||
if (OCA.Files && OCA.Files.Sidebar) { | ||
OCA.Files.Sidebar.registerTab(new OCA.Files.Sidebar.Tab({ | ||
id: 'customproperties', | ||
name: t('customproperties', 'Properties'), | ||
icon: 'icon-info', | ||
let tab | ||
|
||
try { | ||
// Nextcloud 20 | ||
tab = new OCA.Files.Sidebar.Tab('customproperties', SidebarTab) | ||
} catch (error) { | ||
// Nextcloud > 21 | ||
Vue.prototype.t = translate | ||
Vue.prototype.n = translatePlural | ||
|
||
async mount(el, fileInfo, context) { | ||
if (TabInstance) { | ||
// Init Sharing tab component | ||
const View = Vue.extend(TabContent) | ||
let TabInstance = null | ||
|
||
tab = new OCA.Files.Sidebar.Tab({ | ||
id: 'customproperties', | ||
name: t('customproperties', 'Properties'), | ||
icon: 'icon-info', | ||
|
||
async mount(el, fileInfo, context) { | ||
if (TabInstance) { | ||
TabInstance.$destroy() | ||
} | ||
TabInstance = new View({ | ||
parent: context, | ||
data() { | ||
return { | ||
fileInfo_: fileInfo, | ||
} | ||
}, | ||
}) | ||
await TabInstance.updateFileInfo(fileInfo) | ||
TabInstance.$mount(el) | ||
}, | ||
async update(fileInfo) { | ||
await TabInstance.updateFileInfo(fileInfo) | ||
}, | ||
destroy() { | ||
TabInstance.$destroy() | ||
} | ||
TabInstance = new View({ | ||
parent: context, | ||
}) | ||
await TabInstance.update(fileInfo) | ||
TabInstance.$mount(el) | ||
}, | ||
update(fileInfo) { | ||
TabInstance.update(fileInfo) | ||
}, | ||
destroy() { | ||
TabInstance.$destroy() | ||
TabInstance = null | ||
}, | ||
})) | ||
TabInstance = null | ||
}, | ||
}) | ||
} | ||
|
||
OCA.Files.Sidebar.registerTab(tab) | ||
} | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.