blob: 7080c84c035dbbe8d173e320dd7c6748760db5b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
ClipPlay.Views.SampleAddView = Marionette.View.extend({
events: {
'click .js-create-sample': 'on_sample_add'
},
initialize: function(options) {
this.setElement(options.el);
this.$input = this.$('.js-sample-url');
},
add_sample_to_collection: function() {
this.collection.add({
url: this.$input.val()
});
},
clear_input: function() {
this.$input.val('');
},
on_sample_add: function() {
if (this.$input.val()) {
this.add_sample_to_collection();
this.clear_input();
}
return false;
}
});
|