forked from BasicPrimitives/javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCaseCursorTemplate.html
More file actions
145 lines (127 loc) · 3.67 KB
/
CaseCursorTemplate.html
File metadata and controls
145 lines (127 loc) · 3.67 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<!DOCTYPE html>
<html>
<head>
<title>Cursor Template</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="../../primitives.js"></script>
<link href="../../css/primitives.css" media="screen" rel="stylesheet" type="text/css" />
<style type="text/css">
.bp-item2 {
position: absolute;
overflow: visible;/* redefine this atttribute in bp-item class in order to place items outside of boudaries*/
font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif;
-webkit-tap-highlight-color: rgba(0,0,0,0);
-webkit-user-select: none;
-webkit-touch-callout: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
box-sizing:content-box;
}
.bp-badge2 {
-moz-border-radius: 16px;
-webkit-border-radius: 16px;
-khtml-border-radius: 16px;
border-radius: 16px;
font-size: 18px;
line-height: 18px;
text-align: center;
text-decoration: none;
vertical-align: middle;
font-weight: bold;
font-family: Arial;
padding: 4px;
float: left;
width:16px;
height:16px;
}
</style>
<script type="text/javascript">
var control;
document.addEventListener('DOMContentLoaded', function () {
var options = new primitives.OrgConfig();
options.hasSelectorCheckbox = primitives.Enabled.False;
options.hasButtons = primitives.Enabled.False;
options.templates = [getCursorTemplate()];
options.onCursorRender = onCursorRender;
options.defaultTemplateName = "CursorTemplate";
options.normalItemsInterval = 20; /*add space for badge */
var items = [
new primitives.OrgItemConfig({
id: 0,
parent: null,
title: "James Smith",
description: "VP, Public Sector",
image: "../images/photos/a.png",
badge: '1'
}),
new primitives.OrgItemConfig({
id: 1,
parent: 0,
title: "Ted Lucas",
description: "VP, Human Resources",
image: "../images/photos/b.png",
badge: '2'
}),
new primitives.OrgItemConfig({
id: 2,
parent: 0,
title: "Fritz Stuger",
description: "Business Solutions, US",
image: "../images/photos/c.png",
badge: '3'
})
];
options.items = items;
options.cursorItem = 0;
control = primitives.OrgDiagram(document.getElementById("basicdiagram"), options);
});
function getCursorTemplate() {
var result = new primitives.TemplateConfig();
result.name = "CursorTemplate";
result.cursorTemplate = ["div",
{
name: 'cursorBorder',
width: (result.itemSize.width + result.cursorPadding.left + result.cursorPadding.right) + "px",
height: (result.itemSize.height + result.cursorPadding.top + result.cursorPadding.bottom) + "px",
"border-width": result.cursorBorderWidth + "px",
"class": ["bp-item2", "bp-corner-all", "bp-cursor-frame"]
},
["div",
{
name: 'badge',
style: {
top: "45px",
left: "114px",
zIndex: 1000,
backgroundColor: "green",
color: "white"
},
"class": ["bp-badge2", "bp-item"]
}
]
];
return result;
}
function onCursorRender(event, data) {
switch (data.renderingMode) {
case primitives.RenderingMode.Create:
break;
case primitives.RenderingMode.Update:
/* Update template content here */
break;
}
var itemConfig = data.context;
var element = data.element;
if (data.templateName == "CursorTemplate") {
var itemConfig = data.context;
element.firstChild.textContent = itemConfig.badge;
}
}
</script>
</head>
<body>
<div id="basicdiagram" style="width: 640px; height: 480px; border-style: dotted; border-width: 1px;"></div>
</body>
</html>