Skip to content

Commit 42bfe3d

Browse files
committed
Merge branch 'develop' of github.com:modularcode/modular-admin-free-dashboard-theme-html into develop
2 parents 50c9cde + 7ad8fea commit 42bfe3d

2 files changed

Lines changed: 53 additions & 36 deletions

File tree

src/app/dashboard/items/items.js

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,41 @@
11
$(function() {
2-
$(".dashboard-page .items .sparkline").each(function() {
3-
var type = $(this).data('type');
2+
43

5-
// There is predefined data
6-
if ($(this).data('data')) {
7-
var data = $(this).data('data').split(',').map(function(item) {
8-
if (item.indexOf(":") > 0) {
9-
return item.split(":");
10-
}
11-
else {
12-
return item;
4+
function drawDashboardItemsListSparklines(){
5+
$(".dashboard-page .items .sparkline").each(function() {
6+
var type = $(this).data('type');
7+
8+
// There is predefined data
9+
if ($(this).data('data')) {
10+
var data = $(this).data('data').split(',').map(function(item) {
11+
if (item.indexOf(":") > 0) {
12+
return item.split(":");
13+
}
14+
else {
15+
return item;
16+
}
17+
});
18+
}
19+
// Generate random data
20+
else {
21+
var data = [];
22+
for (var i = 0; i < 17; i++) {
23+
data.push(Math.round(100 * Math.random()));
1324
}
14-
});
15-
}
16-
// Generate random data
17-
else {
18-
var data = [];
19-
for (var i = 0; i < 17; i++) {
20-
data.push(Math.round(100 * Math.random()));
2125
}
22-
}
2326

2427

25-
$(this).sparkline(data, {
26-
barColor: config.colorPrimary.toString(),
27-
height: $(this).height(),
28-
type: type
28+
$(this).sparkline(data, {
29+
barColor: config.colorPrimary.toString(),
30+
height: $(this).height(),
31+
type: type
32+
});
2933
});
30-
});
34+
}
35+
36+
drawDashboardItemsListSparklines();
37+
38+
watch(config, "colorPrimary", function(){
39+
drawDashboardItemsListSparklines();
40+
});
3141
});

src/app/items/list/items-list.js

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,28 @@ $(function() {
1717
});
1818

1919

20+
function drawItemsListSparklines(){
21+
$(".items-list-page .sparkline").each(function() {
22+
var type = $(this).data('type');
23+
24+
// Generate random data
25+
var data = [];
26+
for (var i = 0; i < 17; i++) {
27+
data.push(Math.round(100 * Math.random()));
28+
}
29+
30+
$(this).sparkline(data, {
31+
barColor: config.colorPrimary.toString(),
32+
height: $(this).height(),
33+
type: type
34+
});
35+
});
36+
}
2037

21-
$(".items-list-page .sparkline").each(function() {
22-
var type = $(this).data('type');
23-
24-
// Generate random data
25-
var data = [];
26-
for (var i = 0; i < 17; i++) {
27-
data.push(Math.round(100 * Math.random()));
28-
}
38+
drawItemsListSparklines();
2939

30-
$(this).sparkline(data, {
31-
barColor: config.colorPrimary.toString(),
32-
height: $(this).height(),
33-
type: type
34-
});
40+
watch(config, "colorPrimary", function(){
41+
drawItemsListSparklines();
3542
});
3643

3744
});

0 commit comments

Comments
 (0)