From e1a7560bc0c9fdabf6cc6086c3c7aed476f2da66 Mon Sep 17 00:00:00 2001 From: Gunther Brunner Date: Tue, 17 Mar 2015 19:48:41 +0900 Subject: [PATCH] Added optional --user-profile-url for opening user profile page in an external domain, it was hardcoded. --- lib/cli.js | 10 +++++++++ lib/units/app/index.js | 7 +++++++ .../stf/device/enhance-device/index.js | 1 + .../column/device-column-service.js | 2 +- res/app/user/index.js | 21 +------------------ res/app/user/user.jade | 2 +- 6 files changed, 21 insertions(+), 22 deletions(-) diff --git a/lib/cli.js b/lib/cli.js index ca9a6bfe..b75eee04 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -593,6 +593,9 @@ program .option('-w, --websocket-url ' , 'URL to websocket client' , String) + .option('--user-profile-url ' + , 'URL to external user profile page' + , String) .option('-d, --disable-watch' , 'disable watching resources') .action(function(options) { @@ -612,6 +615,7 @@ program , ssid: options.ssid , authUrl: options.authUrl , websocketUrl: options.websocketUrl + , userProfileUrl: options.userProfileUrl , disableWatch: options.disableWatch }) }) @@ -871,6 +875,9 @@ program , 'ADB port (defaults to 5037)' , Number , 5037) + .option('--user-profile-url ' + , 'URL to external user profile page' + , String) .action(function() { var log = logger.createLogger('cli:local') , args = arguments @@ -965,6 +972,9 @@ program if (options.disableWatch) { extra.push('--disable-watch') } + if (options.userProfileUrl) { + extra.push('--user-profile-url', options.userProfileUrl) + } return extra })())) diff --git a/lib/units/app/index.js b/lib/units/app/index.js index 3a9a21f4..1bed90d9 100644 --- a/lib/units/app/index.js +++ b/lib/units/app/index.js @@ -111,6 +111,13 @@ module.exports = function(options) { } , user: req.user } + + if (options.userProfileUrl) { + state.config.userProfileUrl = (function () { + return options.userProfileUrl + })() + } + res.type('application/javascript') res.send('var GLOBAL_APPSTATE = ' + JSON.stringify(state)) }) diff --git a/res/app/components/stf/device/enhance-device/index.js b/res/app/components/stf/device/enhance-device/index.js index f1e0e870..d260e981 100644 --- a/res/app/components/stf/device/enhance-device/index.js +++ b/res/app/components/stf/device/enhance-device/index.js @@ -1,3 +1,4 @@ module.exports = angular.module('stf/device/enhance-device', [ + require('stf/app-state').name ]) .factory('EnhanceDeviceService', require('./enhance-device-service')) diff --git a/res/app/device-list/column/device-column-service.js b/res/app/device-list/column/device-column-service.js index 938f1639..0226a2a2 100644 --- a/res/app/device-list/column/device-column-service.js +++ b/res/app/device-list/column/device-column-service.js @@ -245,7 +245,7 @@ module.exports = function DeviceColumnService($filter, gettext) { return device.owner ? device.owner.name : '' } , link: function(device) { - return device.owner ? device.enhancedUserContactUrl : '' + return device.owner ? device.enhancedUserProfileUrl : '' } }) } diff --git a/res/app/user/index.js b/res/app/user/index.js index 0af1ca44..e6ccbb0e 100644 --- a/res/app/user/index.js +++ b/res/app/user/index.js @@ -1,28 +1,9 @@ module.exports = angular.module('stf.user-profile', []) .config(function ($routeProvider) { - // if CONFIG.externalProfileURL else show page - var externalProfileURL = '' - var templateString - - if (!externalProfileURL) { - templateString = require('./user.jade') - } - $routeProvider .when('/user/:user*', { - template: function (params) { - console.log('params', params) - if (externalProfileURL) { - window.location.href = 'http://www.google.com'; - } - - return '
' - }, - controller: function () { - - } + template: require('./user.jade') }) - }) .controller('UserProfileCtrl', require('./user-controller')) diff --git a/res/app/user/user.jade b/res/app/user/user.jade index 3d74bbb8..8e0a3f55 100644 --- a/res/app/user/user.jade +++ b/res/app/user/user.jade @@ -1 +1 @@ -h1 Hola +h1 User