Skip to content

Commit 89c478c

Browse files
committed
simplify re-upload
1 parent a25e60d commit 89c478c

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

public/js/seams.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ seamsApp.controller('seamsController', ['$scope', '$route', '$routeParams', '$lo
149149

150150
$scope.$root.fetchRemoteFile = function(fileUrl) {
151151
if (fileUrl) {
152+
$scope.$root.reUpload = true;
152153
$('#remoteFileError').html("");
153154
$scope.$root.fetchingRemoteFile = true;
154155
$http.post("/fetch", {"url":fileUrl}, {json: true})
@@ -159,8 +160,9 @@ seamsApp.controller('seamsController', ['$scope', '$route', '$routeParams', '$lo
159160
for(var i in data.fields) {
160161
data.fields[i].safename=data.fields[i].name.toLowerCase().replace(/\W/g,"_");
161162
}
162-
$scope.$root.currentStatus = "uploaded";
163+
$scope.$root.currentStatus = "uploaded";
163164
$scope.$root.schema = data;
165+
$scope.$root.fetchingRemoteFile = false;
164166
$scope.$root.goToNextPage("import");
165167
}
166168
else {
@@ -177,6 +179,7 @@ seamsApp.controller('seamsController', ['$scope', '$route', '$routeParams', '$lo
177179
};
178180

179181
$scope.$root.fileUploaded = function() {
182+
$scope.$root.reUpload = true;
180183
$('#fileuploadcontrol').hide();
181184
$('#uploadform').ajaxForm({
182185
beforeSend: function() {
@@ -211,6 +214,7 @@ seamsApp.controller('seamsController', ['$scope', '$route', '$routeParams', '$lo
211214
// the actual import process
212215
$scope.$root.importClicked = function() {
213216
console.log("IMPORT");
217+
$scope.$root.reUpload = false;
214218
$('#importbutton').attr('disabled',true);
215219
$('#backbutton').attr('disabled',true);
216220
$('.import-spinner').css('display','inline-block');

views/templates/upload.html

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ <h1 class="type_heading"><mark class="type_mark">Upload Data</mark></h1>
55

66
<section class="layout_section theme_dark">
77

8-
<div ng-show="!currentStatus || currentStatus == 'new' || reUpload">
8+
<div ng-show="!currentStatus || currentStatus == 'new' || $root.reUpload">
99
<!--
1010
<form id="uploadform" action="/upload" method="post" enctype="multipart/form-data">
1111
<fieldset class="form_field">
@@ -55,14 +55,11 @@ <h1 class="type_heading"><mark class="type_mark">Upload Data</mark></h1>
5555
</div>
5656

5757
<div ng-show="currentStatus == 'uploaded'" class="alert alert-success">
58-
<p class="type_copy">Your{{ reUpload ? ' previous ' : ' ' }}data was uploaded successfully.</p>
58+
<p class="type_copy">Your{{ $root.reUpload ? ' previous ' : ' ' }}data was uploaded successfully.</p>
5959
</div>
6060

6161
<div class="button_group" ng-show="currentStatus && currentStatus != 'new'">
6262
<button type="button" class="button_primary" ng-click="goToNextPage('import')"> Continue </button>
63-
<button ng-show="currentStatus == 'uploaded' && !reUpload" class="button_secondary"
64-
type="button" ng-click="reUpload = true;">
65-
Re-upload </button>
6663
</div>
6764

6865
</section>

0 commit comments

Comments
 (0)