[ofbiz-plugins] branch release17.12 updated: Fixed: Error while uploading file in Ecommerce Profile's File Manager (OFBIZ-10746)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-plugins] branch release17.12 updated: Fixed: Error while uploading file in Ecommerce Profile's File Manager (OFBIZ-10746)

jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch release17.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-plugins.git


The following commit(s) were added to refs/heads/release17.12 by this push:
     new 6d87d52  Fixed: Error while uploading file in Ecommerce Profile's File Manager (OFBIZ-10746)
6d87d52 is described below

commit 6d87d52388323dbc0eb60f301e3767d6a04a18c9
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Tue Jun 23 14:56:32 2020 +0200

    Fixed: Error while uploading file in Ecommerce Profile's File Manager (OFBIZ-10746)
   
    This is only fixing the UI where you did not see the file to upload you selected
   
    There is still an issue to upload the file
   
    Changes done by hand, impossible to cherry-pick
   
    Thanks: Priya Sharma for testing
---
 ecommerce/template/customer/ViewProfile.ftl | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/ecommerce/template/customer/ViewProfile.ftl b/ecommerce/template/customer/ViewProfile.ftl
index ed213e0..0395738 100644
--- a/ecommerce/template/customer/ViewProfile.ftl
+++ b/ecommerce/template/customer/ViewProfile.ftl
@@ -464,10 +464,20 @@ under the License.
         <input type="hidden" name="statusId" value="CTNT_PUBLISHED"/>
         <input type="hidden" name="roleTypeId" value="OWNER"/>
         <label class="mr-2">${uiLabelMap.EcommerceUploadNewFile}</label>
-        <label class="custom-file mr-2">
-          <input type="file" name="uploadedFile" class="custom-file-input"/>
-          <span class="custom-file-control"></span>
-        </label>
+        <div class="custom-file mr-2">
+          <input type="file" class="custom-file-input" id="customFile" required/>
+          <label class="custom-file-label" for="customFile">Choose file</label>
+          <div class="invalid-feedback">Example invalid custom file feedback</div>
+        </div>
+        <script>
+            $('#customFile').on('change',function(){
+                //get the file name
+                var fileName = $(this).val();
+                fileName = fileName.replace('C:\\fakepath\\', " ");
+                //replace the "Choose a file" label
+                $(this).next('.custom-file-label').html(fileName);
+            })
+        </script>
         <select name="partyContentTypeId" class="custom-select mr-2">
           <option value="">${uiLabelMap.PartySelectPurpose}</option>
           <#list partyContentTypes as partyContentType>