More feedback on download button. fix #537

This commit is contained in:
Ruud
2012-07-11 23:50:00 +02:00
parent db347f3fb7
commit 0c14334e23
5 changed files with 22 additions and 6 deletions
+16 -2
View File
@@ -365,7 +365,8 @@ var ReleaseAction = new Class({
} catch(e){}
new Element('div', {
'class': 'item '+status.identifier
'class': 'item '+status.identifier,
'id': 'release_'+release.id
}).adopt(
new Element('span.name', {'text': self.get(release, 'name'), 'title': self.get(release, 'name')}),
new Element('span.status', {'text': status.identifier, 'class': 'release_status '+status.identifier}),
@@ -382,7 +383,8 @@ var ReleaseAction = new Class({
'events': {
'click': function(e){
(e).preventDefault();
self.download(release);
if(!this.hasClass('completed'))
self.download(release);
}
}
}),
@@ -414,9 +416,21 @@ var ReleaseAction = new Class({
download: function(release){
var self = this;
var release_el = self.release_container.getElement('#release_'+release.id),
icon = release_el.getElement('.download.icon');
icon.addClass('spinner');
Api.request('release.download', {
'data': {
'id': release.id
},
'onComplete': function(json){
icon.removeClass('spinner')
if(json.success)
icon.addClass('completed');
else
icon.addClass('attention').set('title', 'Something went wrong when downloading, please check logs.');
}
});
},
+3 -3
View File
@@ -146,16 +146,16 @@ class Release(Plugin):
provider = fireEvent('provider.belongs_to', item['url'], provider = item.get('provider'), single = True)
item['download'] = provider.download
fireEvent('searcher.download', data = item, movie = rel.movie.to_dict({
success = fireEvent('searcher.download', data = item, movie = rel.movie.to_dict({
'profile': {'types': {'quality': {}}},
'releases': {'status': {}, 'quality': {}},
'library': {'titles': {}, 'files':{}},
'files': {}
}), manual = True)
}), manual = True, single = True)
#db.close()
return jsonified({
'success': True
'success': success
})
else:
log.error('Couldn\'t find release with id: %s', id)