From 6321ca91914b516975fdf836f4bfa1d6982d790b Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sun, 3 Dec 2017 22:46:23 +0100 Subject: [PATCH] Reflect possibility to have arbitrary properties in Portal --- basic/srv/portal/js/script.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/basic/srv/portal/js/script.js b/basic/srv/portal/js/script.js index 8be24d2..df869f7 100644 --- a/basic/srv/portal/js/script.js +++ b/basic/srv/portal/js/script.js @@ -2,15 +2,11 @@ $(function() { $.getJSON('js/apps.json', function(data) { $.each(data, function(id, props) { var div = $('#'+id).show(); - if (props.hasOwnProperty('url')) { - var url = props.url.replace('{host}', window.location.hostname); - div.find('h2 a').attr('href', url); - div.find('.url').text(url); - } - if (props.hasOwnProperty('login')) - div.find('.login').text(props.login); - if (props.hasOwnProperty('password')) - div.find('.password').text(props.password); + if (props.hasOwnProperty('url')) + div.find('h2 a').attr('href', props.url.replace('{host}', window.location.hostname)); + $.each(props, function(key, value) { + div.find('.'+key).text(value.replace('{host}', window.location.hostname)); + }); }); }); });