changed miner blocks from ng-repeat to directive
This commit is contained in:
parent
cec0a5388e
commit
19ab043a81
2
dist/index.html
vendored
2
dist/index.html
vendored
File diff suppressed because one or more lines are too long
2
dist/js/netstats.min.js
vendored
2
dist/js/netstats.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/js/netstats.min.js.map
vendored
2
dist/js/netstats.min.js.map
vendored
File diff suppressed because one or more lines are too long
@ -50,6 +50,46 @@ angular.module('netStatsApp.directives', [])
|
||||
// };
|
||||
// }])
|
||||
|
||||
.directive('minerblock', function ($compile) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
template: '<div></div>',
|
||||
replace: true,
|
||||
link: function (scope, element, attrs)
|
||||
{
|
||||
var makeClass = function (value)
|
||||
{
|
||||
if(value <= 6)
|
||||
return 'success';
|
||||
|
||||
if(value <= 12)
|
||||
return 'info';
|
||||
|
||||
if(value <= 18)
|
||||
return 'warning';
|
||||
|
||||
if(value <= 24)
|
||||
return 'orange';
|
||||
|
||||
return 'danger';
|
||||
}
|
||||
|
||||
attrs.$observe("blocks", function (newValue)
|
||||
{
|
||||
var content = '';
|
||||
var blockClass = 'bg-' + makeClass(newValue);
|
||||
|
||||
for(var i = 0; i < newValue; i++)
|
||||
{
|
||||
content += '<div class="block ' + blockClass + '"></div>';
|
||||
}
|
||||
|
||||
element.empty();
|
||||
element.html(content);
|
||||
});
|
||||
}
|
||||
};
|
||||
})
|
||||
.directive('sparkchart', function () {
|
||||
return {
|
||||
restrict: 'E',
|
||||
|
@ -113,10 +113,10 @@ block content
|
||||
div.col-xs-3.stat-holder.pull-right
|
||||
div.big-info.chart.double-chart
|
||||
span.small-title last blocks miners
|
||||
div.blocks-holder(ng-repeat='miner in miners track by miner.miner', data-toggle="tooltip", data-placement="right", title="{{miner.blocks}}")
|
||||
div.blocks-holder(ng-repeat='miner in miners track by miner.miner', data-toggle="tooltip", data-placement="right", data-original-title="{{miner.blocks}}")
|
||||
div.block-count(class="{{miner.blocks | minerBlocksClass : 'text-'}}") {{miner.blocks}}
|
||||
div.small-title-miner {{miner.miner | minerNameFilter : miner.name}}
|
||||
div.block(ng-repeat="i in getNumber(miner.blocks) track by $index", class="{{miner.blocks | minerBlocksClass}}")
|
||||
minerblock(blocks="{{miner.blocks}}")
|
||||
div.clearfix
|
||||
|
||||
div.col-xs-3.stat-holder
|
||||
|
Loading…
Reference in New Issue
Block a user