1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-06 03:50:04 +02:00

- Moved browser selection to Navigation.

This commit is contained in:
Gunther Brunner 2014-04-22 21:11:46 +09:00
parent ce5470ab8c
commit 47cd0313a1
5 changed files with 52 additions and 32 deletions

View file

@ -1,6 +1,6 @@
var _ = require('lodash')
module.exports = function NavigationCtrl($scope) {
module.exports = function NavigationCtrl($scope, $rootScope) {
$scope.urlHistory = []
@ -43,4 +43,33 @@ module.exports = function NavigationCtrl($scope) {
$scope.textURL = $url
$scope.openURL()
}
function setCurrentBrowser(device) {
if (device && device.browser && device.browser.apps) {
var currentBrowser = {}
if (device.browser.selected) {
var selectedBrowser = _.first(device.browser.apps, 'selected')
if (!_.isEmpty(selectedBrowser)) {
currentBrowser = selectedBrowser[0]
}
} else {
currentBrowser = _.first(device.browser.apps)
}
$rootScope.browser = currentBrowser
}
}
setCurrentBrowser($scope.device)
$scope.$watch('device', function (newValue, oldValue) {
if (newValue !== oldValue) {
setCurrentBrowser(newValue)
}
})
$scope.clearSettings = function () {
var browser = $scope.browser
$scope.control.clearBrowser(browser)
}
}