mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
26 lines
597 B
JavaScript
26 lines
597 B
JavaScript
define([
|
|
'angular',
|
|
'kbn'
|
|
],
|
|
function (angular) {
|
|
'use strict';
|
|
|
|
var module = angular.module('grafana.directives');
|
|
|
|
module.directive('confirmClick', function() {
|
|
return {
|
|
restrict: 'A',
|
|
link: function(scope, elem, attrs) {
|
|
elem.bind('click', function() {
|
|
var message = attrs.confirmation || "Are you sure you want to do that?";
|
|
if (window.confirm(message)) {
|
|
var action = attrs.confirmClick;
|
|
if (action) {
|
|
scope.$apply(scope.$eval(action));
|
|
}
|
|
}
|
|
});
|
|
},
|
|
};
|
|
});
|
|
}); |