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

This commit is contained in:
Henry Oswald 2014-07-22 13:42:37 +01:00
commit c95730dd63
8 changed files with 103 additions and 7 deletions

View file

@ -1,6 +1,7 @@
div.full-size( div.full-size(
ng-show="ui.view == 'editor'" ng-show="ui.view == 'editor'"
layout="pdf" layout="pdf"
layout-disabled="ui.pdfLayout != 'sideBySide'"
resize-on="layout:main:resize" resize-on="layout:main:resize"
resize-proportionally="true" resize-proportionally="true"
initial-size-east="'50%'" initial-size-east="'50%'"
@ -31,6 +32,7 @@ div.full-size(
) )
.ui-layout-east .ui-layout-east
div(ng-if="ui.pdfLayout == 'sideBySide'")
include ./pdf include ./pdf
.ui-layout-resizer-controls.synctex-controls( .ui-layout-resizer-controls.synctex-controls(
@ -52,3 +54,10 @@ div.full-size(
ng-click="syncToCode()" ng-click="syncToCode()"
) )
i.fa.fa-long-arrow-left i.fa.fa-long-arrow-left
div.full-size(
ng-if="ui.pdfLayout == 'flat'"
ng-show="ui.view == 'pdf'"
)
include ./pdf

View file

@ -73,6 +73,20 @@ aside#file-tree(ng-controller="FileTreeController")
span {{ entity.name }} span {{ entity.name }}
div(ng-show="ui.pdfLayout == 'flat' && (ui.view == 'editor' || ui.view == 'pdf')")
ul.list-unstyled.file-tree-list
li(
ng-class="{ 'selected': ui.view == 'pdf' }"
)
.entity
.entity-name(
ng-click="ui.view = 'pdf'"
)
i.fa.fa-fw.toggle
i.fa.fa-fw.fa-file-pdf-o
| PDF
script(type='text/ng-template', id='entityListItemTemplate') script(type='text/ng-template', id='entityListItemTemplate')
li( li(
ng-class="{ 'selected': entity.selected }", ng-class="{ 'selected': entity.selected }",

View file

@ -1,4 +1,4 @@
div.full-size(ng-controller="PdfController") div.full-size.pdf(ng-controller="PdfController")
.toolbar.toolbar-tall .toolbar.toolbar-tall
a.btn.btn-info( a.btn.btn-info(
href, href,
@ -27,6 +27,27 @@ div.full-size(ng-controller="PdfController")
}" }"
) {{ pdf.logEntries.errors.length + pdf.logEntries.warnings.length }} ) {{ pdf.logEntries.errors.length + pdf.logEntries.warnings.length }}
.toolbar-right
a(
href,
ng-click="switchToFlatLayout()"
ng-show="ui.pdfLayout == 'sideBySide'"
tooltip="Full screen"
tooltip-placement="bottom"
tooltip-append-to-body="true"
)
i.full-screen
a(
href,
ng-click="switchToSideBySideLayout()"
ng-show="ui.pdfLayout == 'flat'"
tooltip="Split screen"
tooltip-placement="bottom"
tooltip-append-to-body="true"
)
i.split-screen
i.split-screen
.pdf-viewer(ng-show="pdf.url && pdf.view == 'pdf' && !pdf.failure && !pdf.timeout && !pdf.error") .pdf-viewer(ng-show="pdf.url && pdf.view == 'pdf' && !pdf.failure && !pdf.timeout && !pdf.error")
div( div(
pdfjs pdfjs

View file

@ -50,6 +50,7 @@ define [
leftMenuShown: false leftMenuShown: false
view: "editor" view: "editor"
chatOpen: false chatOpen: false
pdfLayout: 'sideBySide'
} }
$scope.user = window.user $scope.user = window.user
$scope.settings = window.userSettings $scope.settings = window.userSettings

View file

@ -102,5 +102,12 @@ define [
resetOpenStates() resetOpenStates()
onInternalResize() onInternalResize()
scope.$watch attrs.layoutDisabled, (value) ->
if value
element.layout().hide("east")
else
element.layout().show("east")
} }
] ]

View file

@ -4,7 +4,7 @@ define [
], (App, LogParser) -> ], (App, LogParser) ->
App.controller "PdfController", ["$scope", "$http", "ide", "$modal", "synctex", ($scope, $http, ide, $modal, synctex) -> App.controller "PdfController", ["$scope", "$http", "ide", "$modal", "synctex", ($scope, $http, ide, $modal, synctex) ->
autoCompile = true autoCompile = true
$scope.$on "doc:opened", () -> $scope.$on "project:joined", () ->
return if !autoCompile return if !autoCompile
autoCompile = false autoCompile = false
$scope.recompile(isAutoCompile: true) $scope.recompile(isAutoCompile: true)
@ -148,6 +148,21 @@ define [
{doc, line} = data {doc, line} = data
ide.editorManager.openDoc(doc, gotoLine: line) ide.editorManager.openDoc(doc, gotoLine: line)
$scope.switchToFlatLayout = () ->
$scope.ui.pdfLayout = 'flat'
$scope.ui.view = 'pdf'
$.localStorage "pdf.layout", "flat"
$scope.switchToSideBySideLayout = () ->
$scope.ui.pdfLayout = 'sideBySide'
$scope.ui.view = 'editor'
$.localStorage "pdf.layout", "split"
if pdfLayout = $.localStorage("pdf.layout")
$scope.switchToSideBySideLayout() if pdfLayout == "split"
$scope.switchToFlatLayout() if pdfLayout == "flat"
else
$scope.switchToSideBySideLayout()
] ]
App.factory "synctex", ["ide", "$http", "$q", (ide, $http, $q) -> App.factory "synctex", ["ide", "$http", "$q", (ide, $http, $q) ->

View file

@ -54,7 +54,7 @@ aside#file-tree {
font-size: 14px; font-size: 14px;
} }
i.fa-file, i.fa-image { i.fa-file, i.fa-image, i.fa-file-pdf-o {
color: @gray-light; color: @gray-light;
font-size: 14px; font-size: 14px;
} }

View file

@ -73,7 +73,7 @@
} }
} }
.toolbar { .pdf .toolbar {
.log-btn { .log-btn {
&.active, &:active { &.active, &:active {
.label { .label {
@ -87,6 +87,35 @@
} }
} }
} }
.toolbar-right {
margin-right: @line-height-computed / 2;
a {
&:hover {
i {
box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.25);
border-color: @gray-dark;
}
}
i {
display: inline-block;
width: 16px;
height: 16px;
border: 1px solid @gray-light;
margin-top: 5px;
}
i.full-screen {
border-top-width: 3px;
border-radius: 2px;
}
i.split-screen {
width: 7px;
border-top-width: 3px;
border-radius: 2px;
margin-left: 2px;
}
}
}
} }
.pdf-logs { .pdf-logs {