From efd1c5b3efee81b4582a34c6860807ae9172cefc Mon Sep 17 00:00:00 2001 From: martinRenou Date: Thu, 4 May 2017 15:46:46 +0100 Subject: [PATCH 1/2] We don't use jquery anymore for focus on the iframe --- remoteappmanager/static/js/home/controller.js | 4 +++- .../static/js/home/views/application_list_view.js | 2 +- .../static/js/home/views/application_view.js | 11 ++++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/remoteappmanager/static/js/home/controller.js b/remoteappmanager/static/js/home/controller.js index 466417fea..66e5006fb 100644 --- a/remoteappmanager/static/js/home/controller.js +++ b/remoteappmanager/static/js/home/controller.js @@ -34,7 +34,7 @@ require([ var model = new models.ApplicationListModel(); // Initialize views - new application_list_view.ApplicationListView({ // jshint ignore:line + var app_list_view = new application_list_view.ApplicationListView({ el: '#applist', data: function() { return { model: model }; } }); @@ -51,5 +51,7 @@ require([ ga_observer.trigger_application_starting(application.app_data.image.name); }); + app_list_view.$on('focus_iframe', function() { app_view.focus_iframe(); }); + model.update(); }); diff --git a/remoteappmanager/static/js/home/views/application_list_view.js b/remoteappmanager/static/js/home/views/application_list_view.js index 740cf635c..8497ae46b 100644 --- a/remoteappmanager/static/js/home/views/application_list_view.js +++ b/remoteappmanager/static/js/home/views/application_list_view.js @@ -37,7 +37,7 @@ define([ ' ' + '
  • ' + + ' @click="model.selected_index = index; $emit(\'focus_iframe\');">' + ' ' + diff --git a/remoteappmanager/static/js/home/views/application_view.js b/remoteappmanager/static/js/home/views/application_view.js index 189b6405e..a30f30432 100644 --- a/remoteappmanager/static/js/home/views/application_view.js +++ b/remoteappmanager/static/js/home/views/application_view.js @@ -1,9 +1,8 @@ define([ - 'jquery', "urlutils", "utils", '../../components/vue/dist/vue.min' -], function ($, urlutils, utils, Vue) { +], function (urlutils, utils, Vue) { "use strict"; var ApplicationView = Vue.extend({ @@ -94,10 +93,16 @@ define([ }, get_iframe_size: function() { return utils.max_iframe_size(); + }, + focus_iframe: function() { + var iframe = this.$el.querySelector('iframe'); + if(iframe !== null) { + iframe.focus(); + } } }, - updated: function() { $('iframe').focus(); } + updated: function() { this.focus_iframe(); } }); return { From 925870a08f2116af446fe735a0f41b7a2f5073c3 Mon Sep 17 00:00:00 2001 From: martinRenou Date: Fri, 5 May 2017 16:11:50 +0100 Subject: [PATCH 2/2] Rename focus_iframe event to entry_clicked --- remoteappmanager/static/js/home/controller.js | 2 +- remoteappmanager/static/js/home/views/application_list_view.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/remoteappmanager/static/js/home/controller.js b/remoteappmanager/static/js/home/controller.js index 66e5006fb..7279c7039 100644 --- a/remoteappmanager/static/js/home/controller.js +++ b/remoteappmanager/static/js/home/controller.js @@ -51,7 +51,7 @@ require([ ga_observer.trigger_application_starting(application.app_data.image.name); }); - app_list_view.$on('focus_iframe', function() { app_view.focus_iframe(); }); + app_list_view.$on('entry_clicked', function() { app_view.focus_iframe(); }); model.update(); }); diff --git a/remoteappmanager/static/js/home/views/application_list_view.js b/remoteappmanager/static/js/home/views/application_list_view.js index 8497ae46b..9a8655b7f 100644 --- a/remoteappmanager/static/js/home/views/application_list_view.js +++ b/remoteappmanager/static/js/home/views/application_list_view.js @@ -37,7 +37,7 @@ define([ ' ' + '
  • ' + + ' @click="model.selected_index = index; $emit(\'entry_clicked\');">' + ' ' +