diff --git a/bower.json b/bower.json index dba0329..0bdb160 100644 --- a/bower.json +++ b/bower.json @@ -1,30 +1,31 @@ { "name": "manticore", "version": "0.0.0", "dependencies": { "angular": "1.4.1", "json3": "3.3.1", "es5-shim": "4.1.7", "jquery": "1.11.0", "bootstrap": "~3.1.1", "angular-resource": "1.4.1", "angular-cookies": "1.4.1", "angular-sanitize": "1.4.1", "angular-bootstrap": "0.13.0", "font-awesome": ">=4.1.0", "lodash": "3.9.3", "angular-ui-router": "0.2.15", "angular-file-upload": "1.1.5", "wodo": "http://webodf.org/download/wodocollabtexteditor-0.5.8.preview1.zip", "angular-file-saver": "~0.0.4", "angular-smart-table": "~2.1.0", - "angular-moment": "~0.10.1" + "angular-moment": "~0.10.1", + "angular-load": "~0.2.0" }, "devDependencies": { "angular-mocks": "1.4.1", "angular-scenario": "1.4.1" }, "resolutions": { "angular": "1.4.1" } } diff --git a/client/app/app.js b/client/app/app.js index 8424b71..0eee4ed 100644 --- a/client/app/app.js +++ b/client/app/app.js @@ -1,57 +1,58 @@ 'use strict'; angular.module('manticoreApp', [ 'ngCookies', 'ngResource', 'ngSanitize', 'ui.router', 'ui.bootstrap', 'angularFileUpload', 'fileSaver', 'smart-table', - 'angularMoment' + 'angularMoment', + 'angularLoad' ]) .config(function ($stateProvider, $urlRouterProvider, $locationProvider, $httpProvider) { $urlRouterProvider .otherwise('/'); $locationProvider.html5Mode(true); $httpProvider.interceptors.push('authInterceptor'); }) .factory('authInterceptor', function ($rootScope, $q, $cookieStore, $location) { return { // Add authorization token to headers request: function (config) { config.headers = config.headers || {}; if ($cookieStore.get('token')) { config.headers.Authorization = 'Bearer ' + $cookieStore.get('token'); } return config; }, // Intercept 401s and redirect you to login responseError: function(response) { if(response.status === 401) { $location.path('/login'); // remove any stale tokens $cookieStore.remove('token'); return $q.reject(response); } else { return $q.reject(response); } } }; }) .run(function ($rootScope, $location, Auth) { // Redirect to login if route requires auth and you're not logged in $rootScope.$on('$stateChangeStart', function (event, next) { Auth.isLoggedInAsync(function(loggedIn) { if (next.authenticate && !loggedIn) { $location.path('/login'); } }); }); }); diff --git a/client/app/editor/editor.js b/client/app/editor/editor.js index 0fcfbda..0feb7e1 100644 --- a/client/app/editor/editor.js +++ b/client/app/editor/editor.js @@ -1,22 +1,25 @@ 'use strict'; angular.module('manticoreApp') .config(function ($stateProvider) { $stateProvider .state('editor', { url: '/document/:id', reload: true, resolve: { + socketio: function (angularLoad) { + return angularLoad.loadScript('socket.io/socket.io.js'); + }, document: function ($stateParams, $http) { return $http.get('/api/documents/' + $stateParams.id) .then(function(response) { return response.data; }); } }, templateUrl: 'app/editor/editor.html', controller: function ($scope, document) { $scope.document = document; } }); }); diff --git a/client/index.html b/client/index.html index 1a25fcc..5c637a0 100644 --- a/client/index.html +++ b/client/index.html @@ -1,87 +1,87 @@
+ -