diff --git a/platform/commonUI/general/res/css/tree.css b/platform/commonUI/general/res/css/tree.css index fb80f74fd0..1c8523eb62 100644 --- a/platform/commonUI/general/res/css/tree.css +++ b/platform/commonUI/general/res/css/tree.css @@ -321,19 +321,22 @@ ul.tree { ul.tree li span.tree-item { height: 38px; line-height: 38px; - margin-top: 3px; } - /* line 34, ../sass/mobile/_tree.scss */ + padding-top: 3px; + padding-bottom: 3px; + margin-bottom: 0px; } + /* line 36, ../sass/mobile/_tree.scss */ ul.tree li span.tree-item .view-control { position: absolute; right: 13px; font-size: 1.8em; } - /* line 40, ../sass/mobile/_tree.scss */ + /* line 42, ../sass/mobile/_tree.scss */ ul.tree li span.tree-item .label { left: 3px; font-size: 1.2em; } - /* line 47, ../sass/mobile/_tree.scss */ + /* line 49, ../sass/mobile/_tree.scss */ ul.tree li span.tree-item .label .title-label { right: 16.9px; } - /* line 56, ../sass/mobile/_tree.scss */ + /* line 58, ../sass/mobile/_tree.scss */ ul.tree ul.tree { - margin-left: 3px; } } + margin-left: 0px; + padding-left: 3px; } } diff --git a/platform/commonUI/general/res/sass/mobile/_layout.scss b/platform/commonUI/general/res/sass/mobile/_layout.scss index 56d0191035..7d69b98460 100644 --- a/platform/commonUI/general/res/sass/mobile/_layout.scss +++ b/platform/commonUI/general/res/sass/mobile/_layout.scss @@ -21,7 +21,7 @@ *****************************************************************************/ // Wrapper of the entire 2 panes, only enacted on -// phone and tablet. Also for the panes +// phone and tablet. .browse-wrapper, .mobile-pane { @include phoneandtablet { diff --git a/platform/commonUI/general/res/sass/mobile/_tree.scss b/platform/commonUI/general/res/sass/mobile/_tree.scss index 2137429ca7..6d5273f56f 100644 --- a/platform/commonUI/general/res/sass/mobile/_tree.scss +++ b/platform/commonUI/general/res/sass/mobile/_tree.scss @@ -30,7 +30,9 @@ ul.tree { // Adds some space to the top of each tree item height: $mobile-treeHeight; line-height: $mobile-treeHeight; - margin-top: $interiorMarginSm; + padding-top: $interiorMarginSm; + padding-bottom: $interiorMarginSm; + margin-bottom: 0px; .view-control { position: absolute; right: $mobile-treeRight; @@ -54,7 +56,8 @@ ul.tree { // Sets the margin on the left, which causes the // running indentation after each folder is made ul.tree { - margin-left: $mobile-treeLeft; + margin-left: 0px; + padding-left: $mobile-treeLeft; } } } diff --git a/platform/commonUI/general/src/controllers/TreeNodeController.js b/platform/commonUI/general/src/controllers/TreeNodeController.js index 2a219fa499..43cc671a20 100644 --- a/platform/commonUI/general/src/controllers/TreeNodeController.js +++ b/platform/commonUI/general/src/controllers/TreeNodeController.js @@ -88,7 +88,7 @@ define( } function checkMobile() { - return queryService.isMobile(); + return queryService.isMobile(navigator.userAgent); } // Consider the currently-navigated object and update diff --git a/platform/commonUI/general/src/services/QueryService.js b/platform/commonUI/general/src/services/QueryService.js index f5352c9e69..9d9b13989b 100644 --- a/platform/commonUI/general/src/services/QueryService.js +++ b/platform/commonUI/general/src/services/QueryService.js @@ -40,16 +40,15 @@ define( // Gets the UA name if it is one of the following. // If it is not (a desktop for example) nothing is // returned instead - function getDeviceUA() { - var ua = navigator.userAgent; + function getDeviceUA(ua) { return ua.match(/iPad|iPhone|Android/i) ? ua.match(/iPad|iPhone|Android/i) : ""; } // Checks if gotten device is mobile, // Mobile is defined as a phone or tablet - function isMobile() { - if (getDeviceUA()) { + function isMobile(ua) { + if (getDeviceUA(ua)) { return true; } else { return false; diff --git a/platform/commonUI/general/test/controllers/TreeNodeControllerSpec.js b/platform/commonUI/general/test/controllers/TreeNodeControllerSpec.js index ab468ad7a7..394d71b88a 100644 --- a/platform/commonUI/general/test/controllers/TreeNodeControllerSpec.js +++ b/platform/commonUI/general/test/controllers/TreeNodeControllerSpec.js @@ -29,6 +29,7 @@ define( describe("The tree node controller", function () { var mockScope, mockTimeout, + mockQueryService, controller; function TestObject(id, context) { @@ -43,7 +44,8 @@ define( beforeEach(function () { mockScope = jasmine.createSpyObj("$scope", ["$watch", "$on"]); mockTimeout = jasmine.createSpy("$timeout"); - controller = new TreeNodeController(mockScope, mockTimeout); + mockQueryService = jasmine.createSpyObj("queryService", ["isMobile"]); + controller = new TreeNodeController(mockScope, mockTimeout, mockQueryService); }); it("allows tracking of expansion state", function () { @@ -183,6 +185,10 @@ define( expect(controller.isSelected()).toBeFalsy(); }); + + it("check if tree node is in a mobile device", function () { + controller.checkMobile(); + }); }); } ); \ No newline at end of file diff --git a/platform/commonUI/general/test/services/QueryServiceSpec.js b/platform/commonUI/general/test/services/QueryServiceSpec.js index 8469d21fe1..7caf551029 100644 --- a/platform/commonUI/general/test/services/QueryServiceSpec.js +++ b/platform/commonUI/general/test/services/QueryServiceSpec.js @@ -51,15 +51,17 @@ define( }); it("get current device user agent", function () { - queryService.isMobile(); + mockNavigator.userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36"; + queryService.isMobile(mockNavigator.userAgent); mockNavigator.userAgent = "Mozilla/5.0 (iPad; CPU OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53"; - queryService.isMobile(); + queryService.isMobile(mockNavigator.userAgent); }); it("get orientation of the current device", function () { mockWindow.outerWidth = 768; mockWindow.outerHeight = 1024; queryService.getOrientation(); + mockWindow.outerWidth = 1024; mockWindow.outerHeight = 768; queryService.getOrientation(); diff --git a/platform/commonUI/inspect/src/gestures/InfoGesture.js b/platform/commonUI/inspect/src/gestures/InfoGesture.js index 67ff6cd4a5..483216d838 100644 --- a/platform/commonUI/inspect/src/gestures/InfoGesture.js +++ b/platform/commonUI/inspect/src/gestures/InfoGesture.js @@ -78,7 +78,7 @@ define( // Checks if you are on a mobile device, if the device is // not mobile (queryService.isMobile() = false), then // the pendingBubble and therefore hovering is allowed - if (!queryService.isMobile()) { + if (!queryService.isMobile(navigator.userAgent)) { // Show the bubble, after a suitable delay (if mouse has // left before this time is up, this will be canceled.) pendingBubble = $timeout(function () {