Skip to content

Commit

Permalink
Fix for #25 (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
SteKoe authored Jun 9, 2021
1 parent df68d6b commit 448a77d
Show file tree
Hide file tree
Showing 14 changed files with 390 additions and 317 deletions.
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Changing the property in the tab will also change the DAV property and hence it will be possible to access the
properties via DAV call `PROPFIND`.
]]></description>
<version>2.0.0</version>
<version>2.0.1</version>
<licence>apache</licence>
<author mail="nextcloud@stekoe.de">SteKoe</author>
<namespace>CustomProperties</namespace>
Expand Down
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ services:
volumes:
- db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=nextcloud
- MYSQL_PASSWORD=nextcloud
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_ROOT_PASSWORD=db
- MYSQL_PASSWORD=db
- MYSQL_DATABASE=db
- MYSQL_USER=db
app:
build: .
ports:
Expand Down
Empty file removed img/app.svg
Empty file.
4 changes: 2 additions & 2 deletions js/src-adminsettings.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/src-adminsettings.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/src-sidebartab.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/src-sidebartab.js.map

Large diffs are not rendered by default.

74 changes: 45 additions & 29 deletions src/sidebartab.js
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)
}
})
20 changes: 6 additions & 14 deletions src/views/sidebar/Sidebar.spec.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 448a77d

Please sign in to comment.