Explorar o código

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

Henry Oswald %!s(int64=12) %!d(string=hai) anos
pai
achega
c95730dd63

+ 11 - 2
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
+			i.fa.fa-long-arrow-left
+			
+div.full-size(
+	ng-if="ui.pdfLayout == 'flat'"
+	ng-show="ui.view == 'pdf'"
+)
+	include ./pdf
+	

+ 14 - 0
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(

+ 22 - 1
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(	

+ 1 - 0
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

+ 7 - 0
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")
+							
 		}
 	]

+ 17 - 2
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) ->

+ 1 - 1
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;
 			}

+ 30 - 1
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 {