Re-use code for ignore toggle
This commit is contained in:
@@ -136,7 +136,7 @@ MA.Release = new Class({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create release
|
// Create release
|
||||||
new Element('div', {
|
var item = new Element('div', {
|
||||||
'class': 'item '+status.identifier,
|
'class': 'item '+status.identifier,
|
||||||
'id': 'release_'+release.id
|
'id': 'release_'+release.id
|
||||||
}).adopt(
|
}).adopt(
|
||||||
@@ -165,22 +165,12 @@ MA.Release = new Class({
|
|||||||
'click': function(e){
|
'click': function(e){
|
||||||
(e).preventDefault();
|
(e).preventDefault();
|
||||||
self.ignore(release);
|
self.ignore(release);
|
||||||
if(this.getParent('.item').hasClass('failed')){
|
|
||||||
this.getParent('.item').toggleClass('failed');
|
|
||||||
this.parentNode.getElementsByTagName('span')[1].innerHTML = 'available';
|
|
||||||
}
|
|
||||||
else if(this.getParent('.item').hasClass('ignored')){
|
|
||||||
this.getParent('.item').toggleClass('ignored');
|
|
||||||
this.parentNode.getElementsByTagName('span')[1].innerHTML = 'available';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.getParent('.item').toggleClass('ignored');
|
|
||||||
this.parentNode.getElementsByTagName('span')[1].innerHTML = 'ignored';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
).inject(self.release_container)
|
).inject(self.release_container);
|
||||||
|
|
||||||
|
release['el'] = item;
|
||||||
|
|
||||||
if(status.identifier == 'ignored' || status.identifier == 'failed' || status.identifier == 'snatched'){
|
if(status.identifier == 'ignored' || status.identifier == 'failed' || status.identifier == 'snatched'){
|
||||||
if(!self.last_release || (self.last_release && self.last_release.status.identifier != 'snatched' && status.identifier == 'snatched'))
|
if(!self.last_release || (self.last_release && self.last_release.status.identifier != 'snatched' && status.identifier == 'snatched'))
|
||||||
@@ -329,6 +319,17 @@ MA.Release = new Class({
|
|||||||
Api.request('release.ignore', {
|
Api.request('release.ignore', {
|
||||||
'data': {
|
'data': {
|
||||||
'id': release.id
|
'id': release.id
|
||||||
|
},
|
||||||
|
'onComplete': function(){
|
||||||
|
var el = release.el;
|
||||||
|
if(el.hasClass('failed') || el.hasClass('ignored')){
|
||||||
|
el.removeClass('failed').removeClass('ignored');
|
||||||
|
el.getElement('.release_status').set('text', 'available');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
el.addClass('ignored');
|
||||||
|
el.getElement('.release_status').set('text', 'ignored');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -558,20 +558,12 @@
|
|||||||
.movies .options .table .item {
|
.movies .options .table .item {
|
||||||
border-bottom: 1px solid rgba(255,255,255,0.1);
|
border-bottom: 1px solid rgba(255,255,255,0.1);
|
||||||
}
|
}
|
||||||
.movies .options .table .item.ignored span {
|
.movies .options .table .item.ignored span,
|
||||||
text-decoration: line-through;
|
|
||||||
color: rgba(255,255,255,0.4);
|
|
||||||
}
|
|
||||||
.movies .options .table .item.ignored .delete:before {
|
|
||||||
display: inline-block;
|
|
||||||
content: "\e04b";
|
|
||||||
transform: scale(-1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.movies .options .table .item.failed span {
|
.movies .options .table .item.failed span {
|
||||||
text-decoration: line-through;
|
text-decoration: line-through;
|
||||||
color: rgba(255,255,255,0.4);
|
color: rgba(255,255,255,0.4);
|
||||||
}
|
}
|
||||||
|
.movies .options .table .item.ignored .delete:before,
|
||||||
.movies .options .table .item.failed .delete:before {
|
.movies .options .table .item.failed .delete:before {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
content: "\e04b";
|
content: "\e04b";
|
||||||
@@ -626,7 +618,7 @@
|
|||||||
.movies .options .table a:hover { opacity: 1; }
|
.movies .options .table a:hover { opacity: 1; }
|
||||||
.movies .options .table a.download { color: #a7fbaf; }
|
.movies .options .table a.download { color: #a7fbaf; }
|
||||||
.movies .options .table a.delete { color: #fda3a3; }
|
.movies .options .table a.delete { color: #fda3a3; }
|
||||||
.movies .options .table .ignored a.delete { color: #b5fda3; }
|
.movies .options .table .ignored a.delete,
|
||||||
.movies .options .table .failed a.delete { color: #b5fda3; }
|
.movies .options .table .failed a.delete { color: #b5fda3; }
|
||||||
|
|
||||||
.movies .options .table .head > * {
|
.movies .options .table .head > * {
|
||||||
|
|||||||
Reference in New Issue
Block a user