Snatch next didn't pick correct element

This commit is contained in:
Ruud committed 2013-09-17 20:18:41 +02:00
1 parent 18e3194e27
commit a092f394fa
1 file changed
+12 -7
@@ -261,26 +261,29 @@ MA.Release = new Class({
self.trynext_container = new Element('div.buttons.try_container').inject(self.release_container, 'top'); self.trynext_container = new Element('div.buttons.try_container').inject(self.release_container, 'top');
var nr = self.next_release,
lr = self.last_release;
self.trynext_container.adopt( self.trynext_container.adopt(
new Element('span.or', { new Element('span.or', {
'text': 'This movie is snatched, if anything went wrong, download' 'text': 'This movie is snatched, if anything went wrong, download'
}), }),
self.last_release ? new Element('a.button.orange', { lr ? new Element('a.button.orange', {
'text': 'the same release again', 'text': 'the same release again',
'events': { 'events': {
'click': function(){ 'click': function(){
self.download(self.last_release); self.download(lr);
} }
} }
}) : null, }) : null,
self.next_release && self.last_release ? new Element('span.or', { nr && lr ? new Element('span.or', {
'text': ',' 'text': ','
}) : null, }) : null,
self.next_release ? [new Element('a.button.green', { nr ? [new Element('a.button.green', {
'text': self.last_release ? 'another release' : 'the best release', 'text': lr ? 'another release' : 'the best release',
'events': { 'events': {
'click': function(){ 'click': function(){
self.download(self.next_release); self.download(nr);
} }
} }
}), }),
@@ -371,8 +374,10 @@ MA.Release = new Class({
'onComplete': function(json){ 'onComplete': function(json){
icon.removeClass('icon spinner'); icon.removeClass('icon spinner');
if(json.success) if(json.success){
icon.addClass('completed'); icon.addClass('completed');
release_el.getElement('.release_status').set('text', 'snatched');
}
else else
icon.addClass('attention').set('title', 'Something went wrong when downloading, please check logs.'); icon.addClass('attention').set('title', 'Something went wrong when downloading, please check logs.');
} }