Skip to content

Commit

Permalink
Added translation and improved visibility of document upload status m…
Browse files Browse the repository at this point in the history
…essage

Signed-off-by: Mishel Shaji <itconsultant@gpsrenewables.com>
  • Loading branch information
gpsrenewablesit committed Aug 1, 2023
1 parent b5a28d3 commit 7be9854
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
6 changes: 5 additions & 1 deletion css/viewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

#save-progress{
text-align: center;
padding: 5px 0;
display: none;
padding: 10px 0;
background-color: #ffe4c4;
font-size: 1.5rem;
position: sticky;
z-index: 2;
}
8 changes: 5 additions & 3 deletions js/files_pdfviewer-workersrc.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/files_pdfviewer-workersrc.js.map

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions src/workersrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/**
* @copyright Copyright (c) 2020 Daniel Calviño Sánchez <danxuliu@gmail.com>
*
Expand Down Expand Up @@ -36,6 +35,7 @@ const urlParams = new URLSearchParams(queryString)
const canDownload = urlParams.get('canDownload')
let isUploading = false
let uploadProgressMessage = null
const t = window.parent.t

function initializeCustomPDFViewerApplication() {
const head = document.getElementsByTagName('head')[0]
Expand Down Expand Up @@ -89,14 +89,14 @@ function initializeCustomPDFViewerApplication() {
logger.info('Download and print available')

PDFViewerApplication.download = function() {
alert('Please make some changes and click save.')
alert(t('files_pdfviewer', 'Please make some changes and click save.'))
}

PDFViewerApplication.save = function() {
logger.info('PDF Document with annotation is being saved.')
PDFViewerApplication.pdfDocument.saveDocument().then(function(data) {
if (isUploading) {
alert('Please wait for the upload to complete.')
alert(t('files_pdfviewer', 'Please wait for the upload to complete.'))
return
}

Expand Down Expand Up @@ -133,6 +133,7 @@ function savePdf(data, pdfAppication) {
isUploading = false
uploadProgressMessage.style.display = 'none'
}).catch(function(error) {
alert(t('files_pdfviewer', 'File upload failed.'))
logger.error('Error uploading file:', error)
isUploading = false
})
Expand Down
2 changes: 1 addition & 1 deletion templates/viewer.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
</div> <!-- sidebarContainer -->

<div id="mainContainer">
<div id="save-progress">Saving document</div>
<div id="save-progress"><?php p($l->t('Saving document.')); ?></div>
<div class="findbar hidden doorHanger" id="findbar">
<div id="findbarInputContainer">
<input id="findInput" class="toolbarField" title="Find" placeholder="Find in document…" tabindex="91" data-l10n-id="find_input" aria-invalid="false">
Expand Down

0 comments on commit 7be9854

Please sign in to comment.