diff --git a/public/js/app/views/missions/upload.js b/public/js/app/views/missions/upload.js index 937258f..8d037c0 100644 --- a/public/js/app/views/missions/upload.js +++ b/public/js/app/views/missions/upload.js @@ -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(); }); }, }); diff --git a/public/js/app/views/missions/workshop.js b/public/js/app/views/missions/workshop.js index 8986bef..4ed2762 100644 --- a/public/js/app/views/missions/workshop.js +++ b/public/js/app/views/missions/workshop.js @@ -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(); }, }); }, diff --git a/public/js/tpl/missions/upload.html b/public/js/tpl/missions/upload.html index 63e1c92..79c113e 100644 --- a/public/js/tpl/missions/upload.html +++ b/public/js/tpl/missions/upload.html @@ -4,5 +4,5 @@ Only supports missions packed as a PBO - + diff --git a/public/js/tpl/missions/workshop.html b/public/js/tpl/missions/workshop.html index cf34439..65d8a70 100644 --- a/public/js/tpl/missions/workshop.html +++ b/public/js/tpl/missions/workshop.html @@ -7,5 +7,5 @@ https://steamcommunity.com/workshop/filedetails/?id=$id - +