Просмотр исходного кода

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

Henry Oswald 12 лет назад
Родитель
Сommit
2c7d19d79b

+ 2 - 2
services/web/app/views/layout/navbar.jade

@@ -1,11 +1,11 @@
 nav.navbar.navbar-default
 	.container-fluid
 		.navbar-header
-			button.navbar-toggle(data-toggle="collapse",data-target="#navbar-collapse")
+			button.navbar-toggle(ng-init="navCollapsed = true", ng-click="navCollapsed = !navCollapsed", ng-class="{active: !navCollapsed}")
 				i.fa.fa-bars
 			a(href='/').navbar-brand
 
-		.navbar-collapse.collapse#navbar-collapse
+		.navbar-collapse.collapse(collapse="navCollapsed")
 			ul.nav.navbar-nav.navbar-right
 				each item in nav.header
 					if ((item.only_when_logged_in && session && session.user) || (item.only_when_logged_out && (!session || !session.user)) || (!item.only_when_logged_out && !item.only_when_logged_in))

+ 1 - 1
services/web/app/views/project/editor.jade

@@ -11,7 +11,7 @@ block content
 			.container
 				h3 Loading...
 				.progress
-					.progress-bar(ng-style="{'width': state.load_progress + '%'}")
+					.progress-bar(style="width: 20%", ng-style="{'width': state.load_progress + '%'}")
 
 		.global-alerts(ng-cloak)
 			.alert.alert-danger.small(ng-if="connection.forced_disconnect")

+ 2 - 1
services/web/app/views/project/editor/editor.jade

@@ -26,7 +26,8 @@ div.full-size(
 			goto-line="editor.gotoLine",
 			resize-on="layout:main:resize,layout:pdf:resize",
 			annotations="pdf.logEntryAnnotations[editor.open_doc_id]",
-			read-only="!permissions.write"
+			read-only="!permissions.write",
+			on-ctrl-enter="recompile"
 		)
 
 	.ui-layout-east

+ 14 - 6
services/web/app/views/project/editor/left-menu.jade

@@ -31,7 +31,7 @@ aside#left-menu.full-size(
 				br
 				| PDF
 				
-	span
+	span(ng-show="!anonymous")
 		h4 Actions
 		ul.list-unstyled.nav
 			li(ng-controller="CloneProjectController")
@@ -47,7 +47,7 @@ aside#left-menu.full-size(
 					|   Publish as Template
 
 
-	span(ng-controller="DropboxController")
+	span(ng-controller="DropboxController", ng-show="!anonymous")
 		h4() Sync
 		ul.list-unstyled.nav()
 			li
@@ -55,10 +55,10 @@ aside#left-menu.full-size(
 					i.fa.fa-dropbox.fa-fw
 					|    Dropbox
 
-	h4 Settings
-	form.settings(ng-controller="SettingsController")
+	h4(ng-show="!anonymous") Settings
+	form.settings(ng-controller="SettingsController", ng-show="!anonymous")
 		.containter-fluid
