Sha256: 2cf27d18cc9fd97a9a71ed6cdf8cffc91ed600b92ef738ded3300533a52f5418
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
Contents
angular.module("oxymoron.notifier", []) .run(['$rootScope', 'ngNotify', 'Validate', '$state', '$http', '$location', function ($rootScope, ngNotify, Validate, $state, $http, $location) { ngNotify.config({ theme: 'pure', position: 'top', duration: 2000, type: 'info' }); $rootScope.notify_callback = function(type, res) { if (res.data && angular.isObject(res.data)) { if (res.data.msg || res.data.error) { ngNotify.set(res.data.msg || res.data.error, type); } if (res.data.errors) { Validate(res.data.form_name || res.config.data.form_name, res.data.errors) } if (res.data.redirect_to_url) { $location.url(res.data.redirect_to_url); } else if (res.data.redirect_to) { $state.go(res.data.redirect_to, res.data.redirect_options || {}); } if (res.data.reload) { window.location.reload(); } } } $rootScope.$on('loading:finish', function (h, res) { $rootScope.notify_callback('success', res) }) $rootScope.$on('loading:error', function (h, res, p) { $rootScope.notify_callback('error', res) }) }])
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
oxymoron-1.0.4 | app/assets/javascripts/oxymoron/notifier.js.erb |
oxymoron-1.0.3 | app/assets/javascripts/oxymoron/notifier.js.erb |