diff --git a/bower.json b/bower.json index b43d45c4..6d3d360e 100644 --- a/bower.json +++ b/bower.json @@ -40,7 +40,8 @@ "angular-borderlayout": "https://github.com/filearts/angular-borderlayout.git", "angular-ui-bootstrap": "~0.11.0", "angular-ladda": "~0.1.6", - "ng-context-menu": "~1.0.0" + "ng-context-menu": "~1.0.0", + "stats.js": "*" }, "private": true, "resolutions": { diff --git a/res/app/components/stf/device-context-menu/device-context-menu-directive.js b/res/app/components/stf/device-context-menu/device-context-menu-directive.js new file mode 100644 index 00000000..80e3e85b --- /dev/null +++ b/res/app/components/stf/device-context-menu/device-context-menu-directive.js @@ -0,0 +1,20 @@ +module.exports = function deviceContextMenuDirective($window) { + return { + restrict: 'EA', + replace: false, + //scope: { + // control: '&', + // device: '&' + //}, + transclude: true, + template: require('./device-context-menu.jade'), + link: function (scope, element, attrs) { + //var device = scope.device() + //var control = scope.control() + scope.windowClose = function () { + $window.close() + } + + } + } +} diff --git a/res/app/components/stf/device-context-menu/device-context-menu-spec.js b/res/app/components/stf/device-context-menu/device-context-menu-spec.js new file mode 100644 index 00000000..a9f4b1e6 --- /dev/null +++ b/res/app/components/stf/device-context-menu/device-context-menu-spec.js @@ -0,0 +1,23 @@ +describe('deviceContextMenu', function () { + + beforeEach(angular.mock.module(require('./').name)) + + var scope, compile + + beforeEach(inject(function ($rootScope, $compile) { + scope = $rootScope.$new() + compile = $compile + })) + + it('should ...', function () { + + /* + To test your directive, you need to create some html that would use your directive, + send that through compile() then compare the results. + + var element = compile('
hi
')(scope) + expect(element.text()).toBe('hello, world') + */ + + }) +}) diff --git a/res/app/components/stf/device-context-menu/device-context-menu.css b/res/app/components/stf/device-context-menu/device-context-menu.css new file mode 100644 index 00000000..39aaa3ae --- /dev/null +++ b/res/app/components/stf/device-context-menu/device-context-menu.css @@ -0,0 +1,3 @@ +.stf-device-context-menu { + +} \ No newline at end of file diff --git a/res/app/components/stf/device-context-menu/device-context-menu.jade b/res/app/components/stf/device-context-menu/device-context-menu.jade new file mode 100644 index 00000000..305c63a4 --- /dev/null +++ b/res/app/components/stf/device-context-menu/device-context-menu.jade @@ -0,0 +1,26 @@ +.dropdown.context-menu(id='context-menu-{{ $index }}') + ul.dropdown-menu(role='menu') + li + a.pointer(role='menuitem', ng-click='control.back(); $event.preventDefault()') + i.fa.fa-mail-reply.fa-fw + span(translate) Back + li + a.pointer(role='menuitem', ng-click='control.home(); $event.preventDefault()') + i.fa.fa-home.fa-fw + span(translate) Home + li.divider + li + a.pointer(role='menuitem', ng-click='rotateRight(); $event.preventDefault()') + i.fa.fa-rotate-left.fa-fw + span(translate) Rotate Left + li + a.pointer(role='menuitem', ng-click='rotateLeft(); $event.preventDefault()') + i.fa.fa-rotate-right.fa-fw + span(translate) Rotate Right + li.divider + li + a.pointer(role='menuitem', ng-click='$root.standalone ? windowClose() : kickDevice(device); $event.preventDefault()') + i.fa.fa-sign-out.fa-fw + span(translate) Stop Using + +.stf-device-context-menu(ng-transclude, context-menu, data-target='context-menu-{{ $index }}').fill-height diff --git a/res/app/components/stf/device-context-menu/index.js b/res/app/components/stf/device-context-menu/index.js new file mode 100644 index 00000000..4deebb1a --- /dev/null +++ b/res/app/components/stf/device-context-menu/index.js @@ -0,0 +1,6 @@ +require('./device-context-menu.css') + +module.exports = angular.module('stf.device-context-menu', [ + require('ng-context-menu').name +]) + .directive('deviceContextMenu', require('./device-context-menu-directive')) diff --git a/res/app/components/stf/standalone/standalone-service.js b/res/app/components/stf/standalone/standalone-service.js index 17487490..23af94f6 100644 --- a/res/app/components/stf/standalone/standalone-service.js +++ b/res/app/components/stf/standalone/standalone-service.js @@ -62,7 +62,7 @@ module.exports = 'resizable=yes' ].join(',') - var newWindow = $window.open(url, 'STFNewWindow' + Date.now(), features) + var newWindow = $window.open(url, 'STF-' + device.serial, features) newWindow.onbeforeunload = function () { diff --git a/res/app/control-panes/device-control/device-control-standalone.jade b/res/app/control-panes/device-control/device-control-standalone.jade index 5ee02731..879348aa 100644 --- a/res/app/control-panes/device-control/device-control-standalone.jade +++ b/res/app/control-panes/device-control/device-control-standalone.jade @@ -1,3 +1,4 @@ .interact-control.fill-height.stf-device-control(ng-controller='DeviceControlCtrl').fill-height.fill-width div(ng-controller='DeviceScreenCtrl', ng-if='device', ng-file-drop='installFile($files)', ng-file-drag-over-class='dragover').fill-height.fill-width - device-screen(device='device', control='control').fill-height.fill-width + device-context-menu(device='device', control='control') + device-screen(device='device', control='control').fill-height.fill-width diff --git a/res/app/control-panes/device-control/device-control.jade b/res/app/control-panes/device-control/device-control.jade index 45e94fe1..333abd6e 100644 --- a/res/app/control-panes/device-control/device-control.jade +++ b/res/app/control-panes/device-control/device-control.jade @@ -37,34 +37,9 @@ .as-row.fill-height - .dropdown.context-menu(id='context-menu-{{ $index }}') - ul.dropdown-menu(role='menu') - li - a.pointer(role='menuitem', ng-click='control.back(); $event.preventDefault()') - i.fa.fa-mail-reply.fa-fw - span(translate) Back - li - a.pointer(role='menuitem', ng-click='control.home(); $event.preventDefault()') - i.fa.fa-home.fa-fw - span(translate) Home - li.divider - li - a.pointer(role='menuitem', ng-click='rotateRight(); $event.preventDefault()') - i.fa.fa-rotate-left.fa-fw - span(translate) Rotate Left - li - a.pointer(role='menuitem', ng-click='rotateLeft(); $event.preventDefault()') - i.fa.fa-rotate-right.fa-fw - span(translate) Rotate Right - li.divider - li - a.pointer(role='menuitem', ng-click='kickDevice(device); $event.preventDefault()') - i.fa.fa-sign-out.fa-fw - span(translate) Stop Using - div(ng-controller='DeviceScreenCtrl', ng-if='device', ng-file-drop='installFile($files)', ng-file-drag-over-class='dragover').fill-height - div(context-menu, data-target='context-menu-{{ $index }}').fill-height + device-context-menu(device='device', control='control') device-screen(device='device', control='control') .stf-vnc-bottom.as-row(ng-hide='$root.standalone') diff --git a/res/app/control-panes/device-control/index.js b/res/app/control-panes/device-control/index.js index 213182a8..87a79b68 100644 --- a/res/app/control-panes/device-control/index.js +++ b/res/app/control-panes/device-control/index.js @@ -4,7 +4,8 @@ module.exports = angular.module('device-control', [ require('stf/device').name, require('stf/control').name, require('stf/screen').name, - require('ng-context-menu').name + require('ng-context-menu').name, + require('stf/device-context-menu').name ]) .run(["$templateCache", function ($templateCache) { $templateCache.put('control-panes/device-control/device-control.jade',