Sha256: b02d00543b9fa5cafa3f9eeab803ef9f6835afa45fe48d3db5092941b839e00a
Contents?: true
Size: 1.37 KB
Versions: 37
Compression:
Stored size: 1.37 KB
Contents
I"s(function() { this.app.directive('ptConfirmReveal', function() { return function($scope, $el, $attrs) { var $modal, callbackFn, defaults, option; defaults = { title: 'Are you sure?', body: 'This action cannot be undone.' }; option = function(name) { return $el.data(name) || defaults[name]; }; $modal = $("<div data-reveal class=\"reveal-modal small\">\n <h2 pt-title></h2>\n <p pt-body></p>\n <div>\n <button class=\"button alert\" pt-confirm>OK</button>\n <button class=\"button secondary\" pt-cancel>Cancel</button>\n </div>\n</div>"); $modal.find('[pt-title]').html(option('title')); $modal.find('[pt-body]').html(option('body')); callbackFn = new Function('$scope', "$scope." + $attrs.ptConfirmReveal); $modal.find('[pt-confirm]').on('click', function(e) { e.preventDefault(); callbackFn($scope); return $modal.foundation('reveal', 'close'); }); $modal.find('[pt-cancel]').on('click', function(e) { e.preventDefault(); return $modal.foundation('reveal', 'close'); }); return $el.on('click', function(e) { e.preventDefault(); return $modal.appendTo('body').foundation('reveal', 'open').on('closed.fndtn.reveal', function(e) { return $modal.remove(); }); }); }; }); }).call(this); :ET
Version data entries
37 entries across 33 versions & 3 rubygems