Restructure public/coffee/app folders slightly

This commit is contained in:
James Allen 2014-06-23 17:47:08 +01:00
parent 6f17e0bb82
commit 84f998ba4a
6 changed files with 34 additions and 27 deletions

View file

@ -1,6 +1,7 @@
define [
"base"
"ide/file-tree/FileTreeManager"
"ide/connection/ConnectionManager"
"ide/directives/layout"
"ide/services/ide"
"directives/focus"
@ -9,6 +10,7 @@ define [
], (
App
FileTreeManager
ConnectionManager
) ->
App.controller "IdeController", ["$scope", "$timeout", "ide", ($scope, $timeout, ide) ->
$scope.state = {
@ -20,31 +22,9 @@ define [
ide.project_id = $scope.project_id = window.project_id
ide.$scope = $scope
ide.socket = io.connect null,
reconnect: false
"force new connection": true
ide.connectionManager = new ConnectionManager(ide, $scope)
ide.fileTreeManager = new FileTreeManager(ide, $scope)
ide.socket.on "connect", () ->
$scope.$apply () ->
$scope.state.load_progress = 80
joinProject = () =>
ide.socket.emit 'joinProject', {
project_id: ide.project_id
}, (err, project, permissionsLevel, protocolVersion) =>
if $scope.protocolVersion? and $scope.protocolVersion != protocolVersion
location.reload(true)
$scope.$apply () ->
$scope.protocolVersion = protocolVersion
$scope.project = project
$scope.state.load_progress = 100
$scope.state.loading = false
$scope.$emit "project:joined"
setTimeout(joinProject, 100) ]
]
angular.bootstrap(document.body, ["SharelatexApp"])

View file

@ -0,0 +1,27 @@
define [], () ->
class ConnectionManager
constructor: (@ide, @$scope) ->
@ide.socket = io.connect null,
reconnect: false
"force new connection": true
@ide.socket.on "connect", () =>
@$scope.$apply () =>
@$scope.state.load_progress = 80
joinProject = () =>
@ide.socket.emit 'joinProject', {
project_id: @ide.project_id
}, (err, project, permissionsLevel, protocolVersion) =>
if @$scope.protocolVersion? and @$scope.protocolVersion != protocolVersion
location.reload(true)
@$scope.$apply () =>
@$scope.protocolVersion = protocolVersion
@$scope.project = project
@$scope.state.load_progress = 100
@$scope.state.loading = false
@$scope.$emit "project:joined"
setTimeout(joinProject, 100)

View file

@ -1,7 +1,7 @@
define [
"project-list"
"user-details"
"account-settings"
"main/project-list"
"main/user-details"
"main/account-settings"
"directives/asyncForm"
"directives/stopPropagation"
"directives/focusInput"