Fix Import Project form to check for the presence of a file (#2979)

This commit is contained in:
Chetan Verma 2020-07-25 13:15:45 +05:30 committed by GitHub
parent d8728c97b9
commit 602149db6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 6 deletions

View File

@ -82,6 +82,7 @@
"core-index-import/parse-as": "Parse data as",
"core-index-import/this-computer": "This Computer",
"core-index-import/warning-data-file": "You must specify a data file to import.",
"core-index-import/warning-import-file": "You must specify a project file.",
"core-index-import/uploading-data": "Uploading data…",
"core-index-import/web-address": "Web Addresses (URLs)",
"core-index-import/warning-web-address": "You must specify a valid web address (URL) to import.",

View File

@ -3,15 +3,15 @@
<tr>
<td colspan="2" id="or-import-locate"></td>
<tr>
<td id="or-import-file"></th>
<td><input type="file" id="project-tar-file-input" name="project-file" /></td>
<td id="or-import-file"></td>
<td><input type="file" id="project-tar-file-input" name="project-file"/></td>
</tr>
<tr>
<td id="or-import-rename"></th>
<td id="or-import-rename"></td>
<td><input type="text" size="25" id="project-name-input" name="project-name" /></td></tr>
<tr>
<td></td>
<td><input type="submit" id="import-project-button" class="button button-primary" /></td>
<td><input type="button" id="import-project-button" class="button button-primary" bind="projectButton"/></td>
</tr>
</table></div>
</form>

View File

@ -40,7 +40,15 @@ Refine.ImportProjectUI = function(elmt) {
this._elmt = elmt;
this._elmts = DOM.bind(elmt);
this._elmts.projectButton.bind('click', function(e) {
if(document.getElementById("project-tar-file-input").value === "" ){
alert($.i18n('core-index-import/warning-import-file'));
}
else{
document.getElementById("import-project-button").type = "submit";
}
});
$('#or-import-locate').text($.i18n('core-index-import/locate'));
$('#or-import-file').text($.i18n('core-index-import/file'));
$('#or-import-rename').text($.i18n('core-index-import/rename'));
@ -54,5 +62,5 @@ Refine.actionAreas.push({
});
Refine.ImportProjectUI.prototype.resize = function() {
};