mirror of
https://github.com/Dahlgren/arma-server-web-admin.git
synced 2024-08-30 17:22:10 +00:00
Fixed loading indicator not working on mission upload and download
This commit is contained in:
parent
f121729211
commit
12cab35055
@ -24,29 +24,24 @@ define(function (require) {
|
||||
this.model = new Mission();
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
var $okBtn = this.$el.find('form button[type=submit]');
|
||||
$okBtn.addClass('ladda-button').attr('data-style', 'expand-left');
|
||||
|
||||
this.laddaBtn = Ladda.create($okBtn.get(0));
|
||||
},
|
||||
|
||||
submit: function () {
|
||||
var self = this;
|
||||
var $form = this.$el.find('form');
|
||||
|
||||
this.laddaBtn.start();
|
||||
var $uploadBtn = $form.find('button[type=submit]');
|
||||
var laddaBtn = Ladda.create($uploadBtn.get(0));
|
||||
laddaBtn.start();
|
||||
|
||||
$.ajax("/api/missions", {
|
||||
files: $form.find(":file"),
|
||||
iframe: true
|
||||
}).complete(function(data) {
|
||||
self.missions.fetch({success : function () {
|
||||
self.laddaBtn.stop();
|
||||
laddaBtn.stop();
|
||||
self.render();
|
||||
}});
|
||||
}).error(function() {
|
||||
self.laddaBtn.stop();
|
||||
laddaBtn.stop();
|
||||
});
|
||||
},
|
||||
});
|
||||
|
@ -23,18 +23,13 @@ define(function (require) {
|
||||
this.missions = options.missions;
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
var $okBtn = this.$el.find('form button[type=submit]');
|
||||
$okBtn.addClass('ladda-button').attr('data-style', 'expand-left');
|
||||
|
||||
this.laddaBtn = Ladda.create($okBtn.get(0));
|
||||
},
|
||||
|
||||
submit: function () {
|
||||
var self = this;
|
||||
var $form = this.$el.find('form');
|
||||
|
||||
this.laddaBtn.start();
|
||||
var $downloadBtn = $form.find('button[type=submit]');
|
||||
var laddaBtn = Ladda.create($downloadBtn.get(0));
|
||||
laddaBtn.start();
|
||||
|
||||
$.ajax({
|
||||
url: '/api/missions/workshop',
|
||||
@ -45,12 +40,12 @@ define(function (require) {
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
self.missions.fetch({success : function () {
|
||||
self.laddaBtn.stop();
|
||||
laddaBtn.stop();
|
||||
self.render();
|
||||
}});
|
||||
},
|
||||
error: function () {
|
||||
self.laddaBtn.stop();
|
||||
laddaBtn.stop();
|
||||
},
|
||||
});
|
||||
},
|
||||
|
@ -4,5 +4,5 @@
|
||||
<input type="file" class="form-control path" name="mission" id="mission" data-field="mission">
|
||||
<span class="help-block">Only supports missions packed as a PBO</span>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Upload</button>
|
||||
<button type="submit" class="btn btn-primary ladda-button" data-style="expand-left">Upload</button>
|
||||
</form>
|
||||
|
@ -7,5 +7,5 @@
|
||||
<i>https://steamcommunity.com/workshop/filedetails/?id=$id</i>
|
||||
</span>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Download</button>
|
||||
<button type="submit" class="btn btn-primary ladda-button" data-style="expand-left">Download</button>
|
||||
</form>
|
||||
|
Loading…
Reference in New Issue
Block a user