From c68bc10b3912b529790c038ee14a8029df7eb5e7 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Tue, 12 Mar 2019 15:47:11 +0530 Subject: [PATCH 1/4] ui: introduce new UI config file This introduces a new UI `config.js` file using which the UI could be configured by the admin from a single config/js file. In the first commit this allows for easy configuration of list of keyboards. Signed-off-by: Rohit Yadav --- ui/config.js | 25 +++++++++++++++++++++++++ ui/index.html | 8 ++++---- ui/l10n/en.js | 1 + ui/scripts/templates.js | 22 ++++++---------------- 4 files changed, 36 insertions(+), 20 deletions(-) create mode 100644 ui/config.js diff --git a/ui/config.js b/ui/config.js new file mode 100644 index 000000000000..a3d1190d2698 --- /dev/null +++ b/ui/config.js @@ -0,0 +1,25 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Define Keyboard Options for the UI +var keyboardOptions = { + "us": "label.standard.us.keyboard", + "uk": "label.uk.keyboard", + "fr": "label.french.azerty.keyboard", + "jp": "label.japanese.keyboard", + "sc": "label.simplified.chinese.keyboard" +} diff --git a/ui/index.html b/ui/index.html index 6e33598ed9c4..9b4cb78b9760 100644 --- a/ui/index.html +++ b/ui/index.html @@ -1741,6 +1741,7 @@

+ diff --git a/ui/l10n/en.js b/ui/l10n/en.js index eb7b82250891..35de8664b90d 100644 --- a/ui/l10n/en.js +++ b/ui/l10n/en.js @@ -787,6 +787,7 @@ var dictionary = { "label.format":"Format", "label.format.lower":"format", "label.friday":"Friday", +"label.french.azerty.keyboard":"French AZERTY keyboard", "label.full":"Full", "label.full.path":"Full path", "label.gateway":"Gateway", diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js index 96660fac6804..006ed16bad39 100755 --- a/ui/scripts/templates.js +++ b/ui/scripts/templates.js @@ -449,22 +449,12 @@ id: "", description: "" }); - items.push({ - id: "us", - description: "US Keboard" - }); - items.push({ - id: "uk", - description: "UK Keyboard" - }); - items.push({ - id: "jp", - description: "Japanese Keyboard" - }); - items.push({ - id: "sc", - description: "Simplified Chinese" - }); + for (var key in keyboardOptions) { + items.push({ + id: key, + description: _l(keyboardOptions[key]) + }); + } args.response.success({ data: items }); From 96cd9d9f0d36dc11adb4d03e3a10313c8a295667 Mon Sep 17 00:00:00 2001 From: Anurag Awasthi Date: Tue, 12 Mar 2019 15:55:24 +0530 Subject: [PATCH 2/4] ui: Make the page title, help URL and about popup configurable This helps brands in setting up relevant resources in their deployement. --- ui/config.js | 22 ++++++++++++++-------- ui/index.html | 4 ++-- ui/scripts/cloudStack.js | 2 +- ui/scripts/templates.js | 4 ++-- ui/scripts/ui/core.js | 13 +++++-------- 5 files changed, 24 insertions(+), 21 deletions(-) diff --git a/ui/config.js b/ui/config.js index a3d1190d2698..13a9dd17d588 100644 --- a/ui/config.js +++ b/ui/config.js @@ -15,11 +15,17 @@ // specific language governing permissions and limitations // under the License. -// Define Keyboard Options for the UI -var keyboardOptions = { - "us": "label.standard.us.keyboard", - "uk": "label.uk.keyboard", - "fr": "label.french.azerty.keyboard", - "jp": "label.japanese.keyboard", - "sc": "label.simplified.chinese.keyboard" -} +// Define custom options configurable by admins for UI +cloudStackOptions = { + aboutText: "label.app.name", + aboutTitle: "label.about.app", + docTitle: "label.app.name", + helpURL: "http://docs.cloudstack.apache.org/", + keyboardOptions: { + "us": "label.standard.us.keyboard", + "uk": "label.uk.keyboard", + "fr": "label.french.azerty.keyboard", + "jp": "label.japanese.keyboard", + "sc": "label.simplified.chinese.keyboard" + } +}; diff --git a/ui/index.html b/ui/index.html index 9b4cb78b9760..15e58fcc091b 100644 --- a/ui/index.html +++ b/ui/index.html @@ -1804,8 +1804,8 @@

// Inject translated keyboard options var keyboardDropdown = $($.find('#keyboard-options')); - for (var key in keyboardOptions) { - keyboardDropdown.append($('