forked from SolidOS/solid-panes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathargumentPane.js
More file actions
65 lines (48 loc) · 1.72 KB
/
argumentPane.js
File metadata and controls
65 lines (48 loc) · 1.72 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* View argument Pane
**
** This pane shows a position and optionally the positions which
** support or oppose it.
** @@ Unfinsihed.
** Should allow editing the data too
*/
import { store } from 'solid-logic-jss'
import * as UI from 'solid-ui-jss'
import * as panes from 'pane-registry'
// console.log('@@@ argument pane icon at ' + (module.__dirname || __dirname) + '/icon_argument.png')
export default {
icon: (module.__dirname || __dirname) + '/icon_argument.png', // @@ fix fro mashlib version
name: 'argument',
label: function (subject) {
const kb = store
const t = kb.findTypeURIs(subject)
if (t[UI.ns.arg('Position').uri]) return 'Argument'
return null
},
// View the data in a file in user-friendly way
render: function (subject, dom) {
const outliner = panes.getOutliner(dom)
const kb = store
const arg = UI.ns.arg
subject = kb.canon(subject)
// var types = kb.findTypeURIs(subject)
const div = dom.createElement('div')
div.setAttribute('class', 'argumentPane')
// var title = kb.any(subject, UI.ns.dc('title'))
const comment = kb.any(subject, UI.ns.rdfs('comment'))
if (comment) {
const para = dom.createElement('p')
para.setAttribute('style', 'margin-left: 2em; font-style: italic;')
div.appendChild(para)
para.textContent = comment.value
}
div.appendChild(dom.createElement('hr'))
let plist = kb.statementsMatching(subject, arg('support'))
outliner.appendPropertyTRs(div, plist, false)
div.appendChild(dom.createElement('hr'))
plist = kb.statementsMatching(subject, arg('opposition'))
outliner.appendPropertyTRs(div, plist, false)
div.appendChild(dom.createElement('hr'))
return div
}
}
// ends