Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions remoteappmanager/static/js/home/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 1 addition & 3 deletions remoteappmanager/static/js/home/views/application_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ define([
}
},

updated: function() { $('iframe').focus(); },

filters: utils.filters
updated: function() { $('iframe').focus(); }
});

return {
Expand Down
24 changes: 3 additions & 21 deletions remoteappmanager/static/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
};

});