-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.coffee
executable file
·85 lines (78 loc) · 1.91 KB
/
index.coffee
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
show = angular.module('archivist.datasets.show',
[
'ngVis',
'archivist.data_manager'
]
)
show.controller(
'DatasetsShowController',
[
'$scope',
'$routeParams',
'VisDataSet',
'DataManager'
(
$scope,
$routeParams,
VisDataSet,
DataManager
)->
$scope.dataset = DataManager.getDataset(
$routeParams.id,
{
variables: true,
questions: true
},
->
$scope.breadcrumbs = [
{
label: 'Datasets',
link: '/datasets',
active: false
},
{
label: $scope.dataset.name,
link: false,
active: true
}
]
)
$scope.pageSize = 20
$scope.graphData = {}
$scope.graphOptions =
interaction:
dragNodes: false
layout:
hierarchical:
enabled: true
direction: 'LR'
$scope.graphEvents =
click: (data)->
if data.nodes.length == 1
if data.nodes[0] < 20000000
type = 'CcQuestion'
id = data.nodes[0] - 10000000
else
type = 'Variable'
id = data.nodes[0] - 20000000
console.log $scope
$scope.split_mapping = (model, other, x = null, y = null)->
model.$split_mapping {
other:
class: other.class
id: other.id
x: x
y: y
}
$scope.detectKey = (event, variable, x = null, y = null)->
if event.keyCode == 13
new_sources = event.target.value.split ','
DataManager.addSources(variable, new_sources, x, y).then(->
$scope.model.orig_topic = $scope.model.topic
, (reason)->
variable.errors = reason.data.message
)
console.log variable
console.log $scope
]
)