瀏覽代碼

Adds support for query parameter "hideMenu"

This adds the ability to load a board with the menu hidden; it provides a form of "read-only" mode, but the key bindings are still active.
Use with, e.g.:
http://localhost:5001/boards/qYAZyGdym6HqjnfaGI4yNtpdx0IMHd9qp6kaJPwbJqE-?hideMenu=true

The alternative, proposed in #116, was to remove the menu completely, but this would require more substantial changes to board.js (which hangs on "Loading..." if the menu is removed).
Related to #150
Related to #116

Adds support for query parameter "hideMenu"

This adds the ability to load a board with the menu hidden; it provides a form of "read-only" mode, but the key bindings are still active.
Use with, e.g.:
http://localhost:5001/boards/qYAZyGdym6HqjnfaGI4yNtpdx0IMHd9qp6kaJPwbJqE-?hideMenu=true

The alternative, proposed in #116, was to remove the menu completely, but this would require more substantial changes to board.js (which hangs on "Loading..." if the menu is removed).
Related to #150
Related to #116
dev_h
Russ Tedrake 3 年之前
父節點
當前提交
d5111afdc8
共有 3 個檔案被更改,包括 7 行新增1 行删除
  1. 1
    1
      client-data/board.html
  2. 1
    0
      server/templating.js
  3. 5
    0
      tests/integration.js

+ 1
- 1
client-data/board.html 查看文件

@@ -35,7 +35,7 @@
35 35
 
36 36
 	<div id="loadingMessage">{{translations.loading}}</div>
37 37
 
38
-	<div id="menu">
38
+	<div id="menu" {{#hideMenu}}style="display:none;"{{/hideMenu}}>
39 39
 		<div id="menuItems">
40 40
 			<ul id="tools" class="tools">
41 41
 				<li class="tool" tabindex="-1">

+ 1
- 0
server/templating.js 查看文件

@@ -68,6 +68,7 @@ class BoardTemplate extends Template {
68 68
     const boardUriComponent = parts[1];
69 69
     params["boardUriComponent"] = boardUriComponent;
70 70
     params["board"] = decodeURIComponent(boardUriComponent);
71
+    params["hideMenu"] = parsedUrl.query.hideMenu == "true" || false;
71 72
     return params;
72 73
   }
73 74
 }

+ 5
- 0
tests/integration.js 查看文件

@@ -97,6 +97,11 @@ function testBoard(browser) {
97 97
     page = testPencil(page);
98 98
     page = testCircle(page);
99 99
     page = testCursor(page);
100
+
101
+    // test hideMenu
102
+    browser.url(SERVER + '/boards/anonymous?lang=fr&hideMenu=true').waitForElementNotVisible('#menu');
103
+    browser.url(SERVER + '/boards/anonymous?lang=fr&hideMenu=false').waitForElementVisible('#menu');
104
+
100 105
     page.end();
101 106
 }
102 107
 

Loading…
取消
儲存