Skip to content

Commit

Permalink
Merge pull request #4402 from IQSS/4401-upload-dragdrop-msg
Browse files Browse the repository at this point in the history
Fixed issue with drag and drop msg on File Upload pg [ref #4401]
  • Loading branch information
kcondon authored Jan 11, 2018
2 parents 4e3a1ac + 06a3563 commit 9f71258
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/main/java/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1258,10 +1258,10 @@ file.count.selected={0} {0, choice, 0#Files Selected|1#File Selected|2#Files Sel
file.selectToAddBtn=Select Files to Add
file.selectToAdd.tipLimit=File upload limit is {0} bytes per file.
file.selectToAdd.tipMoreInformation=For more information about supported file formats, please refer to the <a href="{0}/{1}/user/dataset-management.html#file-handling-and-uploading" title="File Handling and Uploading - Dataverse User Guide" target="_blank">User Guide</a>.
file.selectToAdd.dragdropMsg=Drag and drop files here.
file.createUploadDisabled=Once you have saved your dataset, you can upload your data using the "Upload Files" button on the dataset page. For more information about supported file formats, please refer to the User Guide.
file.fromDropbox=Upload from Dropbox
file.fromDropbox.tip=Files can also be uploaded directly from Dropbox.
file.fromDropbox.description=Drag and drop files here.
file.replace.original=Original File
file.editFiles=Edit Files
file.bulkUpdate=Bulk Update
Expand Down
13 changes: 5 additions & 8 deletions src/main/webapp/editFilesFragment.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,14 @@
<script>
function uploadWidgetDropMsg() {
var fileUpload = $('div[id$="fileUpload"] div.ui-fileupload-content');
if ($(fileUpload).children('#dragdropMsg').length) {
// do nothing
} else {
$(fileUpload).prepend('<div id="dragdropMsg">#{bundle['file.fromDropbox.description']}</div>');
if ($(fileUpload).children('#dragdropMsg').length === 0) {
$(fileUpload).prepend('<div id="dragdropMsg">#{bundle['file.selectToAdd.dragdropMsg']}</div>');
}
}
function uploadStarted() {
$('button[id$="uploadStarted"]').trigger('click');
}
function uploadFinished(fileupload) {

if (fileupload.files.length === 0) {
$('button[id$="AllUploadsFinished"]').trigger('click');
//alert("all uploads finished");
Expand All @@ -45,7 +42,7 @@
$('button[id$="dropBoxUploadFinished"]').trigger('click');
}
function uploadWidgetDropRemoveMsg() {
$('div[id$="fileUpload"] div.ui-fileupload-content div.dropMsg').remove();
$('div[id$="fileUpload"] div.ui-fileupload-content div#dragdropMsg').remove();
}
$(document).ready(function () {
uploadWidgetDropMsg();
Expand Down Expand Up @@ -75,7 +72,7 @@
process="filesTable"
update="@this"
label="#{bundle['file.selectToAddBtn']}"
oncomplete="javascript:dataset_fileupload_rebind();uploadWidgetDropMsg();uploadFinished(PF('fileUploadWidget'));"
oncomplete="javascript:dataset_fileupload_rebind();uploadFinished(PF('fileUploadWidget'));"
onstart="javascript:uploadWidgetDropRemoveMsg();uploadStarted();"
sizeLimit="#{EditDatafilesPage.getMaxFileUploadSizeInBytes()}"
fileLimit="#{EditDatafilesPage.getMaxNumberOfFiles()}"
Expand All @@ -97,7 +94,7 @@
<p:message for="fileUpload" id="uploadMessage" display="text" />

<p:commandButton id="uploadStarted" action="#{EditDatafilesPage.uploadStarted()}" update="" style="display:none"/>
<p:commandButton id="AllUploadsFinished" action="#{EditDatafilesPage.uploadFinished()}" update="datasetForm:fileUpload,datasetForm:dropBoxUserButton,datasetForm:uploadMessage,datasetForm:filesTable" style="display:none"/>
<p:commandButton id="AllUploadsFinished" action="#{EditDatafilesPage.uploadFinished()}" update="datasetForm:fileUpload,datasetForm:dropBoxUserButton,datasetForm:uploadMessage,datasetForm:filesTable" oncomplete="javascript:uploadWidgetDropMsg();" style="display:none"/>
<p:commandButton id="dropBoxUploadFinished" action="#{EditDatafilesPage.uploadFinished()}" update="datasetForm:fileUpload,datasetForm:dropBoxUserButton,datasetForm:dropBoxUploadMessage,datasetForm:filesTable" style="display:none"/>
</ui:fragment>

Expand Down

0 comments on commit 9f71258

Please sign in to comment.