mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-06 06:25:00 -04:00
major CSS overhaul to try to make things look a bit cleaner
This commit is contained in:
parent
303b455965
commit
b765dc005b
11 changed files with 302 additions and 104 deletions
69
syweb/webclient/js/angular-peity.js
vendored
Normal file
69
syweb/webclient/js/angular-peity.js
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
var angularPeity = angular.module( 'angular-peity', [] );
|
||||
|
||||
$.fn.peity.defaults.pie = {
|
||||
fill: ["#ff0000", "#aaaaaa"],
|
||||
radius: 4,
|
||||
}
|
||||
|
||||
var buildChartDirective = function ( chartType ) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
data: "=",
|
||||
options: "="
|
||||
},
|
||||
link: function ( scope, element, attrs ) {
|
||||
|
||||
var options = {};
|
||||
if ( scope.options ) {
|
||||
options = scope.options;
|
||||
}
|
||||
|
||||
// N.B. live-binding to data by Matthew
|
||||
scope.$watch('data', function () {
|
||||
var span = document.createElement( 'span' );
|
||||
span.textContent = scope.data.join();
|
||||
|
||||
if ( !attrs.class ) {
|
||||
span.className = "";
|
||||
} else {
|
||||
span.className = attrs.class;
|
||||
}
|
||||
|
||||
if (element[0].nodeType === 8) {
|
||||
element.replaceWith( span );
|
||||
}
|
||||
else if (element[0].firstChild) {
|
||||
element.empty();
|
||||
element[0].appendChild( span );
|
||||
}
|
||||
else {
|
||||
element[0].appendChild( span );
|
||||
}
|
||||
|
||||
jQuery( span ).peity( chartType, options );
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
angularPeity.directive( 'pieChart', function () {
|
||||
|
||||
return buildChartDirective( "pie" );
|
||||
|
||||
} );
|
||||
|
||||
|
||||
angularPeity.directive( 'barChart', function () {
|
||||
|
||||
return buildChartDirective( "bar" );
|
||||
|
||||
} );
|
||||
|
||||
|
||||
angularPeity.directive( 'lineChart', function () {
|
||||
|
||||
return buildChartDirective( "line" );
|
||||
|
||||
} );
|
Loading…
Add table
Add a link
Reference in a new issue