From 936814483d5ce343e8aeee73bf7256aeef2323d5 Mon Sep 17 00:00:00 2001 From: Alex Frank Date: Wed, 23 Feb 2022 21:51:13 +0100 Subject: [PATCH] Added SAP community badges to the enhanced picture --- _i18n/messages.properties | 5 + .../profilePic/controller/App.controller.js | 44 ++++++++- app/profilePic/profilePic/view/App.view.xml | 4 +- routes/profilePic.js | 93 ++++++++++++++++++- 4 files changed, 136 insertions(+), 10 deletions(-) diff --git a/_i18n/messages.properties b/_i18n/messages.properties index 37ffeec..3e7b398 100644 --- a/_i18n/messages.properties +++ b/_i18n/messages.properties @@ -8,6 +8,11 @@ Toolbar1=Choose Selfie Template Toolbar2=Choose Your Picture and Upload Toolbar3=Edit and Download Final Image Upload=Enhance Your Picture +SaveAs=Save As placeholder=Choose File for Upload... +enterSapCommunityName=Enter SAP Community Name +yourSapCommunityNameEG=Your community name, e. g. +close=Close +enhance=Enhance gui.loading=Processing Picture gui.loadingLong=Please wait ...Processing Picture \ No newline at end of file diff --git a/app/profilePic/profilePic/controller/App.controller.js b/app/profilePic/profilePic/controller/App.controller.js index cb03e21..c93e012 100644 --- a/app/profilePic/profilePic/controller/App.controller.js +++ b/app/profilePic/profilePic/controller/App.controller.js @@ -7,9 +7,12 @@ sap.ui.define([ "sap/ui/core/Core", "sap/ui/model/json/JSONModel", "sap/ui/Device", - "sap/suite/ui/commons/library" + "sap/suite/ui/commons/library", + "sap/m/Dialog", + "sap/m/Button", + "sap/m/Input", ], - function (BaseController, MessageToast, oCore, JSONModel, Device, SuiteLibrary) { + function (BaseController, MessageToast, oCore, JSONModel, Device, SuiteLibrary, Dialog, Button, Input) { return BaseController.extend("profilePic.controller.App", { onInit: function () { @@ -25,7 +28,41 @@ sap.ui.define([ } }, - uploadPressed: async function (oEvent) { + enhancePressed: async function (oEvent) { + if (!this.oEnhanceDialog) { + var oResourceBundle = this.getView() + .getModel("i18n") + .getResourceBundle() + this.oEnhanceDialog = new Dialog({ + title: oResourceBundle.getText("enterSapCommunityName"), + draggable: true, + content: new Input({ + placeholder: oResourceBundle.getText("yourSapCommunityNameEG") + "dj.adams.sap", + value: "{/sapCommunityName}" + }), + buttons: [ + new Button({ + text: oResourceBundle.getText("enhance"), + press: function () { + this.upload() + this.oEnhanceDialog.close() + }.bind(this) + }), + new Button({ + text: oResourceBundle.getText("close"), + press: function () { + this.oEnhanceDialog.close() + }.bind(this) + }) + ] + }) + this.getView().addDependent(this.oEnhanceDialog) + } + + this.oEnhanceDialog.open() + }, + + upload: async function (oEvent) { let view = this.getView() let controller = view.getController() let oFileUploader = view.byId("fileToUpload") @@ -35,6 +72,7 @@ sap.ui.define([ } let param = view.byId("uploadParam") //param.setValue(oInput.getActivePage()) + param.setValue(this.getView().getModel().getData().sapCommunityName) oFileUploader.getParameters() var oImageEditor = this.getView().byId("image") oImageEditor.applyVisibleCrop() diff --git a/app/profilePic/profilePic/view/App.view.xml b/app/profilePic/profilePic/view/App.view.xml index abb2e60..d5a81c4 100644 --- a/app/profilePic/profilePic/view/App.view.xml +++ b/app/profilePic/profilePic/view/App.view.xml @@ -11,10 +11,10 @@ - + - +