angular.module('StatusApp', ['ngSanitize'])
	.controller('StatusController', function ($scope) {
		$scope.sites = [];
		$scope.sites_open = {};
		$scope.sites_details = {};
		var socket = io.connect('///');
		socket.on('hello', function (data) {
			console.log('hello', data);
			socket.emit('list', {});
		});
		socket.on('list', function (data) {
			$scope.$apply(function () {
				$scope.sites = data.list;
			});
		});
		socket.on('details', function (data) {
			if (!data || !data.name) {
				return;
			}
			$scope.$apply(function () {
				$scope.sites_details[data.name] = data;
			});
		});
		socket.on('notify', function (data) {
			$scope.$apply(function () {
				$scope.sites.forEach(function (site) {
					if (site.name === data.name) {
						site.state = data.state;
					}
				});
				if ($scope.sites_open[data.name]) {
					console.log('req details');
					socket.emit('details', {name: data.name});
				}
			});
		});
		$scope.toggle = function (site) {
			$scope.sites_open[site.name] = !$scope.sites_open[site.name];
			if ($scope.sites_open[site.name]) {
				socket.emit('details', {name: site.name});
			}
		};
		$scope.rebuild = function (site) {
			socket.emit('rebuild', {name: site.name});
		};
	})
	.filter('logmsg', function () {
		return function (input) {
			if (!input) {
				return '';
			}
			if (typeof input !== 'string') {
				return JSON.stringify(input);
			}
			return input.toString().split('\n').filter(function (s) {
				return s.trim().length > 0;
			}).join('<br/>');
		};
	});


@@ -86,20 +86,31 @@
  ($scope
+, $location
 ) %7B%0A
-
 %09%09$scope
@@ -177,16 +177,47 @@
 s = %7B%7D;%0A
+%09%09var path = $location.path();%0A
 %09%09var so
@@ -239,16 +239,45 @@
 ct('///'
+, %7Bpath: path + '/socket.io'%7D
 );%0A%09%09soc

use location path in socket.io