text: var applicationDetailModule=angular.module("applicationDetail",[]);applicationDetailModule.controller("MainController",["$scope","$http","$location",function(e,a,t){function r(){a.get("/applications/"+e.applicationKey).success(function(a){e.application=a.application}).error(function(){window.location.href="/admin/apps"})}e.updateApplication=function(){if($("#general-alert .alert").alert("close"),""!==e.application.name){$("#application-name-form-group").removeClass("has-error");var t={};t.name=e.application.name,t.description=e.application.description,a.put("/applications/"+e.applicationKey,{application:t},{headers:{"Content-Type":"application/x-www-form-urlencoded"}}).success(function(){$("#general-alert").html('<div class="alert alert-success fade in">Successfully update application <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>')}).error(function(e){var a=e.error?e.error:"Unable to update the applitacion";$("#general-alert").html('<div class="alert alert-danger fade in">Error: '+a+' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>')})}else $("#application-name-form-group").addClass("has-error")},e.regenerateClientSecret=function(){$("#regenerate-client-secret-modal").modal("hide"),a.post("/applications/"+e.applicationKey+"/client/secret").success(function(){e.refreshRequired=!0}).error(function(e){var a=e.error?e.error:"Unable to regenerate the client secret";$("#general-alert").html('<div class="alert alert-danger fade in">Error: '+a+' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>')})},e.regenerateServerResponseKey=function(){$("#regenerate-server-response-key-modal").modal("hide"),a.post("/applications/"+e.applicationKey+"/server/key").success(function(){e.refreshRequired=!0}).error(function(e){var a=e.error?e.error:"Unable to regenerate the server response key";$("#general-alert").html('<div class="alert alert-danger fade in">Error: '+a+' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>')})},e.deleteApplication=function(){$("#delete-application-modal").modal("hide"),a.delete("/applications/"+e.applicationKey).success(function(){window.location.href="/admin/apps"}).error(function(e){var a=e.error?e.error:"Unable to delete applitacion";$("#general-alert").html('<div class="alert alert-danger fade in">Error: '+a+' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>')})},$("#regenerate-client-secret-modal").on("show.bs.modal",function(){$("#general-alert .alert").alert("close")}),$("#regenerate-client-secret-modal").on("hidden.bs.modal",function(){e.refreshRequired&&($("#general-alert").html('<div class="alert alert-success fade in">Successfully regenerated the client secret <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>'),r(),e.refreshRequired=!1)}),$("#regenerate-server-response-key-modal").on("show.bs.modal",function(){$("#general-alert .alert").alert("close")}),$("#regenerate-server-response-key-modal").on("hidden.bs.modal",function(){e.refreshRequired&&($("#general-alert").html('<div class="alert alert-success fade in">Successfully regenerated the server response key <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>'),r(),e.refreshRequired=!1)}),$("#delete-application-modal").on("show.bs.modal",function(){$("#general-alert .alert").alert("close")}),e.applicationKey=function(){var e=t.absUrl(),a=e.lastIndexOf("/"),r=e.indexOf("?");return r>0?e.substring(a+1,r):e.substring(a+1)}(),e.application={},e.refreshRequired=!1,r()}]);