-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathsharingPane.ts
More file actions
49 lines (41 loc) · 1.53 KB
/
sharingPane.ts
File metadata and controls
49 lines (41 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* Sharing Pane
**
** This outline pane allows a user to view and adjust the sharing -- access control lists
** for anything which has that capability.
**
** I am using in places single quotes strings like 'this'
** where internationalization ("i18n") is not a problem, and double quoted
** like "this" where the string is seen by the user and so I18n is an issue.
*/
import { aclControl, icons, ns } from 'solid-ui'
const sharingPane = {
icon: icons.iconBase + 'padlock-timbl.svg',
name: 'sharing',
label: (subject, context) => {
const store = context.session.store
const t = store.findTypeURIs(subject)
if (t[ns.ldp('Resource').uri]) return 'Sharing' // @@ be more sophisticated?
if (t[ns.ldp('Container').uri]) return 'Sharing' // @@ be more sophisticated?
if (t[ns.ldp('BasicContainer').uri]) return 'Sharing' // @@ be more sophisticated?
// check being allowed to see/change sharing?
return null // No under other circumstances
},
render: (subject, context) => {
const dom = context.dom
const store = context.session.store
const noun = getNoun()
const div = dom.createElement('div')
div.classList.add('sharingPane')
aclControl.preventBrowserDropEvents(dom)
div.appendChild(aclControl.ACLControlBox5(subject, context, noun, store))
return div
function getNoun () {
const t = store.findTypeURIs(subject)
if (t[ns.ldp('BasicContainer').uri] || t[ns.ldp('Container').uri]) {
return 'folder'
}
return 'file'
}
}
}
export default sharingPane