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

Merge pull request #582 from sharelatex/sk-add-test-controls-panel

Add a "Test Controls" section to the left-panel
Shane Kilkelly 8 лет назад
Родитель
Сommit
b2a68cb911

+ 1 - 0
services/web/app/coffee/Features/Project/ProjectController.coffee

@@ -341,6 +341,7 @@ module.exports = ProjectController =
 					maxDocLength: Settings.max_doc_length
 					useV2History: !!project.overleaf?.history?.display
 					showRichText: req.query?.rt == 'true'
+					showTestControls: req.query?.tc == 'true' || user.isAdmin
 					showPublishModal: req.query?.pm == 'true'
 				timer.done()
 

+ 18 - 0
services/web/app/views/project/editor/left-menu.pug

@@ -62,6 +62,23 @@ aside#left-menu.full-size(
 			!= moduleIncludes("editorLeftMenu:editing_services", locals)
 
 
+	if showTestControls
+		h4 Test Controls
+		ul.list-unstyled.nav(ng-controller="TestControlsController")
+			li
+				a(href="#" ng-click="richText()")
+					i.fa.fa-exclamation.fa-fw
+					| Rich Text
+			li
+				a(href="#" ng-click="openProjectLinkedFileModal()")
+					i.fa.fa-exclamation.fa-fw
+					| Project-Linked-File Modal
+			li
+				a(href="#" ng-click="openLinkedFileModal()")
+					i.fa.fa-exclamation.fa-fw
+					| URL-Linked-File Modal
+
+
 	h4(ng-show="!anonymous") #{translate("settings")}
 	form.settings(ng-controller="SettingsController", ng-show="!anonymous")
 		.containter-fluid
@@ -179,6 +196,7 @@ aside#left-menu.full-size(
 					option(value="pdfjs") #{translate("built_in")}
 					option(value="native") #{translate("native")}
 
+
 	h4 #{translate("hotkeys")}
 	ul.list-unstyled.nav
 		li(ng-controller="HotkeysController")

+ 1 - 0
services/web/public/coffee/ide.coffee

@@ -18,6 +18,7 @@ define [
 	"ide/chat/index"
 	"ide/clone/index"
 	"ide/hotkeys/index"
+	"ide/test-controls/index"
 	"ide/wordcount/index"
 	"ide/directives/layout"
 	"ide/directives/validFile"

+ 14 - 0
services/web/public/coffee/ide/test-controls/controllers/TestControlsController.coffee

@@ -0,0 +1,14 @@
+define [
+	"base"
+	"ace/ace"
+], (App) ->
+	App.controller "TestControlsController", ($scope) ->
+
+		$scope.openProjectLinkedFileModal = () ->
+			window.openProjectLinkedFileModal()
+
+		$scope.openLinkedFileModal = () ->
+			window.openLinkedFileModal()
+
+		$scope.richText = () ->
+			window.location.href = window.location.toString() + '&rt=true'

+ 3 - 0
services/web/public/coffee/ide/test-controls/index.coffee

@@ -0,0 +1,3 @@
+define [
+	"ide/test-controls/controllers/TestControlsController"
+], () ->