audit_rails 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/audit_rails/application.js +1 -3
- data/app/assets/javascripts/audit_rails/hourly-views.js +15 -70
- data/app/assets/javascripts/audit_rails/page-view-user-contribution.js +17 -119
- data/app/assets/javascripts/audit_rails/page-views-for-user.js +16 -69
- data/app/assets/javascripts/audit_rails/page-views.js +15 -69
- data/app/assets/javascripts/audit_rails/user-counts.js +15 -70
- data/app/assets/stylesheets/audit_rails/application.css +1 -0
- data/app/assets/stylesheets/audit_rails/audit_rails.css +5 -84
- data/lib/audit_rails/engine.rb +7 -0
- data/lib/audit_rails/version.rb +1 -1
- metadata +16 -5
- data/app/assets/javascripts/audit_rails/Chart.min.js +0 -39
- data/app/assets/javascripts/audit_rails/d3/d3.tip.js +0 -276
- data/app/assets/javascripts/audit_rails/d3/d3.v3.js +0 -9300
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef20c62dd3cb3e2a5776d7502155c7005b34018a
|
4
|
+
data.tar.gz: 77618e157b6e3ac7d9f05f6d6224834aacec7c12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0dd0e22106c23a41f2b12204e09c6cc650868e1624d8bebbbf199d5346a247665d8407ecc47c23df9fe80f2ffe8fa56ebf775ea04d81553d2134859a02696a5f
|
7
|
+
data.tar.gz: a7f4fe28afbacdb64d501a1d65f41e58061ec3f0795a57428ccc2ed41758da458b9038534e763c49d09ca592487d6e72a7c2a68f153b54464d5b689d27bcefa5
|
@@ -12,11 +12,9 @@
|
|
12
12
|
//
|
13
13
|
//= require jquery
|
14
14
|
//= require jquery_ujs
|
15
|
+
//= require sleek_charts
|
15
16
|
//= require audit_rails/jquery-ui
|
16
17
|
//= require audit_rails/date-picker
|
17
|
-
//= require audit_rails/Chart.min
|
18
|
-
//= require audit_rails/d3/d3.v3
|
19
|
-
//= require audit_rails/d3/d3.tip
|
20
18
|
//= require audit_rails/user-counts
|
21
19
|
//= require audit_rails/page-views
|
22
20
|
//= require audit_rails/page-views-for-user
|
@@ -1,72 +1,17 @@
|
|
1
1
|
var data = JSON.parse( $('div#hourlyViewsCount').attr('data-visit-count'));
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
var yAxis = d3.svg.axis()
|
19
|
-
.scale(y)
|
20
|
-
.orient("left");
|
21
|
-
|
22
|
-
var tip = d3.tip()
|
23
|
-
.attr('class', 'd3-tip')
|
24
|
-
.offset([-10, 0])
|
25
|
-
.html(function(d) {
|
26
|
-
return "<strong>Page Views:</strong> <span style='color:red'>" + d.count + "</span>";
|
27
|
-
})
|
28
|
-
|
29
|
-
var svg = d3.select("div#hourlyViewsCount").append("svg")
|
30
|
-
.attr("width", width + margin.left + margin.right)
|
31
|
-
.attr("height", height + margin.top + margin.bottom)
|
32
|
-
.append("g")
|
33
|
-
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
|
34
|
-
|
35
|
-
svg.call(tip);
|
36
|
-
|
37
|
-
x.domain(data.map(function(d) { return d.hour; }));
|
38
|
-
y.domain([0, d3.max(data, function(d) { return d.count; })]);
|
39
|
-
|
40
|
-
svg.append("g")
|
41
|
-
.attr("class", "x axis")
|
42
|
-
.attr("transform", "translate(0," + height + ")")
|
43
|
-
.call(xAxis)
|
44
|
-
.selectAll("text")
|
45
|
-
.style("text-anchor", "end")
|
46
|
-
.attr("dx", "-.8em")
|
47
|
-
.attr("dy", ".15em")
|
48
|
-
.attr("transform", function(d) {
|
49
|
-
return "rotate(-65)"
|
50
|
-
});
|
51
|
-
|
52
|
-
svg.append("g")
|
53
|
-
.attr("class", "y axis")
|
54
|
-
.call(yAxis)
|
55
|
-
.append("text")
|
56
|
-
.attr("transform", "rotate(-90)")
|
57
|
-
.attr("y", -40)
|
58
|
-
.attr("x", -80)
|
59
|
-
.attr("dy", "0.71em")
|
60
|
-
.style("text-anchor", "end")
|
61
|
-
.text("Page Views");
|
62
|
-
|
63
|
-
svg.selectAll(".bar")
|
64
|
-
.data(data)
|
65
|
-
.enter().append("rect")
|
66
|
-
.attr("class", "bar")
|
67
|
-
.attr("x", function(d) { return x(d.hour); })
|
68
|
-
.attr("width", x.rangeBand())
|
69
|
-
.attr("y", function(d) { return y(d.count); })
|
70
|
-
.attr("height", function(d) { return height - y(d.count); })
|
71
|
-
.on('mouseover', tip.show)
|
72
|
-
.on('mouseout', tip.hide);
|
3
|
+
barTip({
|
4
|
+
selector: 'div#hourlyViewsCount',
|
5
|
+
data: data,
|
6
|
+
width: 960,
|
7
|
+
height: 360,
|
8
|
+
margin: {top: 40, right: 20, bottom: 100, left:40},
|
9
|
+
flexRight: true,
|
10
|
+
labelAngle: -60,
|
11
|
+
xDomain: 'hour',
|
12
|
+
yDomain: 'count',
|
13
|
+
yAxisText: 'Page Views',
|
14
|
+
tipLabel: '',
|
15
|
+
tipValue: 'count',
|
16
|
+
tipText: 'Page views'
|
17
|
+
});
|
@@ -1,122 +1,20 @@
|
|
1
1
|
function pageViewsShareByUser(userName) {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
2
|
+
data = JSON.parse( $('a[data-user="'+ userName +'"]').attr('data-page-visits'));
|
3
|
+
donutTip({
|
4
|
+
selector: 'div#pageViewsShareByUser',
|
5
|
+
data: data,
|
6
|
+
width: 500,
|
7
|
+
height: 500,
|
8
|
+
margin: {top: 40, right: 40, bottom: 40, left:40},
|
9
|
+
flexRight: true,
|
10
|
+
innerRadius: 90,
|
11
|
+
outerRadius: 180,
|
12
|
+
color: d3.scale.category20c(),
|
13
|
+
xDomain: 'page',
|
14
|
+
yDomain: 'count',
|
15
|
+
tipLabel: '',
|
16
|
+
tipValue: 'count',
|
17
|
+
tipText: 'Page Views',
|
18
|
+
totalLabel: 'Views'
|
17
19
|
});
|
18
|
-
var div = d3.select("body").append("div")
|
19
|
-
.attr("class", "tooltip")
|
20
|
-
.style("opacity", 0);
|
21
|
-
|
22
|
-
var vis = d3.select("div#pageViewsShareByUser")
|
23
|
-
.append("svg:svg") //create the SVG element inside the <body>
|
24
|
-
.data([data]) //associate our data with the document
|
25
|
-
.attr("width", width + margin.left + margin.right)
|
26
|
-
.attr("height", height + margin.top + margin.bottom)
|
27
|
-
.append("svg:g") //make a group to hold our pie chart
|
28
|
-
.attr("transform", "translate(" + radius * 1.5 + "," + radius * 1.5 + ")");
|
29
|
-
var textTop = vis.append("text")
|
30
|
-
.attr("dy", ".35em")
|
31
|
-
.style("text-anchor", "middle")
|
32
|
-
.attr("class", "textTop")
|
33
|
-
.text("TOTAL")
|
34
|
-
.attr("y", -10),
|
35
|
-
textBottom = vis.append("text")
|
36
|
-
.attr("dy", ".35em")
|
37
|
-
.style("text-anchor", "middle")
|
38
|
-
.attr("class", "textBottom")
|
39
|
-
.text(total + " Views")
|
40
|
-
.attr("y", 10);
|
41
|
-
|
42
|
-
var arc = d3.svg.arc()
|
43
|
-
.innerRadius(inner)
|
44
|
-
.outerRadius(radius);
|
45
|
-
var arcOver = d3.svg.arc()
|
46
|
-
.innerRadius(inner + 5)
|
47
|
-
.outerRadius(radius + 5);
|
48
|
-
|
49
|
-
var pie = d3.layout.pie() //this will create arc data for us given a list of values
|
50
|
-
.value(function (d) {
|
51
|
-
return d.count;
|
52
|
-
}); //we must tell it out to access the value of each element in our data array
|
53
|
-
|
54
|
-
var arcs = vis.selectAll("g.slice") //this selects all <g> elements with class slice (there aren't any yet)
|
55
|
-
.data(pie) //associate the generated pie data (an array of arcs, each having startAngle, endAngle and value properties)
|
56
|
-
.enter() //this will create <g> elements for every "extra" data element that should be associated with a selection. The result is creating a <g> for every object in the data array
|
57
|
-
.append("svg:g") //create a group to hold each slice (we will have a <path> and a <text> element associated with each slice)
|
58
|
-
.attr("class", "slice") //allow us to style things in the slices (like text)
|
59
|
-
.on('mousemove', function (d, i) {
|
60
|
-
d3.select(this).select("path").transition()
|
61
|
-
.duration(200)
|
62
|
-
.attr("d", arcOver);
|
63
|
-
|
64
|
-
textTop.text(d3.select(this).datum().data.page)
|
65
|
-
.attr("y", -10);
|
66
|
-
textBottom.text(d3.select(this).datum().data.count + " Views")
|
67
|
-
.attr("y", 10);
|
68
|
-
|
69
|
-
div.transition()
|
70
|
-
.duration(200)
|
71
|
-
.style("opacity", 0.9);
|
72
|
-
div.html("<strong>Page Views:</strong> <span style='color:red'>" + d.data.count + "</span>")
|
73
|
-
.style("left", (d3.event.pageX - 57) + "px")
|
74
|
-
.style("top", (d3.event.pageY - 50) + "px")
|
75
|
-
.style("z-index", 10000)
|
76
|
-
})
|
77
|
-
.on("mouseout", function (d) {
|
78
|
-
d3.select(this).select("path").transition()
|
79
|
-
.duration(100)
|
80
|
-
.attr("d", arc);
|
81
|
-
|
82
|
-
textTop.text("TOTAL")
|
83
|
-
.attr("y", -10);
|
84
|
-
textBottom.text(total + " Views");
|
85
|
-
|
86
|
-
div.transition()
|
87
|
-
.duration(500)
|
88
|
-
.style("opacity", 0);
|
89
|
-
});
|
90
|
-
|
91
|
-
arcs.append("svg:path")
|
92
|
-
.attr("fill", function (d, i) {
|
93
|
-
return color(i);
|
94
|
-
}) //set the color for each slice to be chosen from the color function defined above
|
95
|
-
.attr("d", arc); //this creates the actual SVG path using the associated data (pie) with the arc drawing function
|
96
|
-
|
97
|
-
var legend = d3.select("div#pageViewsShareByUser").append("svg")
|
98
|
-
.attr("class", "legend")
|
99
|
-
.attr("width", radius)
|
100
|
-
.attr("height", radius * 2)
|
101
|
-
.selectAll("g")
|
102
|
-
.data(data)
|
103
|
-
.enter().append("g")
|
104
|
-
.attr("transform", function (d, i) {
|
105
|
-
return "translate(0," + i * 20 + ")";
|
106
|
-
});
|
107
|
-
|
108
|
-
legend.append("rect")
|
109
|
-
.attr("width", 18)
|
110
|
-
.attr("height", 18)
|
111
|
-
.style("fill", function (d, i) {
|
112
|
-
return color(i);
|
113
|
-
});
|
114
|
-
|
115
|
-
legend.append("text")
|
116
|
-
.attr("x", 24)
|
117
|
-
.attr("y", 9)
|
118
|
-
.attr("dy", ".35em")
|
119
|
-
.text(function (d) {
|
120
|
-
return d.page;
|
121
|
-
});
|
122
20
|
}
|
@@ -1,72 +1,19 @@
|
|
1
1
|
function pageViewsForUser(userName){
|
2
|
-
|
3
2
|
var data = JSON.parse( $('a[data-user="'+ userName +'"]').attr('data-page-visits'));
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
.scale(y)
|
22
|
-
.orient("left");
|
23
|
-
|
24
|
-
var tip = d3.tip()
|
25
|
-
.attr('class', 'd3-tip')
|
26
|
-
.offset([-10, 0])
|
27
|
-
.html(function(d) {
|
28
|
-
return "<strong>Page Views:</strong> <span style='color:red'>" + d.count + "</span>";
|
29
|
-
})
|
30
|
-
|
31
|
-
var svg = d3.select("div#pageViewsByUser").append("svg")
|
32
|
-
.attr("width", width + margin.left + margin.right)
|
33
|
-
.attr("height", height + margin.top + margin.bottom)
|
34
|
-
.append("g")
|
35
|
-
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
|
36
|
-
|
37
|
-
svg.call(tip);
|
38
|
-
|
39
|
-
x.domain(data.map(function(d) { return d.page; }));
|
40
|
-
y.domain([0, d3.max(data, function(d) { return d.count; })]);
|
41
|
-
|
42
|
-
svg.append("g")
|
43
|
-
.attr("class", "x axis")
|
44
|
-
.attr("transform", "translate(0," + height + ")")
|
45
|
-
.call(xAxis)
|
46
|
-
.selectAll("text")
|
47
|
-
.style("text-anchor", "end")
|
48
|
-
.attr("dx", "-.8em")
|
49
|
-
.attr("dy", ".15em")
|
50
|
-
.attr("transform", function(d) {
|
51
|
-
return "rotate(-65)"
|
52
|
-
});
|
53
|
-
|
54
|
-
svg.append("g")
|
55
|
-
.attr("class", "y axis")
|
56
|
-
.call(yAxis)
|
57
|
-
.append("text")
|
58
|
-
.attr("transform", "rotate(-90)")
|
59
|
-
.attr("y", -40)
|
60
|
-
.attr("x", -80)
|
61
|
-
|
62
|
-
svg.selectAll(".bar")
|
63
|
-
.data(data)
|
64
|
-
.enter().append("rect")
|
65
|
-
.attr("class", "bar")
|
66
|
-
.attr("x", function(d) { return x(d.page); })
|
67
|
-
.attr("width", x.rangeBand())
|
68
|
-
.attr("y", function(d) { return y(d.count); })
|
69
|
-
.attr("height", function(d) { return height - y(d.count); })
|
70
|
-
.on('mouseover', tip.show)
|
71
|
-
.on('mouseout', tip.hide);
|
72
|
-
}
|
4
|
+
barTip({
|
5
|
+
selector: 'div#pageViewsByUser',
|
6
|
+
data: data,
|
7
|
+
width: 960,
|
8
|
+
height: 360,
|
9
|
+
margin: {top: 40, right: 20, bottom: 100, left:40},
|
10
|
+
flexRight: true,
|
11
|
+
labelAngle: -60,
|
12
|
+
xDomain: 'page',
|
13
|
+
yDomain: 'count',
|
14
|
+
yAxisText: 'Page Views',
|
15
|
+
tipLabel: '',
|
16
|
+
tipValue: 'count',
|
17
|
+
tipText: 'Page views'
|
18
|
+
});
|
19
|
+
}
|
@@ -1,71 +1,17 @@
|
|
1
1
|
var data = JSON.parse( $('div#pageViewsCount').attr('data-visit-count'));
|
2
|
-
var right = d3.max([20, (900 - data.length * 50)]);
|
3
|
-
var margin = {top: 40, right: right, bottom: 100, left: 40},
|
4
|
-
width = 960 - margin.left - margin.right,
|
5
|
-
height = 360 - margin.top - margin.bottom;
|
6
2
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
.attr('class', 'd3-tip')
|
23
|
-
.offset([-10, 0])
|
24
|
-
.html(function(d) {
|
25
|
-
return "<strong>Page Views:</strong> <span style='color:red'>" + d.count + "</span>";
|
26
|
-
})
|
27
|
-
|
28
|
-
var svg = d3.select("div#pageViewsCount").append("svg")
|
29
|
-
.attr("width", width + margin.left + margin.right)
|
30
|
-
.attr("height", height + margin.top + margin.bottom)
|
31
|
-
.append("g")
|
32
|
-
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
|
33
|
-
|
34
|
-
svg.call(tip);
|
35
|
-
|
36
|
-
x.domain(data.map(function(d) { return d.page; }));
|
37
|
-
y.domain([0, d3.max(data, function(d) { return d.count; })]);
|
38
|
-
|
39
|
-
svg.append("g")
|
40
|
-
.attr("class", "x axis")
|
41
|
-
.attr("transform", "translate(0," + height + ")")
|
42
|
-
.call(xAxis)
|
43
|
-
.selectAll("text")
|
44
|
-
.style("text-anchor", "end")
|
45
|
-
.attr("dx", "-.8em")
|
46
|
-
.attr("dy", ".15em")
|
47
|
-
.attr("transform", function(d) {
|
48
|
-
return "rotate(-65)"
|
49
|
-
});
|
50
|
-
|
51
|
-
svg.append("g")
|
52
|
-
.attr("class", "y axis")
|
53
|
-
.call(yAxis)
|
54
|
-
.append("text")
|
55
|
-
.attr("transform", "rotate(-90)")
|
56
|
-
.attr("y", -40)
|
57
|
-
.attr("x", -80)
|
58
|
-
.attr("dy", "0.71em")
|
59
|
-
.style("text-anchor", "end")
|
60
|
-
.text("Page Views");
|
61
|
-
|
62
|
-
svg.selectAll(".bar")
|
63
|
-
.data(data)
|
64
|
-
.enter().append("rect")
|
65
|
-
.attr("class", "bar")
|
66
|
-
.attr("x", function(d) { return x(d.page); })
|
67
|
-
.attr("width", x.rangeBand())
|
68
|
-
.attr("y", function(d) { return y(d.count); })
|
69
|
-
.attr("height", function(d) { return height - y(d.count); })
|
70
|
-
.on('mouseover', tip.show)
|
71
|
-
.on('mouseout', tip.hide);
|
3
|
+
barTip({
|
4
|
+
selector: 'div#pageViewsCount',
|
5
|
+
data: data,
|
6
|
+
width: 960,
|
7
|
+
height: 360,
|
8
|
+
margin: {top: 40, right: 20, bottom: 100, left:40},
|
9
|
+
flexRight: true,
|
10
|
+
labelAngle: -60,
|
11
|
+
xDomain: 'page',
|
12
|
+
yDomain: 'count',
|
13
|
+
yAxisText: 'Page Views',
|
14
|
+
tipLabel: '',
|
15
|
+
tipValue: 'count',
|
16
|
+
tipText: 'Page views'
|
17
|
+
});
|
@@ -1,72 +1,17 @@
|
|
1
1
|
var data = JSON.parse( $('div#userViewsCount').attr('data-visit-count'));
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
var yAxis = d3.svg.axis()
|
19
|
-
.scale(y)
|
20
|
-
.orient("left");
|
21
|
-
|
22
|
-
var tip = d3.tip()
|
23
|
-
.attr('class', 'd3-tip')
|
24
|
-
.offset([-10, 0])
|
25
|
-
.html(function(d) {
|
26
|
-
return "<strong>Page Views:</strong> <span style='color:red'>" + d.count + "</span>";
|
27
|
-
})
|
28
|
-
|
29
|
-
var svg = d3.select("div#userViewsCount").append("svg")
|
30
|
-
.attr("width", width + margin.left + margin.right)
|
31
|
-
.attr("height", height + margin.top + margin.bottom)
|
32
|
-
.append("g")
|
33
|
-
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
|
34
|
-
|
35
|
-
svg.call(tip);
|
36
|
-
|
37
|
-
x.domain(data.map(function(d) { return d.user; }));
|
38
|
-
y.domain([0, d3.max(data, function(d) { return d.count; })]);
|
39
|
-
|
40
|
-
svg.append("g")
|
41
|
-
.attr("class", "x axis")
|
42
|
-
.attr("transform", "translate(0," + height + ")")
|
43
|
-
.call(xAxis)
|
44
|
-
.selectAll("text")
|
45
|
-
.style("text-anchor", "end")
|
46
|
-
.attr("dx", "-.8em")
|
47
|
-
.attr("dy", ".15em")
|
48
|
-
.attr("transform", function(d) {
|
49
|
-
return "rotate(-65)"
|
50
|
-
});
|
51
|
-
|
52
|
-
svg.append("g")
|
53
|
-
.attr("class", "y axis")
|
54
|
-
.call(yAxis)
|
55
|
-
.append("text")
|
56
|
-
.attr("transform", "rotate(-90)")
|
57
|
-
.attr("y", -40)
|
58
|
-
.attr("x", -80)
|
59
|
-
.attr("dy", "0.71em")
|
60
|
-
.style("text-anchor", "end")
|
61
|
-
.text("Page Views");
|
62
|
-
|
63
|
-
svg.selectAll(".bar")
|
64
|
-
.data(data)
|
65
|
-
.enter().append("rect")
|
66
|
-
.attr("class", "bar")
|
67
|
-
.attr("x", function(d) { return x(d.user); })
|
68
|
-
.attr("width", x.rangeBand())
|
69
|
-
.attr("y", function(d) { return y(d.count); })
|
70
|
-
.attr("height", function(d) { return height - y(d.count); })
|
71
|
-
.on('mouseover', tip.show)
|
72
|
-
.on('mouseout', tip.hide);
|
3
|
+
barTip({
|
4
|
+
selector: 'div#userViewsCount',
|
5
|
+
data: data,
|
6
|
+
width: 960,
|
7
|
+
height: 360,
|
8
|
+
margin: {top: 40, right: 20, bottom: 100, left:40},
|
9
|
+
flexRight: true,
|
10
|
+
labelAngle: -60,
|
11
|
+
xDomain: 'user',
|
12
|
+
yDomain: 'count',
|
13
|
+
yAxisText: 'Page Views',
|
14
|
+
tipLabel: '',
|
15
|
+
tipValue: 'count',
|
16
|
+
tipText: 'Page views'
|
17
|
+
});
|