1
0
mirror of https://github.com/2ec0b4/kaamelott-soundboard.git synced 2025-12-08 15:43:24 +00:00

(petosorus-random_button) Active / désactive le bouton

This commit is contained in:
Antoine
2020-02-11 22:49:21 +01:00
parent 3190ad6dda
commit 8c38fde4b2
3 changed files with 18 additions and 3 deletions

View File

@@ -17,15 +17,25 @@ define("views/random", function(require) {
"click @ui.resetButton": "reset"
},
initialize: function() {
var that = this;
this.channel = Radio.channel("Sounds");
this.channel.on("sounds:filter", function (value) {
if (value == "") {
return;
}
that.enableButton();
});
},
random: function() {
this.$el.find(this.ui.resetButton).removeClass('hidden');
this.enableButton();
this.channel.trigger("sounds:random");
},
reset: function() {
this.$el.find(this.ui.resetButton).addClass('hidden');
this.$el.find(this.ui.resetButton).attr('disabled', 'disabled');
this.channel.trigger("sounds:reset");
},
enableButton: function() {
this.$el.find(this.ui.resetButton).removeAttr('disabled');
}
});