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

This commit is contained in:
Shane Kilkelly 2016-02-24 10:27:44 +00:00
commit 34bfdcc246
7 changed files with 46 additions and 24 deletions

View file

@ -53,7 +53,13 @@ block content
include ./editor/share
#ide-body(ng-cloak, layout="main", ng-hide="state.loading", resize-on="layout:chat:resize")
#ide-body(
ng-cloak,
layout="main",
ng-hide="state.loading",
resize-on="layout:chat:resize",
minimum-restore-size-west="130"
)
.ui-layout-west
include ./editor/file-tree

View file

@ -6,6 +6,7 @@ div.full-size(
resize-on="layout:main:resize"
resize-proportionally="true"
initial-size-east="'50%'"
minimum-restore-size-east="300"
)
.ui-layout-center
.loading-panel(ng-show="!editor.sharejs_doc || editor.opening")

View file

@ -46,26 +46,24 @@ aside#file-tree(ng-controller="FileTreeController", ng-class="{ 'multi-selected'
ng-controller="FileTreeRootFolderController",
ng-class="{ 'no-toolbar': !permissions.write }"
)
div(ng-show="ui.pdfLayout == 'flat' && (ui.view == 'editor' || ui.view == 'pdf' || ui.view == 'file')")
ul.list-unstyled.file-tree-list
li(
ng-class="{ 'selected': ui.view == 'pdf' }"
ng-controller="PdfViewToggleController"
)
.entity
.entity-name(
ng-click="togglePdfView()"
)
i.fa.fa-fw.toggle
i.fa.fa-fw.fa-file-pdf-o
| PDF
ul.list-unstyled.file-tree-list(
droppable="permissions.write"
accept=".entity-name"
on-drop-callback="onDrop"
)
li(
ng-show="ui.pdfLayout == 'flat' && (ui.view == 'editor' || ui.view == 'pdf' || ui.view == 'file')"
ng-class="{ 'selected': ui.view == 'pdf' }"
ng-controller="PdfViewToggleController"
)
.entity
.entity-name(
ng-click="togglePdfView()"
)
i.fa.fa-fw.toggle
i.fa.fa-fw.fa-file-pdf-o
| PDF
file-entity(
entity="entity",
permissions="permissions",

View file

@ -37,8 +37,12 @@ define [
# Restore previously recorded state
if (state = ide.localStorage("layout.#{name}"))?
options.west = state.west
options.east = state.east
if state.east?
if !attrs.minimumRestoreSizeEast? or (state.east.size >= attrs.minimumRestoreSizeEast and !state.east.initClosed)
options.east = state.east
if state.west?
if !attrs.minimumRestoreSizeWest? or (state.west.size >= attrs.minimumRestoreSizeWest and !state.west.initClosed)
options.west = state.west
repositionControls = () ->
state = element.layout().readState()

View file

@ -1,6 +1,7 @@
define [
"base"
], (App) ->
MAX_PROJECT_NAME_LENGTH = 150
App.controller "ProjectNameController", ["$scope", "settings", "ide", ($scope, settings, ide) ->
$scope.state =
renaming: false
@ -12,11 +13,12 @@ define [
$scope.$emit "project:rename:start"
$scope.finishRenaming = () ->
newName = $scope.inputs.name
if newName.length < 150
$scope.project.name = newName
settings.saveProjectSettings({name: $scope.project.name})
$scope.state.renaming = false
newName = $scope.inputs.name
if !newName? or newName.length == 0 or newName.length > MAX_PROJECT_NAME_LENGTH
return
$scope.project.name = newName
settings.saveProjectSettings({name: $scope.project.name})
ide.socket.on "projectNameUpdated", (name) ->
$scope.$apply () ->

View file

@ -257,9 +257,11 @@ define [
modalInstance.result.then (project_id) ->
window.location = "/project/#{project_id}"
MAX_PROJECT_NAME_LENGTH = 150
$scope.renameProject = (project, newName) ->
if newName.length < 150
project.name = newName
if !newName? or newName.length == 0 or newName.length > MAX_PROJECT_NAME_LENGTH
return
project.name = newName
queuedHttp.post "/project/#{project.id}/rename", {
newProjectName: project.name
_csrf: window.csrfToken

View file

@ -109,6 +109,15 @@
}
a.rename {
visibility: hidden;
display: inline-block;
color: @gray-light;
padding: 5px;
border-radius: @border-radius-small;
&:hover {
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
color: @gray-dark;
text-decoration: none;
}
}
&:hover {
a.rename {