-			.form-controls
+			.form-controls(ng-show="permissions.write")
 				label(for="compiler") Compiler
 				select(
 					name="compiler"
@@ -68,6 +68,14 @@ aside#left-menu.full-size(
 					option(value='latex') LaTeX
 					option(value='xelatex') XeLaTeX
 					option(value='lualatex') LuaLaTeX
+					
+			.form-controls(ng-show="permissions.write")
+				label(for="rootDoc_id") Main document
+				select(
+					name="rootDoc_id",
+					ng-model="project.rootDoc_id",
+					ng-options="doc.doc.id as doc.path for doc in docs"
+				)
 
 			.form-controls
 				label(for="spellCheckLanguage") Spell Check
@@ -99,7 +107,7 @@ aside#left-menu.full-size(
 					each theme in themes
 						option(value=theme) #{theme}
 
-			.form-controls
+			.form-controls(ng-show="!anonymous")
 				label(for="mode") Keybindings
 				select(
 					name="mode"

+ 11 - 1
services/web/public/coffee/ide/editor/directives/aceEditor.coffee

@@ -34,7 +34,8 @@ define [
 				text: "="
 				readOnly: "="
 				annotations: "="
-				navigateHighlights: "="
+				navigateHighlights: "=",
+				onCtrlEnter: "="
 			}
 			link: (scope, element, attrs) ->
 				# Don't freak out if we're already in an apply callback
@@ -76,6 +77,15 @@ define [
 						ace.require("ace/ext/searchbox").Search(editor, true)
 					readOnly: true
 				editor.commands.removeCommand "replace"
+				
+				scope.$watch "onCtrlEnter", (callback) ->
+					if callback?
+						editor.commands.addCommand 
+							name: "compile",
+							bindKey: win: "Ctrl-Enter", mac: "Command-Enter"
+							exec: (editor) =>
+								callback()
+							readOnly: true
 
 				# Make '/' work for search in vim mode.
 				editor.showCommandLine = (arg) =>

+ 35 - 5
services/web/public/coffee/ide/file-tree/FileTreeManager.coffee

@@ -13,6 +13,10 @@ define [
 				@loadRootFolder()
 				@loadDeletedDocs()
 				@$scope.$emit "file-tree:initialized"
+				
+			@$scope.$watch "rootFolder", (rootFolder) =>
+				if rootFolder?
+					@recalculateDocList()
 
 			@_bindToSocketEvents()
 
@@ -116,17 +120,21 @@ define [
 						return @_findEntityByPathInFolder(entity, rest)
 			return null
 
-		forEachEntity: (callback = (entity, parent_folder) ->) ->
-			@_forEachEntityInFolder(@$scope.rootFolder, callback)
+		forEachEntity: (callback = (entity, parent_folder, path) ->) ->
+			@_forEachEntityInFolder(@$scope.rootFolder, null, callback)
 
 			for entity in @$scope.deletedDocs or []
 				callback(entity)
 
-		_forEachEntityInFolder: (folder, callback) ->
+		_forEachEntityInFolder: (folder, path, callback) ->
 			for entity in folder.children or []
-				callback(entity, folder)
+				if path?
+					childPath = path + "/" + entity.name
+				else
+					childPath = entity.name
+				callback(entity, folder, childPath)
 				if entity.children?
-					@_forEachEntityInFolder(entity, callback)
+					@_forEachEntityInFolder(entity, childPath, callback)
 
 		getEntityPath: (entity) ->
 			@_getEntityPathInFolder @$scope.rootFolder, entity
@@ -195,6 +203,28 @@ define [
 					type: "doc"
 					deleted: true
 				}
+				
+		recalculateDocList: () ->
+			@$scope.docs = []
+			@forEachEntity (entity, parentFolder, path) =>
+				if entity.type == "doc" and !entity.deleted
+					@$scope.docs.push {
+						doc:  entity
+						path: path
+					}
+			
+		getEntityPath: (entity) ->
+			@_getEntityPathInFolder @$scope.rootFolder, entity
+
+		_getEntityPathInFolder: (folder, entity) ->
+			for child in folder.children or []
+				if child == entity
+					return entity.name
+				else if child.type == "folder"
+					path = @_getEntityPathInFolder(child, entity)
+					if path?
+						return child.name + "/" + path
+			return null
 
 		getCurrentFolder: () ->
 			# Return the root folder if nothing is selected

+ 3 - 0
services/web/public/coffee/ide/pdf/controllers/PdfController.coffee

@@ -107,6 +107,9 @@ define [
 				.error () ->
 					$scope.pdf.compiling = false
 					$scope.pdf.error = true
+					
+		# This needs to be public.
+		ide.$scope.recompile = $scope.recompile
 
 		$scope.clearCache = () ->
 			$http {

+ 6 - 0
services/web/public/coffee/ide/settings/controllers/SettingsController.coffee

@@ -40,6 +40,12 @@ define [
 			if oldCompiler? and compiler != oldCompiler
 				settings.saveProjectSettings({compiler: compiler})
 
+		$scope.$watch "project.rootDoc_id", (rootDoc_id, oldRootDoc_id) =>
+			return if @ignoreUpdates
+			if oldRootDoc_id? and rootDoc_id != oldRootDoc_id
+				settings.saveProjectSettings({rootDocId: rootDoc_id})
+
+
 		ide.socket.on "compilerUpdated", (compiler) =>
 			@ignoreUpdates = true
 			$scope.$apply () =>

+ 1 - 1
services/web/public/stylesheets/app/editor/file-tree.less

@@ -33,7 +33,7 @@ aside#file-tree {
 			line-height: 2.6;
 
 			.entity-name {
-				color: @gray-dark;
+				color: @gray-darker;
 				cursor: pointer;
 				white-space: nowrap;
 				overflow: hidden;

+ 37 - 39
services/web/public/stylesheets/app/homepage.less

@@ -3,7 +3,6 @@
 	background-image: -webkit-linear-gradient(left,rgba(153,93,179,0.6),rgba(44,155,219,0.6));
 	background-image: linear-gradient(to right,rgba(153,93,179,0.6),rgba(44,155,219,0.6));
 	position: relative;
-	min-height: @line-height-computed * 29.5;
 	text-align: center;
 	overflow: hidden;
 	h1, p {
@@ -12,44 +11,49 @@
 	}
 	h1 {
 		font-size: 4.75rem;
-	  line-height: 6.25rem;
-	  margin-bottom: 0;
-		margin-top: @line-height-computed * 2;
+		line-height: 6.25rem;
+		margin-bottom: 0;
+		margin-top: @line-height-computed;
 		text-shadow: 0 1px 3px rgba(0,0,0,0.42);
 		span {
-			font-family: @font-family-base;
+			font-family: @font-family-sans-serif;
 			font-weight: 100;
-			letter-spacing: 10px;
+			letter-spacing: 5px;
 		}
 	}
 	p:first-of-type {
 		font-size: @line-height-computed;
 		font-weight: 200;
-		letter-spacing: 3px;
+		letter-spacing: 1px;
 		margin-top: 0;
 		text-rendering: auto;
+		margin-bottom: @line-height-computed;
 	}
-	.register {
-		margin-top: @line-height-computed * 4;
-		.input {
-			margin-bottom: @line-height-computed / 2;
-		}
-		div.error {
-			color: rgb(189, 7, 7);
-			padding: 1px;
-		}
-	}
-	.container-fluid {
+	.register-banner {
 		background-image: -webkit-linear-gradient(top,rgba(0,0,0,0.7),rgba(0,0,0,0.9));
 		background-image: linear-gradient(to bottom,rgba(0,0,0,0.7),rgba(0,0,0,0.9));
-		padding: 3rem 0;
-		margin-top: 4.5rem;
-		position: relative;
+		padding: @line-height-computed 0;
+		position: absolute;
+		bottom: 0;
+		width: 100%;
+		h2 {
+			color: white;
+			margin-top: 0;
+			font-family: @font-family-sans-serif;
+			font-weight: 500;
+			letter-spacing: 1px;
+		}
+		.form-group {
+			margin-left: @line-height-computed / 2;
+		}
 	}
-	img {
-		box-shadow: 0 0 50px rgba(0,0,0,.67);
-		margin-top: @line-height-computed;
-		margin-bottom: -@line-height-computed * 15;
+	.screenshot {
+		height: 450px;
+		overflow-y: hidden;
+		img {
+			box-shadow: 0 0 50px rgba(0,0,0,.67);
+			max-width: 100%;
+		}
 	}
 	.btn-hero {
 		background-color: transparent;
@@ -73,16 +77,16 @@
 }
 
 .universities {
-	overflow: hidden;
-	height: 160px;
-	border-left: none;
-	border-right: none;
+	// overflow: hidden;
+	// height: 160px;
+	// border-left: none;
+	// border-right: none;
 	padding-bottom: @line-height-computed;
 	text-align: center;
 	margin: 0 auto;
 	img {
 		max-width: 100%;
-		max-height: 80px;
+		max-height: 60px;
 	}
 }
 
@@ -92,15 +96,9 @@
 }
 
 .long-form-features {
-	.row {
-		margin-top: 4rem;
-		margin-bottom: 4rem;
-		.span7:first-child p {
-			margin-right: 12rem;
-		}
-		.span7:last-child p, .span7:last-child h3 {
-			margin-left: 12rem;
-		}
+	h2 {
+		margin-top: 0;
+		margin-bottom: @line-height-computed;
 	}
 	img {
 		border-radius: 3px;

+ 6 - 3
services/web/public/stylesheets/components/navbar.less

@@ -421,11 +421,14 @@
       color: @gray;
       padding: 12px 12px 13px;
       margin-left: 0;
-      &:hover,
-      &:focus {
+      &:hover {
         color: @gray-dark;
         background-color: @gray-lightest;
       }
+      &:focus {
+          color: @gray;
+          background-color: transparent;
+      }
     }
 
     @media (min-width: @grid-float-breakpoint) {
@@ -440,7 +443,7 @@
     border-color: @navbar-default-toggle-border-color;
     color: @navbar-default-link-color;
     &:hover,
-    &:focus {
+    &.active {
       background-color: @navbar-default-toggle-hover-bg;
       border-color: @navbar-default-toggle-hover-bg;
       color: #fff;