Merge branch 'master-redesign' of https://github.com/sharelatex/web-sharelatex into master-redesign

This commit is contained in:
Henry Oswald 2014-07-17 14:23:55 +01:00
commit b54c351956
7 changed files with 88 additions and 10 deletions

View file

@ -31,10 +31,17 @@ aside#left-menu.full-size(
br
| PDF
span(ng-controller="TemplatesController", ng-show="permissions.admin")
h4() Publish
ul.list-unstyled.nav()
li
span
h4 Actions
ul.list-unstyled.nav
li(ng-controller="CloneProjectController")
a(
href,
ng-click="openCloneProjectModal()"
)
i.fa.fa-fw.fa-copy
|   Copy Project
li(ng-controller="TemplatesController", ng-show="permissions.admin")
a(ng-click="openPublishTemplateModal()")
i.fa.fa-external-link.fa-fw
|   Publish as Template
@ -125,4 +132,31 @@ aside#left-menu.full-size(
ng-show="ui.leftMenuShown",
ng-click="ui.leftMenuShown = false"
ng-cloak
)
)
script(type='text/ng-template', id='cloneProjectModalTemplate')
.modal-header
h3 Copy Project
.modal-body
form(name="cloneProjectForm", novalidate)
.form-group
label New Name
input.form-control(
type="text",
placeholder="New Project Name",
required,
ng-model="inputs.projectName",
on-enter="clone()",
focus-on="open"
)
.modal-footer
button.btn.btn-default(
ng-disabled="state.inflight"
ng-click="cancel()"
) Cancel
button.btn.btn-primary(
ng-disabled="cloneProjectForm.$invalid || state.inflight"
ng-click="clone()"
)
span(ng-hide="state.inflight") Copy
span(ng-show="state.inflight") Copying...

View file

@ -11,6 +11,7 @@ define [
"ide/settings/index"
"ide/share/index"
"ide/chat/index"
"ide/clone/index"
"ide/templates/index"
"ide/dropbox/index"
"ide/directives/layout"

View file

@ -0,0 +1,9 @@
define [
"base"
], (App) ->
App.controller 'CloneProjectController', ($scope, $modal) ->
$scope.openCloneProjectModal = () ->
$modal.open {
templateUrl: "cloneProjectModalTemplate"
controller: "CloneProjectModalController"
}

View file

@ -0,0 +1,29 @@
define [
"base"
], (App) ->
App.controller 'CloneProjectModalController', ($scope, $modalInstance, $timeout, $http, ide) ->
$scope.inputs =
projectName: ide.$scope.project.name + " (Copy)"
$scope.state =
inflight: false
$modalInstance.opened.then () ->
$timeout () ->
$scope.$broadcast "open"
, 200
cloneProject = (cloneName) ->
$http.post("/project/#{ide.$scope.project._id}/clone", {
_csrf: window.csrfToken
projectName: cloneName
})
$scope.clone = () ->
$scope.state.inflight = true
cloneProject($scope.inputs.projectName)
.then (data) ->
console.log "DATA", data
#window.location = "/project/#{data.project_id}"
$scope.cancel = () ->
$modalInstance.dismiss('cancel')

View file

@ -0,0 +1,4 @@
define [
"ide/clone/controllers/CloneProjectController"
"ide/clone/controllers/CloneProjectModalController"
]

View file

@ -105,8 +105,9 @@ define [], () ->
tryReconnect: () ->
@cancelReconnect()
@$scope.connection.reconnecting = true
delete @$scope.connection.reconnection_countdown
return if @connected
@$scope.connection.reconnecting = true
@ide.socket.socket.reconnect()
setTimeout (=> @startAutoReconnectCountdown() if !@connected), 2000

View file

@ -493,7 +493,7 @@ define [
$modalInstance.opened.then () ->
$timeout () ->
$scope.$broadcast "open"
, 700
, 200
$scope.create = () ->
$modalInstance.close($scope.inputs.newTagName)
@ -508,7 +508,7 @@ define [
$modalInstance.opened.then () ->
$timeout () ->
$scope.$broadcast "open"
, 700
, 200
$scope.rename = () ->
$modalInstance.close($scope.inputs.projectName)
@ -525,7 +525,7 @@ define [
$modalInstance.opened.then () ->
$timeout () ->
$scope.$broadcast "open"
, 700
, 200
$scope.clone = () ->
$scope.state.inflight = true
@ -547,7 +547,7 @@ define [
$modalInstance.opened.then () ->
$timeout () ->
$scope.$broadcast "open"
, 700
, 200
$scope.create = () ->
$scope.state.inflight = true