text: "use strict";angular.module("snowplow.SprayEvent",["ngAnimate","ngRoute","ngResource"]).config(["$locationProvider","$routeProvider",function(a,b){a.html5Mode(!1),b.when("/",{templateUrl:"views/home.html",controller:"MainCtrl"}).when("/events",{templateUrl:"views/events.html",controller:"EventCtrl"}).when("/events/new",{templateUrl:"views/events-new.html",controller:"EventNewCtrl"}).when("/events/:id",{templateUrl:"views/events-view.html",controller:"EventViewCtrl"}).when("/events/:id/edit",{templateUrl:"views/events-edit.html",controller:"EventEditCtrl"}).otherwise({redirectTo:"/"})}]),angular.module("snowplow.SprayEvent").controller("MainCtrl",["$rootScope","$location",function(a,b){a.$path=b.path.bind(b)}]).controller("EventCtrl",["$scope","$rootScope","$location","$route","Events",function(a,b,c,d,e){b.$path=c.path.bind(c),a.events=e.query(),a.canEdit=!0,a.canDelete=!0,a.deleteEvent=function(a){a.$delete(function(){d.reload()})},a.editEvent=function(a){c.path("/events/"+a.id+"/edit")}}]).controller("EventViewCtrl",["$scope","$rootScope","$location","$routeParams","Events",function(a,b,c,d,e){b.$path=c.path.bind(c),a.event=e.get({id:d.id}),a.canEdit=!0,a.canDelete=!0,a.deleteEvent=function(a){a.$delete(function(){c.path("/events")})},a.editEvent=function(a){c.path("/events/"+a.id+"/edit")}}]).controller("EventEditCtrl",["$scope","$rootScope","$location","$routeParams","Events",function(a,b,c,d,e){b.$path=c.path.bind(c),a.event=e.get({id:d.id}),a.canEdit=!1,a.canDelete=!0,a.deleteEvent=function(a){a.$delete(function(){c.path("/events")})},a.updateEvent=function(){a.event.$update(function(){c.path("/events/"+a.event.id)})}}]).controller("EventNewCtrl",["$scope","$rootScope","$location","Events",function(a,b,c,d){function e(a){return!isNaN(a)&&parseInt(Number(a))===a&&!isNaN(parseInt(a,10))}b.$path=c.path.bind(c),a.event=new d,a.canEdit=!1,a.canDelete=!1,a.addEvent=function(){e(a.event.count)||(a.event.count=0),a.event.$save(function(){c.path("/events")})}}]),angular.module("snowplow.SprayEvent").factory("Events",["$resource",function(a){return a("api/events/:id",{id:"@id"},{update:{method:"PUT"}})}]);