mirror of https://github.com/akveo/blur-admin
refactor(notifications): use local config instead global
parent
5a0c78e8a6
commit
bd5f2cc120
|
@ -24,7 +24,7 @@
|
|||
"angular-route": "~1.4.6",
|
||||
"angular-slimscroll": "~1.1.5",
|
||||
"angular-smart-table": "~2.1.3",
|
||||
"angular-toastr": "~1.5.0",
|
||||
"angular-toastr": "~1.6.0",
|
||||
"angular-touch": "~1.4.6",
|
||||
"angular-ui-sortable": "~0.13.4",
|
||||
"animate.css": "~3.4.0",
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
.controller('NotificationsPageCtrl', NotificationsPageCtrl);
|
||||
|
||||
/** @ngInject */
|
||||
function NotificationsPageCtrl($scope, toastr, toastrConfig) {
|
||||
function NotificationsPageCtrl($scope, toastr) {
|
||||
$scope.types = ['success', 'error', 'info', 'warning'];
|
||||
|
||||
$scope.quotes = [
|
||||
|
@ -75,21 +75,6 @@
|
|||
msg: "Type your message here"
|
||||
};
|
||||
|
||||
$scope.$watchCollection('options', function (newValue) {
|
||||
toastrConfig.autoDismiss = newValue.autoDismiss;
|
||||
toastrConfig.allowHtml = newValue.html;
|
||||
toastrConfig.extendedTimeOut = parseInt(newValue.extendedTimeout, 10);
|
||||
toastrConfig.positionClass = newValue.position;
|
||||
toastrConfig.timeOut = parseInt(newValue.timeout, 10);
|
||||
toastrConfig.closeButton = newValue.closeButton;
|
||||
toastrConfig.tapToDismiss = newValue.tapToDismiss;
|
||||
toastrConfig.progressBar = newValue.progressBar;
|
||||
toastrConfig.newestOnTop = newValue.newestOnTop;
|
||||
toastrConfig.maxOpened = newValue.maxOpened;
|
||||
toastrConfig.preventDuplicates = newValue.preventDuplicates;
|
||||
toastrConfig.preventOpenDuplicates = newValue.preventOpenDuplicates;
|
||||
});
|
||||
|
||||
|
||||
$scope.clearLastToast = function () {
|
||||
var toast = openedToasts.pop();
|
||||
|
@ -110,7 +95,7 @@
|
|||
};
|
||||
|
||||
$scope.openToast = function () {
|
||||
openedToasts.push(toastr[$scope.options.type]($scope.options.msg, $scope.options.title));
|
||||
openedToasts.push(toastr[$scope.options.type]($scope.options.msg, $scope.options.title, $scope.options));
|
||||
var strOptions = {};
|
||||
for (var o in $scope.options) if (o != 'msg' && o != 'title')strOptions[o] = $scope.options[o];
|
||||
$scope.optionsStr = "toastr." + $scope.options.type + "(\'" + $scope.options.msg + "\', \'" + $scope.options.title + "\', " + JSON.stringify(strOptions, null, 2) + ")";
|
||||
|
|
Loading…
Reference in New Issue