From 3f4ef406cf01b05e31e6b0713d464431ec2834ef Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Thu, 22 Aug 2013 13:58:56 -0700 Subject: [PATCH] CLOUDSTACK-4102: UI > widget > extend dialog widget to have dynamic description. --- ui/scripts/ui/dialog.js | 8 +++++++- ui/scripts/ui/widgets/detailView.js | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ui/scripts/ui/dialog.js b/ui/scripts/ui/dialog.js index 37e2a864180..7bd203414b6 100644 --- a/ui/scripts/ui/dialog.js +++ b/ui/scripts/ui/dialog.js @@ -46,8 +46,14 @@ var createLabel = _l(args.form.createLabel); // Description text + var formDesc; + if (typeof(args.form.desc) == 'function') { + formDesc = args.form.desc(args); + } else { //typeof(args.form.desc) == 'string' or 'undefined' + formDesc = args.form.desc; + } $('').addClass('message').prependTo($formContainer).html( - _l(args.form.desc) + _l(formDesc) ); // Submit button diff --git a/ui/scripts/ui/widgets/detailView.js b/ui/scripts/ui/widgets/detailView.js index 92dfe373456..3a59d4104f9 100644 --- a/ui/scripts/ui/widgets/detailView.js +++ b/ui/scripts/ui/widgets/detailView.js @@ -70,6 +70,7 @@ action.notification : {}; var messages = action.messages; var id = args.id; + var jsonObj = args.jsonObj; var context = $.extend(true, {}, args.context ? args.context : $detailView.data('view-args').context); var _custom = $detailView.data('_custom'); @@ -314,7 +315,8 @@ ref: { id: id }, - context: context + context: context, + jsonObj: jsonObj }); } else if (action.listView) { cloudStack.dialog.listView({