diff --git a/remoteappmanager/static/js/home/controller.js b/remoteappmanager/static/js/home/controller.js index 602276f48..466417fea 100644 --- a/remoteappmanager/static/js/home/controller.js +++ b/remoteappmanager/static/js/home/controller.js @@ -3,14 +3,32 @@ require([ "home/models", "home/views/application_list_view", "home/views/application_view", - "gamodule" + "components/vue/dist/vue.min", + "gamodule", + 'urlutils' ], function( models, application_list_view, application_view, - gamodule) { + Vue, + gamodule, + urlutils) { "use strict"; + Vue.filter('icon_src', function(icon_data) { + return ( + icon_data ? + 'data:image/png;base64,' + icon_data : + urlutils.path_join( + window.apidata.base_url, 'static', 'images', 'generic_appicon_128.png' + ) + ); + }); + + Vue.filter('app_name', function(image) { + return image.ui_name? image.ui_name: image.name; + }); + // This model keeps the retrieved content from the REST query locally. // It is only synchronized at initial load. var model = new models.ApplicationListModel(); diff --git a/remoteappmanager/static/js/home/views/application_list_view.js b/remoteappmanager/static/js/home/views/application_list_view.js index d7336bc85..6853af1be 100644 --- a/remoteappmanager/static/js/home/views/application_list_view.js +++ b/remoteappmanager/static/js/home/views/application_list_view.js @@ -1,15 +1,12 @@ define([ - 'utils', '../../components/vue/dist/vue.min', -], function (utils, Vue) { +], function (Vue) { 'use strict'; /* Create application_list ViewModel (will next be wrapped in a main ViewModel which will contain the applicationListView and the applicationView) */ - var ApplicationListView = Vue.extend({ - filters: utils.filters - }); + var ApplicationListView = Vue.extend({}); return { ApplicationListView : ApplicationListView diff --git a/remoteappmanager/static/js/home/views/application_view.js b/remoteappmanager/static/js/home/views/application_view.js index c96fffc17..73556a36d 100644 --- a/remoteappmanager/static/js/home/views/application_view.js +++ b/remoteappmanager/static/js/home/views/application_view.js @@ -38,9 +38,7 @@ define([ } }, - updated: function() { $('iframe').focus(); }, - - filters: utils.filters + updated: function() { $('iframe').focus(); } }); return { diff --git a/remoteappmanager/static/js/utils.js b/remoteappmanager/static/js/utils.js index 56bedbef7..1f0eb35b0 100644 --- a/remoteappmanager/static/js/utils.js +++ b/remoteappmanager/static/js/utils.js @@ -6,9 +6,8 @@ // Distributed under the terms of the Modified BSD License. define([ - 'jquery', - 'urlutils' -], function ($, urlutils) { + 'jquery' +], function ($) { "use strict"; var all = function (promises) { @@ -46,27 +45,10 @@ define([ return [width, height]; }; - // Temporary: will be registered in Vue globally - var filters = { - icon_src: function(icon_data) { - return ( - icon_data ? - 'data:image/png;base64,' + icon_data : - urlutils.path_join( - window.apidata.base_url, 'static', 'images', 'generic_appicon_128.png' - ) - ); - }, - app_name: function(image) { - return image.ui_name? image.ui_name: image.name; - } - }; - return { all : all, update : update, - max_iframe_size: max_iframe_size, - filters: filters + max_iframe_size: max_iframe_size }; });