From af6fa9fe29e568c9d0169313734231f759523ac8 Mon Sep 17 00:00:00 2001 From: Gunther Brunner Date: Thu, 19 Jun 2014 16:59:25 +0900 Subject: [PATCH] Added Chat (disabled for now). --- .../stf/common-ui/modals/common/modals.css | 10 +++++ .../external-url-modal-spec.js | 11 +++++ .../external-url-modal/external-url-modal.css | 3 ++ .../external-url-modal.jade | 8 ++++ .../external-url-modal/external-url-modal.js | 43 +++++++++++++++++++ .../modals/external-url-modal/index.js | 7 +++ .../on-load-event-directive.js | 10 +++++ res/app/menu/index.js | 3 +- res/app/menu/menu-controller.js | 7 ++- res/app/menu/menu.jade | 8 +++- res/common/lang/po/stf.pot | 29 +++++++++++++ 11 files changed, 135 insertions(+), 4 deletions(-) create mode 100644 res/app/components/stf/common-ui/modals/external-url-modal/external-url-modal-spec.js create mode 100644 res/app/components/stf/common-ui/modals/external-url-modal/external-url-modal.css create mode 100644 res/app/components/stf/common-ui/modals/external-url-modal/external-url-modal.jade create mode 100644 res/app/components/stf/common-ui/modals/external-url-modal/external-url-modal.js create mode 100644 res/app/components/stf/common-ui/modals/external-url-modal/index.js create mode 100644 res/app/components/stf/common-ui/modals/external-url-modal/on-load-event-directive.js diff --git a/res/app/components/stf/common-ui/modals/common/modals.css b/res/app/components/stf/common-ui/modals/common/modals.css index 616db469..7870a0f3 100644 --- a/res/app/components/stf/common-ui/modals/common/modals.css +++ b/res/app/components/stf/common-ui/modals/common/modals.css @@ -31,3 +31,13 @@ width: 860px; } +.modal-size-80p .modal-dialog { + width: 80%; + height: 100%; + /*max-height: 800px;*/ +} + +.modal-size-80p .modal-body { + height: 100%; + max-height: 800px; +} diff --git a/res/app/components/stf/common-ui/modals/external-url-modal/external-url-modal-spec.js b/res/app/components/stf/common-ui/modals/external-url-modal/external-url-modal-spec.js new file mode 100644 index 00000000..5a14afb3 --- /dev/null +++ b/res/app/components/stf/common-ui/modals/external-url-modal/external-url-modal-spec.js @@ -0,0 +1,11 @@ +describe('VersionUpdateService', function() { + + beforeEach(module('stf.version-update')); + + it('should ...', inject(function(VersionUpdateService) { + + //expect(FatalMessageService.doSomething()).toEqual('something'); + + })); + +}) diff --git a/res/app/components/stf/common-ui/modals/external-url-modal/external-url-modal.css b/res/app/components/stf/common-ui/modals/external-url-modal/external-url-modal.css new file mode 100644 index 00000000..f2030bcd --- /dev/null +++ b/res/app/components/stf/common-ui/modals/external-url-modal/external-url-modal.css @@ -0,0 +1,3 @@ +.stf-external-url-modal { + +} diff --git a/res/app/components/stf/common-ui/modals/external-url-modal/external-url-modal.jade b/res/app/components/stf/common-ui/modals/external-url-modal/external-url-modal.jade new file mode 100644 index 00000000..adcf8799 --- /dev/null +++ b/res/app/components/stf/common-ui/modals/external-url-modal/external-url-modal.jade @@ -0,0 +1,8 @@ +.stf-external-url-modal.stf-modal + .modal-header + button(type='button', ng-click='cancel()').close × + h4.modal-title(ng-show='title') + i.fa.fa-fw(ng-class='icon') + span(ng-bind='title') + .modal-body + iframe(ng-src='{{url}}', width='100%', height='100%', frameborder='0') diff --git a/res/app/components/stf/common-ui/modals/external-url-modal/external-url-modal.js b/res/app/components/stf/common-ui/modals/external-url-modal/external-url-modal.js new file mode 100644 index 00000000..bbc69df9 --- /dev/null +++ b/res/app/components/stf/common-ui/modals/external-url-modal/external-url-modal.js @@ -0,0 +1,43 @@ +module.exports = function ServiceFactory($modal, $sce) { + var service = {} + + var ModalInstanceCtrl = function ($scope, $modalInstance, url, title, icon) { + $scope.ok = function () { + $modalInstance.close(true) + } + + $scope.url = $sce.trustAsResourceUrl(url) + $scope.title = title + $scope.icon = icon + + $scope.cancel = function () { + $modalInstance.dismiss('cancel') + } + } + + service.open = function (url, title, icon) { + var modalInstance = $modal.open({ + template: require('./external-url-modal.jade'), + controller: ModalInstanceCtrl, +// size: 'lg', + windowClass: 'modal-size-80p', + resolve: { + title: function() { + return title + }, + url: function () { + return url + }, + icon: function () { + return icon + } + } + }) + + modalInstance.result.then(function () { + }, function () { + }) + } + + return service +} diff --git a/res/app/components/stf/common-ui/modals/external-url-modal/index.js b/res/app/components/stf/common-ui/modals/external-url-modal/index.js new file mode 100644 index 00000000..3698cae7 --- /dev/null +++ b/res/app/components/stf/common-ui/modals/external-url-modal/index.js @@ -0,0 +1,7 @@ +require('./external-url-modal.css') + +module.exports = angular.module('stf.external-url-modal', [ + require('stf/common-ui/modals/common').name +]) + .factory('ExternalUrlModalService', require('./external-url-modal')) + .directive('onLoadEvent', require('./on-load-event-directive')) diff --git a/res/app/components/stf/common-ui/modals/external-url-modal/on-load-event-directive.js b/res/app/components/stf/common-ui/modals/external-url-modal/on-load-event-directive.js new file mode 100644 index 00000000..395d38b5 --- /dev/null +++ b/res/app/components/stf/common-ui/modals/external-url-modal/on-load-event-directive.js @@ -0,0 +1,10 @@ +// TODO: Test this +module.exports = function () { + return function (scope, element, attrs) { + scope.$watch(attrs.pageVisible, function () { + element.bind('load', function () { + scope.$apply(attrs.pageLoad) + }) + }) + } +} diff --git a/res/app/menu/index.js b/res/app/menu/index.js index e30c63df..6a930dde 100644 --- a/res/app/menu/index.js +++ b/res/app/menu/index.js @@ -2,7 +2,8 @@ require('./menu.css') module.exports = angular.module('stf.menu', [ require('stf/nav-menu').name, - require('stf/settings').name + require('stf/settings').name, + require('stf/common-ui/modals/external-url-modal').name ]) .controller('MenuCtrl', require('./menu-controller')) .run(["$templateCache", function ($templateCache) { diff --git a/res/app/menu/menu-controller.js b/res/app/menu/menu-controller.js index 23059e22..c880d486 100644 --- a/res/app/menu/menu-controller.js +++ b/res/app/menu/menu-controller.js @@ -1,4 +1,4 @@ -module.exports = function MenuCtrl($scope, $rootScope, SettingsService, $location) { +module.exports = function MenuCtrl($scope, $rootScope, SettingsService, $location, ExternalUrlModalService) { $rootScope.platform = 'native' SettingsService.bind($rootScope, { key: 'platform', @@ -8,4 +8,9 @@ module.exports = function MenuCtrl($scope, $rootScope, SettingsService, $locatio $scope.$on('$routeChangeSuccess', function () { $scope.isControlRoute = $location.path().search('/control') !== -1 }) + + $scope.openChat = function () { + var hipChatUrl = 'https://cyberagent.hipchat.com/chat?focus_jid=44808_stf@conf.hipchat.com&minimal=true' + ExternalUrlModalService.open(hipChatUrl, 'HipChat #STF', 'fa-comment') + } } diff --git a/res/app/menu/menu.jade b/res/app/menu/menu.jade index 1e7b9488..7d494613 100644 --- a/res/app/menu/menu.jade +++ b/res/app/menu/menu.jade @@ -1,7 +1,7 @@ .navbar.stf-menu(ng-controller='MenuCtrl') .container-fluid.stf-top-bar a.stf-logo(href="/") STF 2 - ul.nav.stf-nav(nav-menu='current') + ul.nav.stf-nav(nav-menu='current').unselectable li(ng-cloak) a(ng-href='/#!/control', ng-click='$event.preventDefault()').cursor span.fa.fa-mobile @@ -12,11 +12,15 @@ a(ng-href='/#!/settings') span.fa.fa-gears | {{ !$root.basicMode ? "Settings" : '' | translate }} - ul.nav.stf-nav.stf-feedback.pull-right(ng-cloak) + ul.nav.stf-nav.stf-feedback.pull-right(ng-cloak).unselectable li.stf-nav-web-native-button(ng-if='!$root.basicMode && isControlRoute') .btn-group button(type='button', ng-model='$root.platform', btn-radio="'web'", translate).btn.btn-sm.btn-default-outline Web button(type='button', ng-model='$root.platform', btn-radio="'native'", translate).btn.btn-sm.btn-default-outline Native + //li(ng-if='!$root.basicMode') + a(ng-click='openChat()').pointer + i.fa.fa-comment.fa-fw + | {{ "Chat" | translate }} li(ng-if='!$root.basicMode') a(ng-href='/#!/help') i.fa.fa-question-circle.fa-fw diff --git a/res/common/lang/po/stf.pot b/res/common/lang/po/stf.pot index 5eef5616..f18aba29 100644 --- a/res/common/lang/po/stf.pot +++ b/res/common/lang/po/stf.pot @@ -12,6 +12,10 @@ msgstr "" msgid "-" msgstr "" +#: /Users/a12907/STF/stf/tmp/html/app/components/stf/common-ui/modals/version-update/version-update.html +msgid "A new version of STF is available" +msgstr "" + #: /Users/a12907/STF/stf/tmp/html/app/device-list/device-list.html #: /Users/a12907/STF/stf/tmp/html/app/control-panes/info/info.html msgid "ABI" @@ -258,6 +262,10 @@ msgstr "" msgid "Device cannot get kicked from the group" msgstr "" +#: /Users/a12907/STF/stf/tmp/html/app/components/stf/common-ui/modals/fatal-message/fatal-message.html +msgid "Device was disconnected" +msgstr "" + #: /Users/a12907/STF/stf/tmp/html/app/device-list/device-list.html msgid "Devices" msgstr "" @@ -384,6 +392,10 @@ msgstr "" msgid "Go Forward" msgstr "" +#: /Users/a12907/STF/stf/tmp/html/app/components/stf/common-ui/modals/fatal-message/fatal-message.html +msgid "Go to Device List" +msgstr "" + #: /Users/a12907/STF/stf/res/build/bundle.js #: /Users/a12907/STF/stf/res/app/components/stf/device/device-info-filter/index.js msgid "Good" @@ -595,6 +607,10 @@ msgstr "" msgid "No devices connected" msgstr "" +#: /Users/a12907/STF/stf/tmp/html/app/components/stf/common-ui/modals/lightbox-image/lightbox-image.html +msgid "No photo available" +msgstr "" + #: /Users/a12907/STF/stf/tmp/html/app/control-panes/screenshots/screenshots.html msgid "No screenshots taken" msgstr "" @@ -782,6 +798,7 @@ msgid "Released" msgstr "" #: /Users/a12907/STF/stf/tmp/html/app/control-panes/dashboard/navigation/navigation.html +#: /Users/a12907/STF/stf/tmp/html/app/components/stf/common-ui/modals/version-update/version-update.html msgid "Reload" msgstr "" @@ -965,6 +982,10 @@ msgstr "" msgid "Total devices" msgstr "" +#: /Users/a12907/STF/stf/tmp/html/app/components/stf/common-ui/modals/fatal-message/fatal-message.html +msgid "Try to reconnect" +msgstr "" + #: /Users/a12907/STF/stf/tmp/html/app/control-panes/info/info.html msgid "Type" msgstr "" @@ -1046,6 +1067,10 @@ msgstr "" msgid "Version" msgstr "" +#: /Users/a12907/STF/stf/tmp/html/app/components/stf/common-ui/modals/version-update/version-update.html +msgid "Version Update" +msgstr "" + #: /Users/a12907/STF/stf/tmp/html/app/control-panes/info/info.html msgid "Voltage" msgstr "" @@ -1101,3 +1126,7 @@ msgstr "" #: /Users/a12907/STF/stf/res/app/components/stf/device/device-info-filter/index.js msgid "Yes" msgstr "" + +#: /Users/a12907/STF/stf/tmp/html/app/components/stf/common-ui/modals/fatal-message/fatal-message.html +msgid "You are no longer controlling the device." +msgstr ""