Merge branches 'develop' and 'manual_scan' of https://github.com/RuudBurger/CouchPotatoServer into manual_scan

Conflicts:
	couchpotato/core/plugins/renamer/main.py
This commit is contained in:
Joel Kåberg
2013-12-16 07:29:31 +01:00
225 changed files with 22249 additions and 10130 deletions
+13
View File
@@ -57,6 +57,19 @@ Page.Home = new Class({
'limit': null,
'onLoaded': function(){
self.chain.callChain();
},
'onMovieAdded': function(notification){
// Track movie added
var after_search = function(data){
if(notification.data.id != data.data.id) return;
// Force update after search
self.available_list.update();
App.off('movie.searcher.ended', after_search);
}
App.on('movie.searcher.ended', after_search);
}
});
+17 -2
View File
@@ -102,6 +102,8 @@ Page.Manage = new Class({
}
}
else {
// Capture progress so we can use it in our *each* closure
var progress = json.progress
// Don't add loader when page is loading still
if(!self.list.navigation)
@@ -112,10 +114,13 @@ Page.Manage = new Class({
self.progress_container.empty();
Object.each(json.progress, function(progress, folder){
var sorted_table = self.parseProgress(json.progress)
sorted_table.each(function(folder){
var folder_progress = progress[folder]
new Element('div').adopt(
new Element('span.folder', {'text': folder}),
new Element('span.percentage', {'text': progress.total ? (((progress.total-progress.to_go)/progress.total)*100).round() + '%' : '0%'})
new Element('span.percentage', {'text': folder_progress.total ? (((folder_progress.total-folder_progress.to_go)/folder_progress.total)*100).round() + '%' : '0%'})
).inject(self.progress_container)
});
@@ -124,7 +129,17 @@ Page.Manage = new Class({
})
}, 1000);
},
parseProgress: function (progress_object) {
var folder, temp_array = [];
for (folder in progress_object) {
if (progress_object.hasOwnProperty(folder)) {
temp_array.push(folder)
}
}
return temp_array.stableSort()
}
});
+62 -18
View File
@@ -111,6 +111,10 @@ Page.Settings = new Class({
Cookie.write('advanced_toggle_checked', +self.advanced_toggle.checked, {'duration': 365});
},
sortByOrder: function(a, b){
return (a.order || 100) - (b.order || 100)
},
create: function(json){
var self = this;
@@ -141,13 +145,11 @@ Page.Settings = new Class({
options.include(section);
});
options.sort(function(a, b){
return (a.order || 100) - (b.order || 100)
}).each(function(section){
options.stableSort(self.sortByOrder).each(function(section){
var section_name = section.section_name;
// Add groups to content
section.groups.sortBy('order').each(function(group){
section.groups.stableSort(self.sortByOrder).each(function(group){
if(group.hidden) return;
if(self.wizard_only && !group.wizard)
@@ -184,9 +186,7 @@ Page.Settings = new Class({
}
// Add options to group
group.options.sort(function(a, b){
return (a.order || 100) - (b.order || 100)
}).each(function(option){
group.options.stableSort(self.sortByOrder).each(function(option){
if(option.hidden) return;
var class_name = (option.type || 'string').capitalize();
var input = new Option[class_name](section_name, option.name, self.getValue(section_name, option.name), option);
@@ -265,16 +265,27 @@ Page.Settings = new Class({
},
createGroup: function(group){
if((typeOf(group.description) == 'array')){
var hint = new Element('span.hint.more_hint', {
'html': group.description[0]
});
createTooltip(group.description[1]).inject(hint, 'top');
}
else {
var hint = new Element('span.hint', {
'html': group.description || ''
})
}
return new Element('fieldset', {
'class': (group.advanced ? 'inlineLabels advanced' : 'inlineLabels') + ' group_' + (group.name || '') + ' subtab_' + (group.subtab || '')
}).adopt(
}).grab(
new Element('h2', {
'text': group.label || (group.name).capitalize()
}).adopt(
new Element('span.hint', {
'html': group.description || ''
})
)
}).grab(hint)
);
},
@@ -343,10 +354,22 @@ var OptionBase = new Class({
createHint: function(){
var self = this;
if(self.options.description)
new Element('p.formHint', {
'html': self.options.description
}).inject(self.el);
if(self.options.description){
if((typeOf(self.options.description) == 'array')){
var hint = new Element('p.formHint.more_hint', {
'html': self.options.description[0]
}).inject(self.el);
createTooltip(self.options.description[1]).inject(hint, 'top');
}
else {
var hint = new Element('p.formHint', {
'html': self.options.description || ''
}).inject(self.el)
}
}
},
afterInject: function(){
@@ -1412,4 +1435,25 @@ Option.Combined = new Class({
self.saveCombined();
}
});
});
var createTooltip = function(description){
var tip = new Element('div.tooltip', {
'events': {
'mouseenter': function(){
tip.addClass('shown')
},
'mouseleave': function(){
tip.removeClass('shown')
}
}
}).adopt(
new Element('a.icon2.info'),
new Element('div.tip', {
'html': description
})
);
return tip;
}