Skip to content

Commit 371be3e

Browse files
author
Dave Conway-Jones
committed
add swipe to show to show/hide menu
1 parent 9336dba commit 371be3e

File tree

8 files changed

+18
-14
lines changed

8 files changed

+18
-14
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
### 2.29.4-beta: Maintenance Release
2+
### 2.29.4: Maintenance Release
33

44
**Fixes**
55

dist/css/app.min.less

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,10 @@ md-sidenav i {
6262
md-sidenav md-list-item .md-list-item-inner>p {
6363
line-height: 20px;
6464
}
65-
md-list > md-list-item > md-icon > ui-icon > ng-md-icon {
66-
vertical-align:unset !important;
67-
}
6865
md-card > md-list > md-list-item > div > md-icon > ui-icon > ng-md-icon {
6966
vertical-align:unset !important;
7067
}
7168

72-
7369
md-toast .md-toast-content {
7470
height: auto;
7571
}

dist/dashboard.appcache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CACHE MANIFEST
2-
# Time: Wed Jul 07 2021 15:18:55 GMT+0100 (British Summer Time)
2+
# Time: Wed Jul 07 2021 21:42:00 GMT+0100 (British Summer Time)
33

44
CACHE:
55
i18n.js
@@ -26,4 +26,4 @@ loading.html
2626
NETWORK:
2727
*
2828

29-
# hash: 19db42e5e6060f45443a194ec47c02d29c22be4d4e92fc3bb925a53112ee28f5
29+
# hash: 665b9f1db72e38c6f9163c567ad7b656c6bd4df502c7bd64cc87854adf061508

dist/js/app.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nodes/locales/en-US/ui_base.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@
8484
},
8585
"swipe": {
8686
"no-swipe": "No swipe between tabs",
87-
"allow-swipe": "Allow swipe between tabs"
87+
"allow-swipe": "Allow swipe between tabs",
88+
"show-menu": "Swipe to open/close menu"
8889
},
8990
"lock": {
9091
"clicked": "Click to show side menu",

nodes/ui_base.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,6 +1276,7 @@
12761276
.css("width","100%")
12771277
.append($('<option>', { value:"false", text:c_("swipe.no-swipe"), selected:true }))
12781278
.append($('<option>', { value:"true", text:c_("swipe.allow-swipe") }))
1279+
.append($('<option>', { value:"menu", text:c_("swipe.show-menu") }))
12791280
.val("false")
12801281
.on("change", function() {
12811282
if (!globalDashboardNode || globalDashboardNode.site.allowSwipe !== $(this).val()) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-red-dashboard",
3-
"version": "2.29.4-beta",
3+
"version": "2.30.0",
44
"description": "A set of dashboard nodes for Node-RED",
55
"keywords": [
66
"node-red"

src/main.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ app.controller('MainController', ['$mdSidenav', '$window', 'UiEvents', '$locatio
8787
this.selectedTab = null;
8888
this.loaded = false;
8989
this.hideToolbar = false;
90-
this.allowSwipe = false;
90+
this.allowSwipe = "false";
9191
this.lockMenu = "false";
9292
this.allowTempTheme = true;
9393
var main = this;
@@ -113,8 +113,14 @@ app.controller('MainController', ['$mdSidenav', '$window', 'UiEvents', '$locatio
113113
}
114114
}
115115

116-
$scope.onSwipeLeft = function() { if (main.allowSwipe) { moveTab(-1); } }
117-
$scope.onSwipeRight = function() { if (main.allowSwipe) { moveTab(1); } }
116+
$scope.onSwipeLeft = function() {
117+
if (main.allowSwipe === "menu") { $mdSidenav('left').close(); }
118+
else if (main.allowSwipe === "true") { moveTab(-1); }
119+
}
120+
$scope.onSwipeRight = function() {
121+
if (main.allowSwipe === "menu") { $mdSidenav('left').open(); }
122+
else if (main.allowSwipe === "true") { moveTab(1); }
123+
}
118124

119125
// Added as PR#587 to fix navigation history so back/forwards works ok from browser
120126
$scope.$on('$locationChangeSuccess', function ($event, newUrl, oldUrl, newState, oldState) {
@@ -372,7 +378,7 @@ app.controller('MainController', ['$mdSidenav', '$window', 'UiEvents', '$locatio
372378
if (ui.site) {
373379
name = main.name = ui.site.name;
374380
main.hideToolbar = (ui.site.hideToolbar == "true");
375-
main.allowSwipe = (ui.site.allowSwipe == "true");
381+
main.allowSwipe = ui.site.allowSwipe;
376382
main.lockMenu = ui.site.lockMenu;
377383
if (typeof ui.site.allowTempTheme === 'undefined') { main.allowTempTheme = true; }
378384
else {

0 commit comments

Comments
 (0)