diff --git a/services/web/app/views/project/editor/editor.jade b/services/web/app/views/project/editor/editor.jade index 1e2d1dfd27..4a327dc40a 100644 --- a/services/web/app/views/project/editor/editor.jade +++ b/services/web/app/views/project/editor/editor.jade @@ -1,6 +1,7 @@ div.full-size( ng-show="ui.view == 'editor'" layout="pdf" + layout-disabled="ui.pdfLayout != 'sideBySide'" resize-on="layout:main:resize" resize-proportionally="true" initial-size-east="'50%'" @@ -31,7 +32,8 @@ div.full-size( ) .ui-layout-east - include ./pdf + div(ng-if="ui.pdfLayout == 'sideBySide'") + include ./pdf .ui-layout-resizer-controls.synctex-controls( ng-show="!!pdf.url && settings.pdfViewer == 'pdfjs'" @@ -51,4 +53,11 @@ div.full-size( tooltip-append-to-body="true" ng-click="syncToCode()" ) - i.fa.fa-long-arrow-left \ No newline at end of file + i.fa.fa-long-arrow-left + +div.full-size( + ng-if="ui.pdfLayout == 'flat'" + ng-show="ui.view == 'pdf'" +) + include ./pdf + \ No newline at end of file diff --git a/services/web/app/views/project/editor/file-tree.jade b/services/web/app/views/project/editor/file-tree.jade index efbc107ef5..506fec5040 100644 --- a/services/web/app/views/project/editor/file-tree.jade +++ b/services/web/app/views/project/editor/file-tree.jade @@ -72,6 +72,20 @@ aside#file-tree(ng-controller="FileTreeController") i.fa.fa-fw.fa-file 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') li( diff --git a/services/web/app/views/project/editor/pdf.jade b/services/web/app/views/project/editor/pdf.jade index 7e6617747b..41c5d0a60d 100644 --- a/services/web/app/views/project/editor/pdf.jade +++ b/services/web/app/views/project/editor/pdf.jade @@ -1,4 +1,4 @@ -div.full-size(ng-controller="PdfController") +div.full-size.pdf(ng-controller="PdfController") .toolbar.toolbar-tall a.btn.btn-info( href, @@ -26,6 +26,27 @@ div.full-size(ng-controller="PdfController") 'label-danger': pdf.logEntries.errors.length > 0\ }" ) {{ 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") div( diff --git a/services/web/public/coffee/ide.coffee b/services/web/public/coffee/ide.coffee index 2ea76ea57d..1cd92c2dd0 100644 --- a/services/web/public/coffee/ide.coffee +++ b/services/web/public/coffee/ide.coffee @@ -50,6 +50,7 @@ define [ leftMenuShown: false view: "editor" chatOpen: false + pdfLayout: 'sideBySide' } $scope.user = window.user $scope.settings = window.userSettings diff --git a/services/web/public/coffee/ide/directives/layout.coffee b/services/web/public/coffee/ide/directives/layout.coffee index 891d04f647..d3cd1a11de 100644 --- a/services/web/public/coffee/ide/directives/layout.coffee +++ b/services/web/public/coffee/ide/directives/layout.coffee @@ -102,5 +102,12 @@ define [ resetOpenStates() onInternalResize() + + scope.$watch attrs.layoutDisabled, (value) -> + if value + element.layout().hide("east") + else + element.layout().show("east") + } ] \ No newline at end of file diff --git a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee index ea812ca3b8..48405c3c26 100644 --- a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee +++ b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee @@ -4,7 +4,7 @@ define [ ], (App, LogParser) -> App.controller "PdfController", ["$scope", "$http", "ide", "$modal", "synctex", ($scope, $http, ide, $modal, synctex) -> autoCompile = true - $scope.$on "doc:opened", () -> + $scope.$on "project:joined", () -> return if !autoCompile autoCompile = false $scope.recompile(isAutoCompile: true) @@ -147,7 +147,22 @@ define [ .then (data) -> {doc, line} = data 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) -> diff --git a/services/web/public/stylesheets/app/editor/file-tree.less b/services/web/public/stylesheets/app/editor/file-tree.less index 7cdb11d6af..92925bc59b 100644 --- a/services/web/public/stylesheets/app/editor/file-tree.less +++ b/services/web/public/stylesheets/app/editor/file-tree.less @@ -54,7 +54,7 @@ aside#file-tree { font-size: 14px; } - i.fa-file, i.fa-image { + i.fa-file, i.fa-image, i.fa-file-pdf-o { color: @gray-light; font-size: 14px; } diff --git a/services/web/public/stylesheets/app/editor/pdf.less b/services/web/public/stylesheets/app/editor/pdf.less index e88d9bfd65..a5e0fc5221 100644 --- a/services/web/public/stylesheets/app/editor/pdf.less +++ b/services/web/public/stylesheets/app/editor/pdf.less @@ -73,7 +73,7 @@ } } -.toolbar { +.pdf .toolbar { .log-btn { &.active, &:active { .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 {