mirror of
https://github.com/Dahlgren/arma-server-web-admin.git
synced 2024-08-30 17:22:10 +00:00
Show loader for mod update
This commit is contained in:
parent
8b893cb93c
commit
45e3c7f088
@ -6,6 +6,7 @@ define(function (require) {
|
||||
_ = require('underscore'),
|
||||
Backbone = require('backbone'),
|
||||
Marionette = require('marionette'),
|
||||
Ladda = require('ladda'),
|
||||
tpl = require('text!tpl/mods/list_item.html'),
|
||||
|
||||
template = _.template(tpl);
|
||||
@ -21,13 +22,23 @@ define(function (require) {
|
||||
update: function (event) {
|
||||
var self = this;
|
||||
event.preventDefault();
|
||||
|
||||
this.laddaBtn = Ladda.create(this.$el.find(".ladda-button").get(0));
|
||||
this.laddaBtn.start();
|
||||
this.$el.find('.ladda-button').addClass('disabled');
|
||||
|
||||
$.ajax({
|
||||
url: "/api/mods/" + this.model.get('name'),
|
||||
type: 'PUT',
|
||||
success: function (resp) {
|
||||
self.laddaBtn.stop();
|
||||
self.$el.find('.ladda-button').removeClass('disabled');
|
||||
self.trigger("mods:update", mods);
|
||||
},
|
||||
error: $.noop
|
||||
error: function (resp) {
|
||||
self.laddaBtn.stop();
|
||||
self.$el.find('.ladda-button').removeClass('disabled');
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
|
@ -1,7 +1,7 @@
|
||||
<td>
|
||||
<a href='#mods/<%-name%>'><%-name%></a>
|
||||
<% if (outdated) { %>
|
||||
<a class="btn btn-primary btn-xs update pull-right">
|
||||
<a class="btn btn-primary btn-xs update pull-right ladda-button" data-style="expand-left">
|
||||
<span class="glyphicon glyphicon-save"></span>
|
||||
Update
|
||||
</a>
|
||||
|
Loading…
Reference in New Issue
Block a user