Skip to content
This repository was archived by the owner on Mar 14, 2020. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/js/views/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
.attr({id:'importFile'})
.addClass('hidden-accessible')
.change(widget._importChangedCallback)
.appendTo(this.element[0].ownerDocument.body);
.appendTo(this.element[0].ownerDocument.body)
.wrap("<form />");

// Add a project setting dialog element, used to trigger to configure
// project setting when user want to create or modify project setting
Expand All @@ -63,20 +64,23 @@
},

_importChangedCallback: function (e) {
var file;
if (e.currentTarget.files.length === 1) {
file = e.currentTarget.files[0];
var selected, file;
selected = e.currentTarget.files;
if (selected.length === 1) {
file = selected[0];
$.rib.pmUtils.importProject(file, function () {
// show the layout tab
$(document.body).tabs('select', 1);
});
} else {
if (e.currentTarget.files.length <= 1) {
if (selected.length <= 1) {
console.warn("No files specified to import");
} else {
console.warn("Multiple file import not supported");
}
}
// clear the selected file
e.currentTarget.form.reset();
},
_setOption: function(key, value) {
switch (key) {
Expand Down