base commit
This commit is contained in:
1 parent
69eddd4b5b
commit
c0728badef
162 files changed
+43597
No files matched your search
@@ -0,0 +1,194 @@
|
||||
/*
|
||||
Document: base_forms_validation.js
|
||||
Author: Rustheme
|
||||
Description: Custom JS code used in Form Validation Page
|
||||
*/
|
||||
|
||||
var BaseFormValidation = function() {
|
||||
// Init Bootstrap Forms Validation: https://github.com/jzaefferer/jquery-validation
|
||||
var initValidationBootstrap = function() {
|
||||
jQuery( '.js-validation-bootstrap' ).validate({
|
||||
errorClass: 'help-block animated fadeInDown',
|
||||
errorElement: 'div',
|
||||
errorPlacement: function( error, e ) {
|
||||
jQuery(e).parents( '.form-group > div' ).append( error );
|
||||
},
|
||||
highlight: function(e) {
|
||||
jQuery(e).closest( '.form-group' ).removeClass( 'has-error' ).addClass( 'has-error' );
|
||||
jQuery(e).closest( '.help-block' ).remove();
|
||||
},
|
||||
success: function(e) {
|
||||
jQuery(e).closest( '.form-group' ).removeClass( 'has-error' );
|
||||
jQuery(e).closest( '.help-block' ).remove();
|
||||
},
|
||||
rules: {
|
||||
'val-username': {
|
||||
required: true,
|
||||
minlength: 3
|
||||
},
|
||||
'val-email': {
|
||||
required: true,
|
||||
email: true
|
||||
},
|
||||
'val-password': {
|
||||
required: true,
|
||||
minlength: 5
|
||||
},
|
||||
'val-confirm-password': {
|
||||
required: true,
|
||||
equalTo: '#val-password'
|
||||
},
|
||||
'val-suggestions': {
|
||||
required: true,
|
||||
minlength: 5
|
||||
},
|
||||
'val-skill': {
|
||||
required: true
|
||||
},
|
||||
'val-website': {
|
||||
required: true,
|
||||
url: true
|
||||
},
|
||||
'val-digits': {
|
||||
required: true,
|
||||
digits: true
|
||||
},
|
||||
'val-number': {
|
||||
required: true,
|
||||
number: true
|
||||
},
|
||||
'val-range': {
|
||||
required: true,
|
||||
range: [1, 5]
|
||||
},
|
||||
'val-terms': {
|
||||
required: true
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
'val-username': {
|
||||
required: 'Please enter a username',
|
||||
minlength: 'Your username must consist of at least 3 characters'
|
||||
},
|
||||
'val-email': 'Please enter a valid email address',
|
||||
'val-password': {
|
||||
required: 'Please provide a password',
|
||||
minlength: 'Your password must be at least 5 characters long'
|
||||
},
|
||||
'val-confirm-password': {
|
||||
required: 'Please confirm a password',
|
||||
minlength: 'Your password must be at least 5 characters long',
|
||||
equalTo: 'Please enter the same password as above'
|
||||
},
|
||||
'val-suggestions': 'What can we do to become better?',
|
||||
'val-skill': 'Please select a skill!',
|
||||
'val-website': 'Please enter url!',
|
||||
'val-digits': 'Please enter only digits!',
|
||||
'val-number': 'Please enter a number!',
|
||||
'val-range': 'Please enter a number between 1 and 5!',
|
||||
'val-terms': 'You must agree to the service terms!'
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Init Material Forms Validation: https://github.com/jzaefferer/jquery-validation
|
||||
var initValidationMaterial = function() {
|
||||
jQuery( '.js-validation-material' ).validate({
|
||||
errorClass: 'help-block text-right animated fadeInDown',
|
||||
errorElement: 'div',
|
||||
errorPlacement: function(error, e) {
|
||||
jQuery(e).parents( '.form-group .form-material' ).append( error );
|
||||
},
|
||||
highlight: function(e) {
|
||||
jQuery(e).closest( '.form-group' ).removeClass( 'has-error' ).addClass( 'has-error' );
|
||||
jQuery(e).closest( '.help-block' ).remove();
|
||||
},
|
||||
success: function(e) {
|
||||
jQuery(e).closest( '.form-group' ).removeClass( 'has-error' );
|
||||
jQuery(e).closest( '.help-block' ).remove();
|
||||
},
|
||||
rules: {
|
||||
'val-username2': {
|
||||
required: true,
|
||||
minlength: 3
|
||||
},
|
||||
'val-email2': {
|
||||
required: true,
|
||||
email: true
|
||||
},
|
||||
'val-password2': {
|
||||
required: true,
|
||||
minlength: 5
|
||||
},
|
||||
'val-confirm-password2': {
|
||||
required: true,
|
||||
equalTo: '#val-password2'
|
||||
},
|
||||
'val-suggestions2': {
|
||||
required: true,
|
||||
minlength: 5
|
||||
},
|
||||
'val-skill2': {
|
||||
required: true
|
||||
},
|
||||
'val-website2': {
|
||||
required: true,
|
||||
url: true
|
||||
},
|
||||
'val-digits2': {
|
||||
required: true,
|
||||
digits: true
|
||||
},
|
||||
'val-number2': {
|
||||
required: true,
|
||||
number: true
|
||||
},
|
||||
'val-range2': {
|
||||
required: true,
|
||||
range: [1, 5]
|
||||
},
|
||||
'val-terms2': {
|
||||
required: true
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
'val-username2': {
|
||||
required: 'Please enter a username',
|
||||
minlength: 'Your username must consist of at least 3 characters'
|
||||
},
|
||||
'val-email2': 'Please enter a valid email address',
|
||||
'val-password2': {
|
||||
required: 'Please provide a password',
|
||||
minlength: 'Your password must be at least 5 characters long'
|
||||
},
|
||||
'val-confirm-password2': {
|
||||
required: 'Please provide a password',
|
||||
minlength: 'Your password must be at least 5 characters long',
|
||||
equalTo: 'Please enter the same password as above'
|
||||
},
|
||||
'val-suggestions2': 'What can we do to become better?',
|
||||
'val-skill2': 'Please select a skill!',
|
||||
'val-website2': 'Please enter url!',
|
||||
'val-digits2': 'Please enter only digits!',
|
||||
'val-number2': 'Please enter a number!',
|
||||
'val-range2': 'Please enter a number between 1 and 5!',
|
||||
'val-terms2': 'You must agree to the service terms!'
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
init: function () {
|
||||
// Init Bootstrap Forms Validation
|
||||
initValidationBootstrap();
|
||||
|
||||
// Init Meterial Forms Validation
|
||||
initValidationMaterial();
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
// Initialize when page loads
|
||||
jQuery( function() {
|
||||
BaseFormValidation.init();
|
||||
});
|
||||
@@ -0,0 +1,266 @@
|
||||
/*
|
||||
Document: base_forms_wizard.js
|
||||
Author: Rustheme
|
||||
Description: Custom JS code used in Form Wizard Page
|
||||
*/
|
||||
|
||||
var BaseFormWizard = function() {
|
||||
// Init simple wizard: http://vadimg.com/twitter-bootstrap-wizard-example/
|
||||
var initWizardSimple = function() {
|
||||
jQuery( '.js-wizard-simple' ).bootstrapWizard({
|
||||
'tabClass': '',
|
||||
'firstSelector': '.wizard-first',
|
||||
'previousSelector': '.wizard-prev',
|
||||
'nextSelector': '.wizard-next',
|
||||
'lastSelector': '.wizard-last',
|
||||
'onTabShow': function( $tab, $navigation, $index ) {
|
||||
var $total = $navigation.find( 'li' ).length,
|
||||
$current = $index + 1,
|
||||
$percent = ( $current/$total ) * 100,
|
||||
|
||||
// Get core wizard elements
|
||||
$wizard = $navigation.parents( '.card' ),
|
||||
$progress = $wizard.find( '.wizard-progress > .progress-bar' ),
|
||||
$btnPrev = $wizard.find( '.wizard-prev' ),
|
||||
$btnNext = $wizard.find( '.wizard-next' ),
|
||||
$btnFinish = $wizard.find( '.wizard-finish' );
|
||||
|
||||
// Update progress bar if there is one
|
||||
if ( $progress ) {
|
||||
$progress.css({ width: $percent + '%' });
|
||||
}
|
||||
|
||||
// If it's the last tab then hide the last button and show the finish instead
|
||||
if ( $current >= $total ) {
|
||||
$btnNext.hide();
|
||||
$btnFinish.show();
|
||||
} else {
|
||||
$btnNext.show();
|
||||
$btnFinish.hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Init wizards with validation: http://vadimg.com/twitter-bootstrap-wizard-example/
|
||||
var initWizardValidation = function() {
|
||||
// Get forms
|
||||
var $form1 = jQuery( '.js-form1' );
|
||||
var $form2 = jQuery( '.js-form2' );
|
||||
|
||||
// Prevent forms from submitting on enter key press
|
||||
$form1.add( $form2 ).on( 'keyup keypress', function (e) {
|
||||
var code = e.keyCode || e.which;
|
||||
|
||||
if ( code === 13 ) {
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// Init form validation on classic wizard form
|
||||
var $validator1 = $form1.validate({
|
||||
errorClass: 'help-block animated fadeInDown',
|
||||
errorElement: 'div',
|
||||
errorPlacement: function( error, e ) {
|
||||
jQuery(e).parents( '.form-group > div' ).append( error );
|
||||
},
|
||||
highlight: function(e) {
|
||||
jQuery(e).closest( '.form-group' ).removeClass( 'has-error' ).addClass( 'has-error' );
|
||||
jQuery(e).closest( '.help-block' ).remove();
|
||||
},
|
||||
success: function(e) {
|
||||
jQuery(e).closest( '.form-group' ).removeClass( 'has-error' );
|
||||
jQuery(e).closest( '.help-block' ).remove();
|
||||
},
|
||||
rules: {
|
||||
'validation-classic-firstname': {
|
||||
required: true,
|
||||
minlength: 2
|
||||
},
|
||||
'validation-classic-lastname': {
|
||||
required: true,
|
||||
minlength: 2
|
||||
},
|
||||
'validation-classic-email': {
|
||||
required: true,
|
||||
email: true
|
||||
},
|
||||
'validation-classic-details': {
|
||||
required: true,
|
||||
minlength: 5
|
||||
},
|
||||
'validation-classic-city': {
|
||||
required: true
|
||||
},
|
||||
'validation-classic-skills': {
|
||||
required: true
|
||||
},
|
||||
'validation-classic-terms': {
|
||||
required: true
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
'validation-classic-firstname': {
|
||||
required: 'Please enter a firstname',
|
||||
minlength: 'Your firtname must consist of at least 2 characters'
|
||||
},
|
||||
'validation-classic-lastname': {
|
||||
required: 'Please enter a lastname',
|
||||
minlength: 'Your lastname must consist of at least 2 characters'
|
||||
},
|
||||
'validation-classic-email': 'Please enter a valid email address',
|
||||
'validation-classic-details': 'Let us know a few thing about you',
|
||||
'validation-classic-skills': 'Please select a skill!',
|
||||
'validation-classic-terms': 'You must agree with the service terms!'
|
||||
}
|
||||
});
|
||||
|
||||
// Init form validation on the other wizard form
|
||||
var $validator2 = $form2.validate({
|
||||
errorClass: 'help-block text-right animated fadeInDown',
|
||||
errorElement: 'div',
|
||||
errorPlacement: function(error, e) {
|
||||
jQuery(e).parents( '.form-group .form-material' ).append(error);
|
||||
},
|
||||
highlight: function(e) {
|
||||
jQuery(e).closest( '.form-group' ).removeClass( 'has-error' ).addClass( 'has-error' );
|
||||
jQuery(e).closest( '.help-block' ).remove();
|
||||
},
|
||||
success: function(e) {
|
||||
jQuery(e).closest( '.form-group' ).removeClass( 'has-error' );
|
||||
jQuery(e).closest( '.help-block' ).remove();
|
||||
},
|
||||
rules: {
|
||||
'validation-firstname': {
|
||||
required: true,
|
||||
minlength: 2
|
||||
},
|
||||
'validation-lastname': {
|
||||
required: true,
|
||||
minlength: 2
|
||||
},
|
||||
'validation-email': {
|
||||
required: true,
|
||||
email: true
|
||||
},
|
||||
'validation-details': {
|
||||
required: true,
|
||||
minlength: 5
|
||||
},
|
||||
'validation-city': {
|
||||
required: true
|
||||
},
|
||||
'validation-skills': {
|
||||
required: true
|
||||
},
|
||||
'validation-terms': {
|
||||
required: true
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
'validation-firstname': {
|
||||
required: 'Please enter a firstname',
|
||||
minlength: 'Your firtname must consist of at least 2 characters'
|
||||
},
|
||||
'validation-lastname': {
|
||||
required: 'Please enter a lastname',
|
||||
minlength: 'Your lastname must consist of at least 2 characters'
|
||||
},
|
||||
'validation-email': 'Please enter a valid email address',
|
||||
'validation-details': 'Let us know a few thing about you',
|
||||
'validation-skills': 'Please select a skill!',
|
||||
'validation-terms': 'You must agree with the service terms!'
|
||||
}
|
||||
});
|
||||
|
||||
// Init classic wizard with validation
|
||||
jQuery( '.js-wizard-classic-validation' ).bootstrapWizard({
|
||||
'tabClass': '',
|
||||
'previousSelector': '.wizard-prev',
|
||||
'nextSelector': '.wizard-next',
|
||||
'onTabShow': function( $tab, $nav, $index ) {
|
||||
var $total = $nav.find( 'li' ).length;
|
||||
var $current = $index + 1;
|
||||
|
||||
// Get core wizard elements
|
||||
var $wizard = $nav.parents( '.card' );
|
||||
var $btnNext = $wizard.find( '.wizard-next' );
|
||||
var $btnFinish = $wizard.find( '.wizard-finish' );
|
||||
|
||||
// If it's the last tab then hide the last button and show the finish instead
|
||||
if ( $current >= $total ) {
|
||||
$btnNext.hide();
|
||||
$btnFinish.show();
|
||||
} else {
|
||||
$btnNext.show();
|
||||
$btnFinish.hide();
|
||||
}
|
||||
},
|
||||
'onNext': function( $tab, $navigation, $index ) {
|
||||
var $valid = $form1.valid();
|
||||
|
||||
if(!$valid) {
|
||||
$validator1.focusInvalid();
|
||||
|
||||
return false;
|
||||
}
|
||||
},
|
||||
onTabClick: function( $tab, $navigation, $index ) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// Init wizard with validation
|
||||
jQuery( '.js-wizard-validation' ).bootstrapWizard({
|
||||
'tabClass': '',
|
||||
'previousSelector': '.wizard-prev',
|
||||
'nextSelector': '.wizard-next',
|
||||
'onTabShow': function( $tab, $nav, $index ) {
|
||||
var $total = $nav.find( 'li' ).length;
|
||||
var $current = $index + 1;
|
||||
|
||||
// Get core wizard elements
|
||||
var $wizard = $nav.parents( '.card' ),
|
||||
$btnNext = $wizard.find( '.wizard-next' ),
|
||||
$btnFinish = $wizard.find( '.wizard-finish' );
|
||||
|
||||
// If it's the last tab then hide the last button and show the finish instead
|
||||
if ( $current >= $total ) {
|
||||
$btnNext.hide();
|
||||
$btnFinish.show();
|
||||
} else {
|
||||
$btnNext.show();
|
||||
$btnFinish.hide();
|
||||
}
|
||||
},
|
||||
'onNext': function( $tab, $navigation, $index ) {
|
||||
var $valid = $form2.valid();
|
||||
|
||||
if ( ! $valid ) {
|
||||
$validator2.focusInvalid();
|
||||
|
||||
return false;
|
||||
}
|
||||
},
|
||||
onTabClick: function( $tab, $navigation, $index ) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
init: function () {
|
||||
// Init simple wizard
|
||||
initWizardSimple();
|
||||
|
||||
// Init wizards with validation
|
||||
initWizardValidation();
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
// Initialize when page loads
|
||||
jQuery( function() {
|
||||
BaseFormWizard.init();
|
||||
});
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
Document: base_js_charts_chartjs.js
|
||||
Author: Rustheme
|
||||
Description: Custom JS code used in Charts Chart.js Page
|
||||
*/
|
||||
|
||||
var BaseJsCharts = function() {
|
||||
// Chart.js Charts: http://www.chartjs.org/docs
|
||||
var initChartsChartJS = function() {
|
||||
|
||||
// Get Chart Containers
|
||||
var $chartLinesCnt = jQuery( '.js-chartjs-lines' )[0].getContext( '2d' ),
|
||||
$chartBarsCnt = jQuery( '.js-chartjs-bars' )[0].getContext( '2d' ),
|
||||
$chartRadarCnt = jQuery( '.js-chartjs-radar' )[0].getContext( '2d' ),
|
||||
$chartPolarCnt = jQuery( '.js-chartjs-polar' )[0].getContext( '2d' ),
|
||||
$chartPieCnt = jQuery( '.js-chartjs-pie' )[0].getContext( '2d' ),
|
||||
$chartDonutCnt = jQuery( '.js-chartjs-donut' )[0].getContext( '2d' );
|
||||
|
||||
// Set global chart options
|
||||
var $globalOptions = {
|
||||
scaleFontFamily: 'Roboto, Arial, sans-serif',
|
||||
scaleFontColor: App.colors.text_muted,
|
||||
scaleFontStyle: '500',
|
||||
tooltipTitleFontFamily: 'Roboto, Arial, sans-serif',
|
||||
tooltipCornerRadius: 2,
|
||||
maintainAspectRatio: false,
|
||||
responsive: true,
|
||||
animation: false,
|
||||
};
|
||||
|
||||
// Lines/Bar/Radar Chart Data
|
||||
var $chartLinesBarsRadarData = {
|
||||
labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
||||
datasets: [{
|
||||
label: 'Last Week',
|
||||
fillColor: App.hexToRgba( App.colors.blue, 20 ),
|
||||
strokeColor: App.hexToRgba( App.colors.blue, 40 ),
|
||||
pointColor: App.hexToRgba( App.colors.blue, 40 ),
|
||||
pointStrokeColor: '#fff',
|
||||
data: [30, 32, 40, 45, 43, 38, 55]
|
||||
}, {
|
||||
label: 'This Week',
|
||||
fillColor: App.hexToRgba( App.colors.blue, 70 ),
|
||||
strokeColor: App.colors.blue,
|
||||
pointColor: App.colors.blue,
|
||||
pointStrokeColor: '#fff',
|
||||
data: [15, 16, 20, 25, 23, 25, 32]
|
||||
}]
|
||||
};
|
||||
|
||||
// Polar/Pie/Donut Data
|
||||
var $chartPolarPieDonutData = [{
|
||||
value: 56,
|
||||
color: App.colors.green,
|
||||
highlight: App.hexToRgba( App.colors.green, 70 ),
|
||||
label: 'Companies'
|
||||
}, {
|
||||
value: 22,
|
||||
color: App.colors.orange,
|
||||
highlight: App.hexToRgba( App.colors.orange, 50 ),
|
||||
label: 'Users'
|
||||
}, {
|
||||
value: 22,
|
||||
color: App.colors.blue,
|
||||
highlight: App.hexToRgba( App.colors.blue, 70 ),
|
||||
label: 'Revenue'
|
||||
}];
|
||||
|
||||
// Init Charts
|
||||
$chartLines = new Chart( $chartLinesCnt ).Line( $chartLinesBarsRadarData, $globalOptions );
|
||||
$chartBars = new Chart( $chartBarsCnt ).Bar( $chartLinesBarsRadarData, $globalOptions );
|
||||
$chartRadar = new Chart( $chartRadarCnt ).Radar( $chartLinesBarsRadarData, $globalOptions );
|
||||
$chartPolar = new Chart( $chartPolarCnt ).PolarArea( $chartPolarPieDonutData, $globalOptions );
|
||||
$chartPie = new Chart( $chartPieCnt ).Pie( $chartPolarPieDonutData, $globalOptions );
|
||||
$chartDonut = new Chart( $chartDonutCnt ).Doughnut( $chartPolarPieDonutData, $globalOptions );
|
||||
};
|
||||
|
||||
return {
|
||||
init: function() {
|
||||
// Init charts
|
||||
initChartsChartJS();
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
// Initialize when page loads
|
||||
jQuery( function() {
|
||||
BaseJsCharts.init();
|
||||
});
|
||||
@@ -0,0 +1,451 @@
|
||||
/*
|
||||
Document: base_js_charts_flot.js
|
||||
Author: Rustheme
|
||||
Description: Custom JS code used in Charts Flot Page
|
||||
*/
|
||||
|
||||
var BaseJsCharts = function() {
|
||||
|
||||
// Flot charts: http://www.flotcharts.org/flot/examples/
|
||||
var initChartsFlot = function() {
|
||||
// Get the elements where we will attach the charts
|
||||
var $flotLines = jQuery( '.js-flot-lines' );
|
||||
var $flotStacked = jQuery( '.js-flot-stacked' );
|
||||
var $flotLive = jQuery( '.js-flot-live' );
|
||||
var $flotPie = jQuery( '.js-flot-pie' );
|
||||
var $flotBars = jQuery( '.js-flot-bars' );
|
||||
|
||||
// Demo Data (Shared between Lines, Stacked and Pie charts)
|
||||
var $dataCompanies = [
|
||||
[1, 2500],
|
||||
[2, 2300],
|
||||
[3, 3200],
|
||||
[4, 2500],
|
||||
[5, 4200],
|
||||
[6, 2400],
|
||||
[7, 3900],
|
||||
[8, 2700],
|
||||
[9, 3400],
|
||||
[10, 2200],
|
||||
[11, 3800],
|
||||
[12, 2700]
|
||||
];
|
||||
|
||||
var $dataRevenue = [
|
||||
[1, 100],
|
||||
[2, 800],
|
||||
[3, 1300],
|
||||
[4, 750],
|
||||
[5, 1700],
|
||||
[6, 650],
|
||||
[7, 800],
|
||||
[8, 950],
|
||||
[9, 2600],
|
||||
[10, 1600],
|
||||
[11, 750],
|
||||
[12, 700]
|
||||
];
|
||||
|
||||
var $dataUsers = [
|
||||
[1, 1100],
|
||||
[2, 700],
|
||||
[3, 1300],
|
||||
[4, 900],
|
||||
[5, 1700],
|
||||
[6, 950],
|
||||
[7, 1700],
|
||||
[8, 1250],
|
||||
[9, 1800],
|
||||
[10, 1300],
|
||||
[11, 2750],
|
||||
[12, 1400]
|
||||
];
|
||||
|
||||
var $dataMonths = [
|
||||
[1, 'Jan'],
|
||||
[2, 'Feb'],
|
||||
[3, 'Mar'],
|
||||
[4, 'Apr'],
|
||||
[5, 'May'],
|
||||
[6, 'Jun'],
|
||||
[7, 'Jul'],
|
||||
[8, 'Aug'],
|
||||
[9, 'Sep'],
|
||||
[10, 'Oct'],
|
||||
[11, 'Nov'],
|
||||
[12, 'Dec']
|
||||
];
|
||||
|
||||
// Init Lines chart
|
||||
jQuery.plot( $flotLines, [{
|
||||
label: 'Companies',
|
||||
data: $dataCompanies,
|
||||
shadowSize: 0,
|
||||
lines: {
|
||||
show: true,
|
||||
fill: false,
|
||||
fillColor: {
|
||||
colors: [{
|
||||
opacity: 1
|
||||
}, {
|
||||
opacity: 1
|
||||
}]
|
||||
},
|
||||
},
|
||||
points: {
|
||||
show: true,
|
||||
radius: 4
|
||||
}
|
||||
}, {
|
||||
label: 'Users',
|
||||
data: $dataUsers,
|
||||
shadowSize: 0,
|
||||
lines: {
|
||||
show: true,
|
||||
fill: false,
|
||||
fillColor: {
|
||||
colors: [{
|
||||
opacity: 1
|
||||
}, {
|
||||
opacity: 1
|
||||
}]
|
||||
}
|
||||
},
|
||||
points: {
|
||||
show: true,
|
||||
radius: 4
|
||||
}
|
||||
}], {
|
||||
colors: [
|
||||
App.colors.blue,
|
||||
App.colors.green
|
||||
],
|
||||
legend: {
|
||||
show: true,
|
||||
noColumns: 2,
|
||||
position: 'nw',
|
||||
backgroundOpacity: 0
|
||||
},
|
||||
grid: {
|
||||
borderWidth: 0,
|
||||
hoverable: true,
|
||||
clickable: true
|
||||
},
|
||||
yaxis: {
|
||||
tickColor: '#fff',
|
||||
ticks: 3
|
||||
},
|
||||
xaxis: {
|
||||
ticks: $dataMonths,
|
||||
tickColor: '#f5f5f5'
|
||||
}
|
||||
});
|
||||
|
||||
// Creating and attaching a tooltip to the classic chart
|
||||
var previousPoint = null,
|
||||
ttlabel = null;
|
||||
$flotLines.bind( 'plothover', function( event, pos, item ) {
|
||||
if ( item) {
|
||||
if ( previousPoint !== item.dataIndex ) {
|
||||
previousPoint = item.dataIndex;
|
||||
|
||||
jQuery( '.js-flot-tooltip' ).remove();
|
||||
var x = item.datapoint[0],
|
||||
y = item.datapoint[1];
|
||||
|
||||
if ( item.seriesIndex === 0 ) {
|
||||
ttlabel = '$ <strong>' + y + '</strong>';
|
||||
} else if ( item.seriesIndex === 1) {
|
||||
ttlabel = '<strong>' + y + '</strong> Users';
|
||||
} else {
|
||||
ttlabel = '<strong>' + y + '</strong> Revenue';
|
||||
}
|
||||
|
||||
jQuery( '<div class="js-flot-tooltip flot-tooltip">' + ttlabel + '</div>' )
|
||||
.css({
|
||||
top: item.pageY - 45,
|
||||
left: item.pageX + 5
|
||||
}).appendTo( 'body' ).show();
|
||||
}
|
||||
} else {
|
||||
jQuery( '.js-flot-tooltip' ).remove();
|
||||
previousPoint = null;
|
||||
}
|
||||
});
|
||||
|
||||
// Stacked Chart
|
||||
/////////////////
|
||||
|
||||
jQuery.plot( $flotStacked, [{
|
||||
label: 'Users',
|
||||
data: $dataUsers
|
||||
}, {
|
||||
label: 'Companies',
|
||||
data: $dataCompanies
|
||||
}, {
|
||||
label: 'Revenue',
|
||||
data: $dataRevenue
|
||||
}], {
|
||||
colors: [App.colors.blue, App.colors.green, App.colors.purple],
|
||||
series: {
|
||||
stack: true,
|
||||
lines: {
|
||||
show: true,
|
||||
fill: true
|
||||
}
|
||||
},
|
||||
lines: {
|
||||
show: true,
|
||||
lineWidth: 0,
|
||||
fill: true,
|
||||
fillColor: {
|
||||
colors: [{
|
||||
opacity: .7
|
||||
}, {
|
||||
opacity: .6
|
||||
}, {
|
||||
opacity: .5
|
||||
}]
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
show: true,
|
||||
noColumns: 3,
|
||||
position: 'nw',
|
||||
sorted: true,
|
||||
backgroundOpacity: 0
|
||||
},
|
||||
grid: {
|
||||
borderWidth: 0
|
||||
},
|
||||
yaxis: {
|
||||
tickColor: '#f5f5f5',
|
||||
ticks: 3
|
||||
},
|
||||
xaxis: {
|
||||
ticks: $dataMonths,
|
||||
tickColor: 'transparent'
|
||||
}
|
||||
});
|
||||
|
||||
// Live Chart
|
||||
/////////////////
|
||||
|
||||
var $dataLive = [];
|
||||
|
||||
// Generate random data
|
||||
function getRandomData() {
|
||||
|
||||
if ( $dataLive.length > 0 )
|
||||
$dataLive = $dataLive.slice( 1 );
|
||||
|
||||
while ( $dataLive.length < 300 ) {
|
||||
var prev = $dataLive.length > 0 ? $dataLive[$dataLive.length - 1] : 50;
|
||||
var y = prev + Math.random() * 10 - 5;
|
||||
if ( y < 0 )
|
||||
y = 0;
|
||||
if ( y > 100 )
|
||||
y = 100;
|
||||
$dataLive.push( y );
|
||||
}
|
||||
|
||||
var res = [];
|
||||
for ( var i = 0; i < $dataLive.length; ++i )
|
||||
res.push([i, $dataLive[i]]);
|
||||
|
||||
// Show live chart info
|
||||
jQuery( '.js-flot-live-info' ).html( y.toFixed( 0 ) + '%' );
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
// Update live chart
|
||||
function updateChartLive() {
|
||||
$chartLive.setData( [getRandomData()] );
|
||||
$chartLive.draw();
|
||||
setTimeout( updateChartLive, 70 );
|
||||
}
|
||||
|
||||
// Init live chart
|
||||
var $chartLive = jQuery.plot( $flotLive,
|
||||
[{
|
||||
data: getRandomData()
|
||||
}], {
|
||||
series: {
|
||||
shadowSize: 0
|
||||
},
|
||||
lines: {
|
||||
show: true,
|
||||
lineWidth: 2,
|
||||
fill: true,
|
||||
fillColor: {
|
||||
colors: [{
|
||||
opacity: .2
|
||||
}, {
|
||||
opacity: .2
|
||||
}]
|
||||
}
|
||||
},
|
||||
colors: [App.colors.blue],
|
||||
grid: {
|
||||
borderWidth: 0,
|
||||
color: '#f5f5f5',
|
||||
},
|
||||
yaxis: {
|
||||
show: true,
|
||||
min: 0,
|
||||
max: 110
|
||||
},
|
||||
xaxis: {
|
||||
show: false
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Start getting new data
|
||||
updateChartLive();
|
||||
|
||||
// Bars Chart
|
||||
/////////////////
|
||||
|
||||
// Bars Chart Data
|
||||
var $dataUsersBefore = [
|
||||
[1, 500],
|
||||
[4, 390],
|
||||
[7, 700],
|
||||
[10, 600],
|
||||
[13, 800],
|
||||
[16, 1050],
|
||||
[19, 1300],
|
||||
[22, 850],
|
||||
[25, 980],
|
||||
[28, 1000],
|
||||
[31, 1350],
|
||||
[34, 1200]
|
||||
];
|
||||
var $dataUsersAfter = [
|
||||
[2, 650],
|
||||
[5, 600],
|
||||
[8, 1200],
|
||||
[11, 900],
|
||||
[14, 1300],
|
||||
[17, 1150],
|
||||
[20, 1320],
|
||||
[23, 1450],
|
||||
[26, 1300],
|
||||
[29, 1120],
|
||||
[32, 1550],
|
||||
[35, 1100]
|
||||
];
|
||||
|
||||
var $dataMonthsBars = [
|
||||
[2, 'Jan'],
|
||||
[5, 'Feb'],
|
||||
[8, 'Mar'],
|
||||
[11, 'Apr'],
|
||||
[14, 'May'],
|
||||
[17, 'Jun'],
|
||||
[20, 'Jul'],
|
||||
[23, 'Aug'],
|
||||
[26, 'Sep'],
|
||||
[29, 'Oct'],
|
||||
[32, 'Nov'],
|
||||
[35, 'Dec']
|
||||
];
|
||||
|
||||
// Init Bars chart
|
||||
jQuery.plot( $flotBars, [{
|
||||
label: 'Users Before',
|
||||
data: $dataUsersBefore,
|
||||
bars: {
|
||||
show: true,
|
||||
lineWidth: 0,
|
||||
fillColor: {
|
||||
colors: [{
|
||||
opacity: 1
|
||||
}, {
|
||||
opacity: 1
|
||||
}]
|
||||
}
|
||||
}
|
||||
}, {
|
||||
label: 'Users After',
|
||||
data: $dataUsersAfter,
|
||||
bars: {
|
||||
show: true,
|
||||
lineWidth: 0,
|
||||
fillColor: {
|
||||
colors: [{
|
||||
opacity: 1
|
||||
}, {
|
||||
opacity: 1
|
||||
}]
|
||||
}
|
||||
}
|
||||
}], {
|
||||
colors: [App.colors.blue, App.hexToRgba( App.colors.blue, 40 ) ],
|
||||
legend: {
|
||||
show: true,
|
||||
position: 'nw',
|
||||
backgroundOpacity: 0
|
||||
},
|
||||
grid: {
|
||||
borderWidth: 0
|
||||
},
|
||||
yaxis: {
|
||||
ticks: 3,
|
||||
tickColor: '#f5f5f5'
|
||||
},
|
||||
xaxis: {
|
||||
ticks: $dataMonthsBars,
|
||||
tickColor: '#f5f5f5'
|
||||
}
|
||||
});
|
||||
|
||||
// Pie Chart
|
||||
jQuery.plot( $flotPie, [{
|
||||
label: 'Users',
|
||||
data: 22
|
||||
}, {
|
||||
label: 'Revenue',
|
||||
data: 22
|
||||
}, {
|
||||
label: 'Companies',
|
||||
data: 56
|
||||
}], {
|
||||
colors: [App.colors.orange, App.colors.green, App.colors.blue],
|
||||
legend: {
|
||||
show: false
|
||||
},
|
||||
series: {
|
||||
pie: {
|
||||
show: true,
|
||||
radius: 1,
|
||||
label: {
|
||||
show: true,
|
||||
radius: 2 / 3,
|
||||
formatter: function(label, pieSeries) {
|
||||
return '<div class="flot-pie-label">' + label + '<br>' + Math.round( pieSeries.percent ) + '%</div>';
|
||||
},
|
||||
background: {
|
||||
opacity: .75,
|
||||
color: '#000000'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
init: function() {
|
||||
// Init charts
|
||||
initChartsFlot();
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
// Initialize when page loads
|
||||
jQuery( function() {
|
||||
BaseJsCharts.init();
|
||||
});
|
||||
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
Document: base_js_charts_sparkline.js
|
||||
Author: Rustheme
|
||||
Description: Custom JS code used in Charts Sparkline Page
|
||||
*/
|
||||
|
||||
var BaseJsCharts = function() {
|
||||
// jQuery Sparkline Charts: http://omnipotent.net/jquery.sparkline/#s-docs
|
||||
var initChartsSparkline = function() {
|
||||
// Bar Charts
|
||||
var $barOptions = {
|
||||
type: 'bar',
|
||||
barWidth: 8,
|
||||
barSpacing: 6,
|
||||
height: '70px',
|
||||
barColor: App.colors.green,
|
||||
tooltipPrefix: '',
|
||||
tooltipSuffix: ' Revenue',
|
||||
tooltipFormat: '{{prefix}}{{value}}{{suffix}}'
|
||||
};
|
||||
jQuery( '.js-slc-bar1' ).sparkline( 'html', $barOptions );
|
||||
|
||||
$barOptions['barColor'] = App.colors.cyan;
|
||||
$barOptions['tooltipPrefix'] = '$ ';
|
||||
$barOptions['tooltipSuffix'] = '';
|
||||
jQuery( '.js-slc-bar2' ).sparkline( 'html', $barOptions );
|
||||
|
||||
$barOptions['barColor'] = App.colors.blue;
|
||||
$barOptions['tooltipPrefix'] = '';
|
||||
$barOptions['tooltipSuffix'] = ' Users';
|
||||
jQuery( '.js-slc-bar3' ).sparkline( 'html', $barOptions );
|
||||
|
||||
$barOptions['barColor'] = App.colors.purple;
|
||||
$barOptions['tooltipPrefix'] = '';
|
||||
$barOptions['tooltipSuffix'] = ' Companies';
|
||||
jQuery( '.js-slc-bar4' ).sparkline( 'html', $barOptions );
|
||||
|
||||
// Line Charts
|
||||
var $lineOptions = {
|
||||
type: 'line',
|
||||
width: '120px',
|
||||
height: '70px',
|
||||
tooltipOffsetX: -25,
|
||||
tooltipOffsetY: 20,
|
||||
lineColor: App.colors.green,
|
||||
fillColor: App.colors.green,
|
||||
spotColor: App.colors.text_muted,
|
||||
minSpotColor: App.colors.text_muted,
|
||||
maxSpotColor: App.colors.text_muted,
|
||||
highlightSpotColor: App.colors.text_muted,
|
||||
highlightLineColor: App.colors.text_muted,
|
||||
spotRadius: 2,
|
||||
tooltipPrefix: '',
|
||||
tooltipSuffix: ' Revenue',
|
||||
tooltipFormat: '{{prefix}}{{y}}{{suffix}}'
|
||||
};
|
||||
jQuery( '.js-slc-line1' ).sparkline( 'html', $lineOptions );
|
||||
|
||||
$lineOptions['lineColor'] = App.colors.blue;
|
||||
$lineOptions['fillColor'] = App.colors.blue;
|
||||
$lineOptions['tooltipPrefix'] = '$ ';
|
||||
$lineOptions['tooltipSuffix'] = '';
|
||||
jQuery( '.js-slc-line2' ).sparkline( 'html', $lineOptions );
|
||||
|
||||
$lineOptions['lineColor'] = App.colors.purple;
|
||||
$lineOptions['fillColor'] = App.colors.purple;
|
||||
$lineOptions['tooltipPrefix'] = '';
|
||||
$lineOptions['tooltipSuffix'] = ' Users';
|
||||
jQuery( '.js-slc-line3' ).sparkline( 'html', $lineOptions );
|
||||
|
||||
$lineOptions['lineColor'] = App.colors.cyan;
|
||||
$lineOptions['fillColor'] = App.colors.cyan;
|
||||
$lineOptions['tooltipPrefix'] = '';
|
||||
$lineOptions['tooltipSuffix'] = ' Companies';
|
||||
jQuery( '.js-slc-line4' ).sparkline( 'html', $lineOptions );
|
||||
|
||||
// Pie Charts
|
||||
var $pieCharts = {
|
||||
type: 'pie',
|
||||
width: '60px',
|
||||
height: '60px',
|
||||
sliceColors: [App.colors.blue, App.colors.green, App.colors.cyan, App.colors.purple],
|
||||
tooltipPrefix: '',
|
||||
tooltipSuffix: ' Revenue',
|
||||
tooltipFormat: '{{prefix}}{{value}}{{suffix}}'
|
||||
};
|
||||
jQuery( '.js-slc-pie1' ).sparkline( 'html', $pieCharts );
|
||||
|
||||
$pieCharts['tooltipPrefix'] = '$ ';
|
||||
$pieCharts['tooltipSuffix'] = '';
|
||||
jQuery( '.js-slc-pie2' ).sparkline( 'html', $pieCharts );
|
||||
|
||||
$pieCharts['tooltipPrefix'] = '';
|
||||
$pieCharts['tooltipSuffix'] = ' Users';
|
||||
jQuery( '.js-slc-pie3' ).sparkline( 'html', $pieCharts );
|
||||
|
||||
$pieCharts['tooltipPrefix'] = '';
|
||||
$pieCharts['tooltipSuffix'] = ' Companies';
|
||||
jQuery( '.js-slc-pie4' ).sparkline( 'html', $pieCharts );
|
||||
|
||||
// Tristate Charts
|
||||
var $tristateOptions = {
|
||||
type: 'tristate',
|
||||
barWidth: 8,
|
||||
barSpacing: 6,
|
||||
height: '80px',
|
||||
posBarColor: App.colors.blue,
|
||||
negBarColor: App.colors.green
|
||||
};
|
||||
jQuery( '.js-slc-tristate1' ).sparkline( 'html', $tristateOptions );
|
||||
jQuery( '.js-slc-tristate2' ).sparkline( 'html', $tristateOptions );
|
||||
jQuery( '.js-slc-tristate3' ).sparkline( 'html', $tristateOptions );
|
||||
jQuery( '.js-slc-tristate4' ).sparkline( 'html', $tristateOptions );
|
||||
};
|
||||
|
||||
return {
|
||||
init: function() {
|
||||
// Init charts
|
||||
initChartsSparkline();
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
// Initialize when page loads
|
||||
jQuery( function() {
|
||||
BaseJsCharts.init();
|
||||
});
|
||||
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
Document: base_js_maps.js
|
||||
Author: Rustheme
|
||||
Description: Custom JS code used in Maps Page
|
||||
*/
|
||||
|
||||
var BaseJsMaps = function() {
|
||||
// Init Map with Search
|
||||
var initMapSearch = function() {
|
||||
// Init Map
|
||||
var $mapSearch = new GMaps({
|
||||
div: '#js-map-search',
|
||||
lat: 20,
|
||||
lng: 0,
|
||||
zoom: 2,
|
||||
scrollwheel: false
|
||||
});
|
||||
|
||||
// When the search form is submitted
|
||||
jQuery( '.js-form-search' ).on( 'submit', function() {
|
||||
GMaps.geocode({
|
||||
address: jQuery( '.js-search-address' ).val().trim(),
|
||||
callback: function ( $results, $status ) {
|
||||
if ( ( $status === 'OK' ) && $results ) {
|
||||
var $latlng = $results[0].geometry.location;
|
||||
|
||||
$mapSearch.removeMarkers();
|
||||
$mapSearch.addMarker( { lat: $latlng.lat(), lng: $latlng.lng() } );
|
||||
$mapSearch.fitBounds( $results[0].geometry.viewport );
|
||||
} else {
|
||||
alert( 'Address not found!' );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
// Init Geolocation Map
|
||||
var initMapGeo = function() {
|
||||
var gmapGeolocation = new GMaps({
|
||||
div: '#js-map-geo',
|
||||
lat: 0,
|
||||
lng: 0,
|
||||
scrollwheel: false
|
||||
});
|
||||
|
||||
GMaps.geolocate({
|
||||
success: function( position ) {
|
||||
gmapGeolocation.setCenter( position.coords.latitude, position.coords.longitude );
|
||||
gmapGeolocation.addMarker({
|
||||
lat: position.coords.latitude,
|
||||
lng: position.coords.longitude,
|
||||
animation: google.maps.Animation.DROP,
|
||||
title: 'GeoLocation',
|
||||
infoWindow: {
|
||||
content: '<div class="text-success"><i class="ion-ios-location"></i> <strong>Your location!</strong></div>'
|
||||
}
|
||||
});
|
||||
},
|
||||
error: function(error) {
|
||||
alert( 'Geolocation failed: ' + error.message );
|
||||
},
|
||||
not_supported: function() {
|
||||
alert( "Your browser does not support geolocation" );
|
||||
},
|
||||
always: function() {
|
||||
// Message when geolocation succeed
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Init Satellite Map
|
||||
var initMapSatellite = function() {
|
||||
new GMaps({
|
||||
div: '#js-map-sat',
|
||||
lat: 0,
|
||||
lng: 0,
|
||||
zoom: 1,
|
||||
scrollwheel: false
|
||||
}).setMapTypeId( google.maps.MapTypeId.SATELLITE );
|
||||
};
|
||||
|
||||
// Init Terrain Map
|
||||
var initMapTerrain = function() {
|
||||
new GMaps({
|
||||
div: '#js-map-ter',
|
||||
lat: 0,
|
||||
lng: 0,
|
||||
zoom: 1,
|
||||
scrollwheel: false
|
||||
}).setMapTypeId( google.maps.MapTypeId.TERRAIN );
|
||||
};
|
||||
|
||||
// Init Overlay Map
|
||||
var initMapOverlay = function() {
|
||||
new GMaps({
|
||||
div: '#js-map-overlay',
|
||||
lat: 37.7577,
|
||||
lng: -122.4376,
|
||||
zoom: 11,
|
||||
scrollwheel: false
|
||||
}).drawOverlay({
|
||||
lat: 37.7577,
|
||||
lng: -122.4376,
|
||||
content: $( '#js-map-overlay-content' ).html()
|
||||
});
|
||||
};
|
||||
|
||||
// Init Markers Map
|
||||
var initMapMarkers = function() {
|
||||
new GMaps({
|
||||
div: '#js-map-markers',
|
||||
lat: 37.7577,
|
||||
lng: -122.4376,
|
||||
zoom: 11,
|
||||
scrollwheel: false
|
||||
}).addMarkers([
|
||||
{lat: 37.70, lng: -122.49, title: 'Marker #1', animation: google.maps.Animation.DROP, infoWindow: {content: '<strong>Marker #1</strong>'}},
|
||||
{lat: 37.76, lng: -122.46, title: 'Marker #2', animation: google.maps.Animation.DROP, infoWindow: {content: '<strong>Marker #2</strong>'}},
|
||||
{lat: 37.72, lng: -122.41, title: 'Marker #3', animation: google.maps.Animation.DROP, infoWindow: {content: '<strong>Marker #3</strong>'}},
|
||||
{lat: 37.78, lng: -122.39, title: 'Marker #4', animation: google.maps.Animation.DROP, infoWindow: {content: '<strong>Marker #4</strong>'}},
|
||||
{lat: 37.74, lng: -122.46, title: 'Marker #5', animation: google.maps.Animation.DROP, infoWindow: {content: '<strong>Marker #5</strong>'}}
|
||||
]);
|
||||
};
|
||||
|
||||
// Init Street Map
|
||||
var initMapStreet = function() {
|
||||
new GMaps.createPanorama({
|
||||
el: '#js-map-street',
|
||||
lat: 37.809345,
|
||||
lng: -122.475825,
|
||||
pov: {heading: 340.91, pitch: 4},
|
||||
scrollwheel: false
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
init: function () {
|
||||
// Gmaps.js: https://hpneo.github.io/gmaps/
|
||||
|
||||
// Init Map with Search functionality
|
||||
initMapSearch();
|
||||
|
||||
// Init Example Maps
|
||||
initMapGeo();
|
||||
initMapTerrain();
|
||||
initMapSatellite();
|
||||
initMapMarkers();
|
||||
initMapOverlay();
|
||||
initMapStreet();
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
// Initialize when page loads
|
||||
jQuery( function() {
|
||||
BaseJsMaps.init();
|
||||
});
|
||||
@@ -0,0 +1,198 @@
|
||||
/*
|
||||
Document: base_tables_datatables.js
|
||||
Author: Rustheme
|
||||
Description: Custom JS code used in Tables Datatables Page
|
||||
*/
|
||||
|
||||
var BaseTableDatatables = function() {
|
||||
// Init full DataTable: https://www.datatables.net/
|
||||
var initDataTableFull = function() {
|
||||
jQuery( '.js-dataTable-full' ).dataTable({
|
||||
columnDefs: [ { orderable: false, targets: [ 4 ] } ],
|
||||
pageLength: 10,
|
||||
lengthMenu: [[5, 10, 15, 20], [5, 10, 15, 20]]
|
||||
});
|
||||
};
|
||||
|
||||
// Init simple DataTable: https://www.datatables.net/
|
||||
var initDataTableSimple = function() {
|
||||
jQuery( '.js-dataTable-simple' ).dataTable({
|
||||
columnDefs: [ { orderable: false, targets: [ 4 ] } ],
|
||||
pageLength: 10,
|
||||
lengthMenu: [[5, 10, 15, 20], [5, 10, 15, 20]],
|
||||
searching: false,
|
||||
oLanguage: {
|
||||
sLengthMenu: ''
|
||||
},
|
||||
dom:
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-6'i><'col-sm-6'p>>"
|
||||
});
|
||||
};
|
||||
|
||||
// DataTables Bootstrap integration
|
||||
var bsDataTables = function() {
|
||||
var $DataTable = jQuery.fn.dataTable;
|
||||
|
||||
// Set the defaults for DataTables init
|
||||
jQuery.extend( true, $DataTable.defaults, {
|
||||
dom:
|
||||
"<'row'<'col-sm-6'l><'col-sm-6'f>>" +
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-6'i><'col-sm-6'p>>",
|
||||
renderer: 'bootstrap',
|
||||
oLanguage: {
|
||||
sLengthMenu: "_MENU_",
|
||||
sInfo: "Showing <strong>_START_</strong>-<strong>_END_</strong> of <strong>_TOTAL_</strong>",
|
||||
oPaginate: {
|
||||
sPrevious: '<i class="ion-ios-arrow-left"></i>',
|
||||
sNext: '<i class="ion-ios-arrow-right"></i>'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Default class modification
|
||||
jQuery.extend($DataTable.ext.classes, {
|
||||
sWrapper: "dataTables_wrapper form-inline dt-bootstrap",
|
||||
sFilterInput: "form-control",
|
||||
sLengthSelect: "form-control"
|
||||
});
|
||||
|
||||
// Bootstrap paging button renderer
|
||||
$DataTable.ext.renderer.pageButton.bootstrap = function (settings, host, idx, buttons, page, pages) {
|
||||
var api = new $DataTable.Api(settings);
|
||||
var classes = settings.oClasses;
|
||||
var lang = settings.oLanguage.oPaginate;
|
||||
var btnDisplay, btnClass;
|
||||
|
||||
var attach = function (container, buttons) {
|
||||
var i, ien, node, button;
|
||||
var clickHandler = function (e) {
|
||||
e.preventDefault();
|
||||
if ( !jQuery(e.currentTarget).hasClass( 'disabled')) {
|
||||
api.page(e.data.action).draw(false);
|
||||
}
|
||||
};
|
||||
|
||||
for (i = 0, ien = buttons.length; i < ien; i++) {
|
||||
button = buttons[i];
|
||||
|
||||
if ( jQuery.isArray(button)) {
|
||||
attach(container, button);
|
||||
}
|
||||
else {
|
||||
btnDisplay = '';
|
||||
btnClass = '';
|
||||
|
||||
switch (button) {
|
||||
case 'ellipsis':
|
||||
btnDisplay = '…';
|
||||
btnClass = 'disabled';
|
||||
break;
|
||||
|
||||
case 'first':
|
||||
btnDisplay = lang.sFirst;
|
||||
btnClass = button + (page > 0 ? '' : ' disabled' );
|
||||
break;
|
||||
|
||||
case 'previous':
|
||||
btnDisplay = lang.sPrevious;
|
||||
btnClass = button + (page > 0 ? '' : ' disabled' );
|
||||
break;
|
||||
|
||||
case 'next':
|
||||
btnDisplay = lang.sNext;
|
||||
btnClass = button + (page < pages - 1 ? '' : ' disabled' );
|
||||
break;
|
||||
|
||||
case 'last':
|
||||
btnDisplay = lang.sLast;
|
||||
btnClass = button + (page < pages - 1 ? '' : ' disabled' );
|
||||
break;
|
||||
|
||||
default:
|
||||
btnDisplay = button + 1;
|
||||
btnClass = page === button ?
|
||||
'active' : '';
|
||||
break;
|
||||
}
|
||||
|
||||
if ( btnDisplay) {
|
||||
node = jQuery( '<li>', {
|
||||
'class': classes.sPageButton + ' ' + btnClass,
|
||||
'aria-controls': settings.sTableId,
|
||||
'tabindex': settings.iTabIndex,
|
||||
'id': idx === 0 && typeof button === 'string' ?
|
||||
settings.sTableId + '_' + button :
|
||||
null
|
||||
})
|
||||
.append(jQuery( '<a>', {
|
||||
'href': '#'
|
||||
})
|
||||
.html(btnDisplay)
|
||||
)
|
||||
.appendTo(container);
|
||||
|
||||
settings.oApi._fnBindAction(
|
||||
node, {action: button}, clickHandler
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
attach(
|
||||
jQuery( host ).empty().html( '<ul class="pagination"/>' ).children( 'ul' ),
|
||||
buttons
|
||||
);
|
||||
};
|
||||
|
||||
// TableTools Bootstrap compatibility - Required TableTools 2.1+
|
||||
if ( $DataTable.TableTools ) {
|
||||
// Set the classes that TableTools uses to something suitable for Bootstrap
|
||||
jQuery.extend(true, $DataTable.TableTools.classes, {
|
||||
"container": "DTTT btn-group",
|
||||
"buttons": {
|
||||
"normal": "btn btn-default",
|
||||
"disabled": "disabled"
|
||||
},
|
||||
"collection": {
|
||||
"container": "DTTT_dropdown dropdown-menu",
|
||||
"buttons": {
|
||||
"normal": "",
|
||||
"disabled": "disabled"
|
||||
}
|
||||
},
|
||||
"print": {
|
||||
"info": "DTTT_print_info"
|
||||
},
|
||||
"select": {
|
||||
"row": "active"
|
||||
}
|
||||
});
|
||||
|
||||
// Have the collection use a bootstrap compatible drop down
|
||||
jQuery.extend( true, $DataTable.TableTools.DEFAULTS.oTags, {
|
||||
"collection": {
|
||||
"container": "ul",
|
||||
"button": "li",
|
||||
"liner": "a"
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
init: function() {
|
||||
// Init Datatables
|
||||
bsDataTables();
|
||||
initDataTableSimple();
|
||||
initDataTableFull();
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
// Initialize when page loads
|
||||
jQuery( function() {
|
||||
BaseTableDatatables.init();
|
||||
});
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
Document: base_ui_progress.js
|
||||
Author: Rustheme
|
||||
Description: Custom JS code used in Progress Page
|
||||
*/
|
||||
|
||||
var BaseUIProgress = function() {
|
||||
// Randomize progress bars values
|
||||
var barsRandomize = function() {
|
||||
jQuery( '.js-bar-randomize' ).on( 'click', function() {
|
||||
jQuery( this )
|
||||
.parents( '.card' )
|
||||
.find( '.progress-bar' )
|
||||
.each( function() {
|
||||
var $this = jQuery( this );
|
||||
var $random = Math.floor( ( Math.random() * 91 ) + 10 ) + '%';
|
||||
|
||||
$this.css( 'width', $random );
|
||||
|
||||
if ( ! $this.parent().hasClass( 'progress-mini' ) ) {
|
||||
$this.html( $random );
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
init: function() {
|
||||
// Init randomize bar values
|
||||
barsRandomize();
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
// Initialize when page loads
|
||||
jQuery( function() {
|
||||
BaseUIProgress.init();
|
||||
});
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
Document: frontend_contact.js
|
||||
Author: Rustheme
|
||||
Description: Custom JS code used in Frontend Contact Page
|
||||
*/
|
||||
|
||||
var FrontendContact = function() {
|
||||
// Init Contact Map with Gmaps.js: https://hpneo.github.io/gmaps/
|
||||
var initContactMap = function() {
|
||||
new GMaps({
|
||||
div: '#js-map-contact',
|
||||
lat: 37.75755,
|
||||
lng: -122.43688,
|
||||
zoom: 15,
|
||||
disableDefaultUI: true,
|
||||
scrollwheel: false
|
||||
}).addMarkers([{
|
||||
lat: 37.75755,
|
||||
lng: -122.43688,
|
||||
title: 'AppUI Office',
|
||||
animation: google.maps.Animation.DROP,
|
||||
infoWindow: {content: '<strong>Company</strong>'}
|
||||
}]);
|
||||
};
|
||||
|
||||
return {
|
||||
init: function () {
|
||||
// Init Contact Map
|
||||
initContactMap();
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
// Initialize when page loads
|
||||
jQuery( function() {
|
||||
FrontendContact.init();
|
||||
});
|
||||
@@ -0,0 +1,310 @@
|
||||
/*var BasePagesDashboard = function() {
|
||||
// Chart.js Chart: http://www.chartjs.org/docs
|
||||
var initDashChartJS = function() {
|
||||
|
||||
// Get Chart Containers
|
||||
var $dashChartLinesCnt1 = jQuery( '.js-chartjs-lines1' )[0].getContext( '2d' ),
|
||||
$dashChartLinesCnt2 = jQuery( '.js-chartjs-lines2' )[0].getContext( '2d' ),
|
||||
$dashChartBarsCnt = jQuery( '.js-chartjs-bars' )[0].getContext( '2d' ),
|
||||
$dashChartLinesCnt3 = jQuery( '.js-chartjs-lines3' )[0].getContext( '2d' ),
|
||||
$dashChartLinesCnt4 = jQuery( '.js-chartjs-lines4' )[0].getContext( '2d' ),
|
||||
$dashChartLinesCnt5 = jQuery( '.js-chartjs-lines5' )[0].getContext( '2d' ),
|
||||
$dashChartLinesCnt6 = jQuery( '.js-chartjs-lines6' )[0].getContext( '2d' ),
|
||||
$flotLive = jQuery( '.js-flot-live' );
|
||||
|
||||
// Set global chart options
|
||||
var $globalOptions = {
|
||||
showScale: false,
|
||||
tooltipCornerRadius: 2,
|
||||
maintainAspectRatio: false,
|
||||
responsive: true,
|
||||
animation: false,
|
||||
pointDotStrokeWidth: 2,
|
||||
};
|
||||
|
||||
// Lines Chart Data 1
|
||||
var $dashChartLinesData = {
|
||||
labels: ['2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014'],
|
||||
datasets: [
|
||||
{
|
||||
label: 'This Week',
|
||||
fillColor: 'rgba(255, 255, 255, .1)',
|
||||
strokeColor: 'rgba(255, 255, 255, .38)',
|
||||
pointColor: App.colors.blue,
|
||||
pointStrokeColor: '#fff',
|
||||
data: [20, 40, 24, 75, 16, 42, 20, 42, 40, 65, 48, 56, 80, 95]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// Lines Chart Data 2
|
||||
var $dashChartLinesData2 = {
|
||||
labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
||||
datasets: [
|
||||
{
|
||||
label: 'This Week',
|
||||
fillColor: App.hexToRgba( App.colors.blue, 20 ),
|
||||
strokeColor: App.hexToRgba( App.colors.blue, 20 ),
|
||||
pointColor: '#fff',
|
||||
pointStrokeColor: App.hexToRgba( App.colors.blue, 70 ),
|
||||
data: [20, 25, 40, 30, 55, 60, 80]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// Lines Chart Data 3
|
||||
var $dashChartLinesData3 = {
|
||||
labels: ['20', '40', '60', '80', '100', '120', '140'],
|
||||
datasets: [
|
||||
{
|
||||
label: 'This Week',
|
||||
fillColor: App.hexToRgba( App.colors.blue, 50 ),
|
||||
pointColor: App.colors.blue,
|
||||
data: [2500, 1500, 1200, 3200, 4800, 3500, 1500]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// Lines Chart Data 4
|
||||
var $dashChartLinesData4 = {
|
||||
labels: ['2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014'],
|
||||
datasets: [
|
||||
{
|
||||
label: 'This Week',
|
||||
strokeColor: App.colors.blue,
|
||||
pointColor: '#fff',
|
||||
pointStrokeColor: App.colors.blue,
|
||||
data: [20, 25, 40, 30, 45, 40, 55, 40, 48, 40, 42, 50]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// Lines Chart Data 5
|
||||
var $dashChartLinesData5 = {
|
||||
labels: ['2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014'],
|
||||
datasets: [
|
||||
{
|
||||
label: 'This Week',
|
||||
fillColor: App.hexToRgba( App.colors.green, 30 ),
|
||||
strokeColor: App.colors.green,
|
||||
pointColor: '#fff',
|
||||
pointStrokeColor: App.colors.green,
|
||||
data: [20, 25, 40, 30, 45, 40, 55, 40, 48, 40, 42, 50]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// Lines Chart Data 6
|
||||
var $dashChartLinesData6 = {
|
||||
labels: ['2005', '2006', '2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015', '2016'],
|
||||
datasets: [
|
||||
{
|
||||
label: 'This Week',
|
||||
fillColor: App.hexToRgba( App.colors.purple, 30 ),
|
||||
strokeColor: App.colors.purple,
|
||||
pointColor: '#fff',
|
||||
pointStrokeColor: App.colors.purple,
|
||||
data: [55, 40, 48, 40, 42, 50, 20, 25, 40, 30, 45, 40]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// Lines Chart Data 7
|
||||
var $dashChartLinesData7 = {
|
||||
labels: ['2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015', '2016'],
|
||||
datasets: [
|
||||
{
|
||||
fillColor: App.hexToRgba( App.colors.green, 30 ),
|
||||
strokeColor: App.colors.green,
|
||||
pointColor: '#fff',
|
||||
pointDot: false,
|
||||
pointStrokeColor: App.colors.green,
|
||||
data: [50, 45, 52, 35, 45, 64, 50, 47, 45, 53]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// Lines Chart Data 8
|
||||
var $dashChartLinesData8 = {
|
||||
labels: ['2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015', '2016'],
|
||||
datasets: [
|
||||
{
|
||||
fillColor: App.hexToRgba( App.colors.blue, 30 ),
|
||||
strokeColor: App.colors.blue,
|
||||
pointColor: '#fff',
|
||||
pointDot: false,
|
||||
pointStrokeColor: App.colors.blue,
|
||||
data: [30, 35, 42, 35, 60, 38, 50, 40, 48, 48]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// Lines Chart Data 9
|
||||
var $dashChartLinesData9 = {
|
||||
labels: ['2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015', '2016'],
|
||||
datasets: [
|
||||
{
|
||||
fillColor: App.hexToRgba( App.colors.purple, 30 ),
|
||||
strokeColor: App.colors.purple,
|
||||
pointColor: '#fff',
|
||||
pointDot: false,
|
||||
pointStrokeColor: App.colors.purple,
|
||||
data: [60, 55, 52, 38, 62, 40, 50, 46, 50, 54]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// Init Lines Chart
|
||||
$dashChartLines = new Chart( $dashChartLinesCnt1 ).Line( $dashChartLinesData, $globalOptions );
|
||||
|
||||
// Init Lines Chart 2
|
||||
$dashChartLines2 = new Chart( $dashChartLinesCnt2 ).Line( $dashChartLinesData2, $globalOptions );
|
||||
|
||||
// Init Lines Chart Bars
|
||||
$dashChartBars = new Chart( $dashChartBarsCnt ).Bar( $dashChartLinesData3, {
|
||||
scaleBeginAtZero: false,
|
||||
scaleShowVerticalLines: false,
|
||||
barShowStroke: false,
|
||||
scaleFontFamily: "'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif",
|
||||
scaleFontColor: App.colors.text_muted,
|
||||
tooltipTitleFontFamily: "'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif",
|
||||
tooltipCornerRadius: 2,
|
||||
maintainAspectRatio: false,
|
||||
responsive: true,
|
||||
animation: false,
|
||||
});
|
||||
|
||||
// Init Lines Chart 4
|
||||
$dashChartLines4 = new Chart( $dashChartLinesCnt3 ).Line( $dashChartLinesData4, {
|
||||
scaleShowHorizontalLines: false,
|
||||
bezierCurve: false,
|
||||
datasetFill: false,
|
||||
pointDotStrokeWidth: 2,
|
||||
scaleFontFamily: "'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif",
|
||||
scaleFontColor: App.colors.text_muted,
|
||||
scaleFontStyle: '500',
|
||||
tooltipTitleFontFamily: "'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif",
|
||||
tooltipCornerRadius: 2,
|
||||
maintainAspectRatio: false,
|
||||
responsive: true,
|
||||
animation: false,
|
||||
});
|
||||
|
||||
// "Company overview" widget
|
||||
// Init Lines Chart 4
|
||||
$dashChartLines4 = new Chart( $dashChartLinesCnt4 ).Line( $dashChartLinesData7, {
|
||||
pointDot: false,
|
||||
showScale: false,
|
||||
maintainAspectRatio: false,
|
||||
responsive: true,
|
||||
animation: false,
|
||||
});
|
||||
|
||||
// Init Lines Chart 5
|
||||
$dashChartLines5 = new Chart( $dashChartLinesCnt5 ).Line( $dashChartLinesData8, {
|
||||
pointDot: false,
|
||||
showScale: false,
|
||||
maintainAspectRatio: false,
|
||||
responsive: true,
|
||||
animation: false,
|
||||
});
|
||||
|
||||
// Init Lines Chart 6
|
||||
$dashChartLines6 = new Chart( $dashChartLinesCnt6 ).Line( $dashChartLinesData9, {
|
||||
pointDot: false,
|
||||
showScale: false,
|
||||
maintainAspectRatio: false,
|
||||
responsive: true,
|
||||
animation: false,
|
||||
});
|
||||
|
||||
// Live Chart
|
||||
var $dataLive = [];
|
||||
|
||||
// Generate random data
|
||||
function getRandomData() {
|
||||
|
||||
if ( $dataLive.length > 0 )
|
||||
$dataLive = $dataLive.slice( 1 );
|
||||
|
||||
while ( $dataLive.length < 300 ) {
|
||||
var prev = $dataLive.length > 0 ? $dataLive[$dataLive.length - 1] : 50;
|
||||
var y = prev + Math.random() * 10 - 5;
|
||||
if ( y < 0 )
|
||||
y = 0;
|
||||
if ( y > 100 )
|
||||
y = 100;
|
||||
|
||||
$dataLive.push( y );
|
||||
}
|
||||
|
||||
var res = [];
|
||||
for ( var i = 0; i < $dataLive.length; ++i )
|
||||
res.push([i, $dataLive[i]]);
|
||||
|
||||
// Show live chart info
|
||||
jQuery( '.js-flot-live-info' ).html( y.toFixed( 0 ) + '%' );
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
// Update live chart
|
||||
function updateChartLive() {
|
||||
$chartLive.setData( [getRandomData()] );
|
||||
$chartLive.draw();
|
||||
setTimeout( updateChartLive, 70 );
|
||||
}
|
||||
|
||||
// Init live chart
|
||||
//console.log(getRandomData());
|
||||
var $chartLive = jQuery.plot( $flotLive,
|
||||
[{
|
||||
data: getRandomData()
|
||||
}], {
|
||||
series: {
|
||||
shadowSize: 0
|
||||
},
|
||||
lines: {
|
||||
show: true,
|
||||
lineWidth: 1,
|
||||
fill: true,
|
||||
fillColor: {
|
||||
colors: [{
|
||||
opacity: .2
|
||||
}, {
|
||||
opacity: .2
|
||||
}]
|
||||
}
|
||||
},
|
||||
colors: ['#fff'],
|
||||
grid: {
|
||||
borderWidth: 0,
|
||||
color: App.colors.gray_lighter,
|
||||
},
|
||||
yaxis: {
|
||||
show: false,
|
||||
min: 0,
|
||||
max: 110
|
||||
},
|
||||
xaxis: {
|
||||
show: false
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Start getting new data
|
||||
updateChartLive();
|
||||
};
|
||||
|
||||
return {
|
||||
init: function () {
|
||||
// Init ChartJS chart
|
||||
initDashChartJS();
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
// Initialize when page loads
|
||||
jQuery( function() {
|
||||
BasePagesDashboard.init();
|
||||
});*/
|
||||
Reference in new issue
Block a user