{I" class:ETI"BundledAsset;FI"logical_path;TI"/hyper_admin/angularjs/services/resource.js;FI" pathname;TI"q/home/sindre/Code/hyper/hyper_admin/app/assets/javascripts/hyper_admin/angularjs/services/resource.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;Tl+ÙîTI" length;TiØ I" digest;TI"%1260487cb1113ef63f22cb4d182e4127;FI" source;TI"Ø (function() { angular.module("hyperadmin").factory("Resource", function($location, $rootScope, $state, $urlRouter, Restangular) { var menuStates, registerStates; Restangular.all("admin/resource_classes").getList().then((function(_this) { return function(resources) { _this.resources = Restangular.stripRestangular(resources); return registerStates(); }; })(this)); registerStates = (function(_this) { return function() { _this.resources.forEach(function(resource) { return stateProvider.state("" + resource.plural, { url: "/admin/" + resource.plural, templateUrl: function() { return "/admin/" + resource.plural + ".html"; }, controller: "IndexCtrl as indexCtrl", data: { resource: resource } }).state("" + resource.plural + ".new", { url: "/new", templateUrl: function() { return "/admin/" + resource.plural + "/new.html"; }, controller: "NewCtrl as newCtrl", data: { resource: resource, mode: "new" } }).state("" + resource.plural + ".show", { url: "/:id", templateUrl: function(params) { return "/admin/" + resource.plural + "/" + params.id + ".html"; }, controller: "ShowCtrl as showCtrl", data: { resource: resource } }).state("" + resource.plural + ".edit", { url: "/:id/edit", templateUrl: function(params) { return "/admin/" + resource.plural + "/" + params.id + "/edit.html"; }, controller: "EditCtrl as editCtrl", data: { resource: resource, mode: "edit" } }); }); $state.get().forEach(function(state) { var match, url; if (!state.templateUrl) { return; } url = state.templateUrl("nothing").replace(/undefined/, "(\\d+)").replace("\.html", ""); match = $location.path().match("^" + url + "$"); if (match) { return $state.go(state, { id: match[1] }); } }); return $rootScope.$emit("resources:states:registered"); }; })(this); menuStates = (function(_this) { return function() { return _this.resources.map(function(resource) { return { list_state: "" + resource.plural, label: resource.menu_label }; }); }; })(this); return { menuStates: menuStates }; }); }).call(this); ;TI"required_assets_digest;TI"%5cd8b46b6159b1df51ecf0ae43f8e199;FI" _version;TI"%3e3098c8a5e9a7f3b984ba95ac600637;F