Skip to content

Silence browser Added non-passive event listener warnings #501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions demo/common/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict';
angular.module('app', ['gridster', 'ui.bootstrap', 'ngRoute'])
.config(['$routeProvider',
function($routeProvider) {
$routeProvider
.when('/main', {
templateUrl: 'demo/main/view.html',
controller: 'MainCtrl'
})
.when('/dashboard', {
templateUrl: 'demo/dashboard/view.html',
controller: 'DashboardCtrl'
})
.otherwise({
redirectTo: '/main'
});
}
])
.controller('RootCtrl', function($scope) {
$scope.$on('$locationChangeStart', function(e, next, current) {
$scope.page = next.split('/').splice(-1);
$scope.styleUrl = 'demo/' + $scope.page + '/style.css'
});
});
282 changes: 142 additions & 140 deletions demo/dashboard/script.js
Original file line number Diff line number Diff line change
@@ -1,152 +1,154 @@
angular.module('app')

.controller('DashboardCtrl', ['$scope', '$timeout',
function($scope, $timeout) {
$scope.gridsterOptions = {
margins: [20, 20],
columns: 4,
draggable: {
handle: 'h3'
}
};

$scope.dashboards = {
'1': {
id: '1',
name: 'Home',
widgets: [{
col: 0,
row: 0,
sizeY: 1,
sizeX: 1,
name: "Widget 1"
}, {
col: 2,
row: 1,
sizeY: 1,
sizeX: 1,
name: "Widget 2"
}]
},
'2': {
id: '2',
name: 'Other',
widgets: [{
col: 1,
row: 1,
sizeY: 1,
sizeX: 2,
name: "Other Widget 1"
}, {
col: 1,
row: 3,
sizeY: 1,
sizeX: 1,
name: "Other Widget 2"
}]
}
};
.controller('DashboardCtrl', ['$scope', '$timeout',
function($scope, $timeout) {
$scope.gridsterOptions = {
margins: [20, 20],
columns: 4,
draggable: {
handle: 'h3'
}
};

$scope.visible = false;

$scope.dashboards = {
'1': {
id: '1',
name: 'Home',
widgets: [{
col: 0,
row: 0,
sizeY: 1,
sizeX: 1,
name: "Widget 1"
}, {
col: 2,
row: 1,
sizeY: 1,
sizeX: 1,
name: "Widget 2"
}]
},
'2': {
id: '2',
name: 'Other',
widgets: [{
col: 1,
row: 1,
sizeY: 1,
sizeX: 2,
name: "Other Widget 1"
}, {
col: 1,
row: 3,
sizeY: 1,
sizeX: 1,
name: "Other Widget 2"
}]
}
};

$scope.clear = function() {
$scope.dashboard.widgets = [];
};
$scope.clear = function() {
$scope.dashboard.widgets = [];
};

$scope.addWidget = function() {
$scope.dashboard.widgets.push({
name: "New Widget",
sizeX: 1,
sizeY: 1
$scope.addWidget = function() {
$scope.dashboard.widgets.push({
name: "New Widget",
sizeX: 1,
sizeY: 1
});
};

$scope.$watch('selectedDashboardId', function(newVal, oldVal) {
if (newVal !== oldVal) {
$scope.dashboard = $scope.dashboards[newVal];
} else {
$scope.dashboard = $scope.dashboards[1];
}
});
};

$scope.$watch('selectedDashboardId', function(newVal, oldVal) {
if (newVal !== oldVal) {
$scope.dashboard = $scope.dashboards[newVal];
} else {
$scope.dashboard = $scope.dashboards[1];
}
});
// init dashboard
$scope.selectedDashboardId = '1';

// init dashboard
$scope.selectedDashboardId = '1';
}
])

.controller('CustomWidgetCtrl', ['$scope', '$uibModal',
function($scope, $modal) {

$scope.remove = function(widget) {
$scope.dashboard.widgets.splice($scope.dashboard.widgets.indexOf(widget), 1);
};

$scope.openSettings = function(widget) {
$modal.open({
scope: $scope,
templateUrl: 'demo/dashboard/widget_settings.html',
controller: 'WidgetSettingsCtrl',
resolve: {
widget: function() {
return widget;
}
}
});
};

}
])
}
])

.controller('CustomWidgetCtrl', ['$scope', '$modal',
function($scope, $modal) {
.controller('WidgetSettingsCtrl', ['$scope', '$timeout', '$rootScope', '$uibModalInstance', 'widget',
function($scope, $timeout, $rootScope, $modalInstance, widget) {
$scope.widget = widget;

$scope.remove = function(widget) {
$scope.dashboard.widgets.splice($scope.dashboard.widgets.indexOf(widget), 1);
};
$scope.form = {
name: widget.name,
sizeX: widget.sizeX,
sizeY: widget.sizeY,
col: widget.col,
row: widget.row
};

$scope.openSettings = function(widget) {
$modal.open({
scope: $scope,
templateUrl: 'demo/dashboard/widget_settings.html',
controller: 'WidgetSettingsCtrl',
resolve: {
widget: function() {
return widget;
}
}
});
};

}
])

.controller('WidgetSettingsCtrl', ['$scope', '$timeout', '$rootScope', '$modalInstance', 'widget',
function($scope, $timeout, $rootScope, $modalInstance, widget) {
$scope.widget = widget;

$scope.form = {
name: widget.name,
sizeX: widget.sizeX,
sizeY: widget.sizeY,
col: widget.col,
row: widget.row
};

$scope.sizeOptions = [{
id: '1',
name: '1'
}, {
id: '2',
name: '2'
}, {
id: '3',
name: '3'
}, {
id: '4',
name: '4'
}];

$scope.dismiss = function() {
$modalInstance.dismiss();
};

$scope.remove = function() {
$scope.dashboard.widgets.splice($scope.dashboard.widgets.indexOf(widget), 1);
$modalInstance.close();
};

$scope.submit = function() {
angular.extend(widget, $scope.form);

$modalInstance.close(widget);
};

}
])

// helper code
.filter('object2Array', function() {
return function(input) {
var out = [];
for (i in input) {
out.push(input[i]);
$scope.sizeOptions = [{
id: '1',
name: '1'
}, {
id: '2',
name: '2'
}, {
id: '3',
name: '3'
}, {
id: '4',
name: '4'
}];

$scope.dismiss = function() {
$modalInstance.dismiss();
};

$scope.remove = function() {
$scope.dashboard.widgets.splice($scope.dashboard.widgets.indexOf(widget), 1);
$modalInstance.close();
};

$scope.submit = function() {
angular.extend(widget, $scope.form);

$modalInstance.close(widget);
};

}
])

// helper code
.filter('object2Array', function() {
return function(input) {
var out = [];
for (i in input) {
out.push(input[i]);
}
return out;
}
return out;
}
});
});
5 changes: 2 additions & 3 deletions demo/dashboard/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
<h1 style="display: inline-block; width: 200px;">Dashboard</h1>
<select class="form-control" style="width: 150px; margin-bottom: 20px; display:inline-block;" ng-change="changeDashboard()" ng-model="selectedDashboardId" ng-options="d.id as d.name for d in dashboards | object2Array | orderBy:'id'">
</select>

</div>
<div gridster="gridsterOptions">
<div gridster="gridsterOptions" ng-show="dashboard.widgets.length">
<ul>
<li gridster-item="widget" ng-repeat="widget in dashboard.widgets">
<div class="box" ng-controller="CustomWidgetCtrl">
Expand All @@ -22,4 +21,4 @@ <h3>{{ widget.name }}</h3>
</div>
</li>
</ul>
</div>
</div>
Loading