Browse Source

Some more profile setting fixes

pull/51/merge
Ruud 14 years ago
parent
commit
65c517f653
  1. 24
      couchpotato/core/plugins/profile/static/profile.css
  2. 50
      couchpotato/core/plugins/quality/static/quality.js

24
couchpotato/core/plugins/profile/static/profile.css

@ -92,30 +92,21 @@
} }
#profile_ordering .head {
float: left;
}
#profile_ordering .head span {
margin: 0 10px 0 -5px;
}
#profile_ordering ul { #profile_ordering ul {
clear: both;
float: left; float: left;
margin-left: 20%; margin: 0;
width: 275px; width: 275px;
padding: 0;
} }
#profile_ordering li { #profile_ordering li {
clear: both;
overflow: hidden;
cursor: grab; cursor: grab;
cursor: -moz-grab; cursor: -moz-grab;
cursor: -webkit-grab; cursor: -webkit-grab;
border-bottom: 1px solid rgba(255,255,255,0.2); border-bottom: 1px solid rgba(255,255,255,0.2);
padding: 0 5px; padding: 0 5px;
} }
#profile_ordering li:last-child { border: 0; }
#profile_ordering li .check { #profile_ordering li .check {
margin: 2px 10px 0 0; margin: 2px 10px 0 0;
@ -133,4 +124,11 @@
background: url('./handle.png') center; background: url('./handle.png') center;
width: 20px; width: 20px;
float: right; float: right;
} }
#profile_ordering .formHint {
clear: none;
float: right;
width: 250px;
margin: 0;
}

50
couchpotato/core/plugins/quality/static/quality.js

@ -58,28 +58,30 @@ var QualityBase = new Class({
*/ */
createProfiles: function(){ createProfiles: function(){
var self = this; var self = this;
var non_core_profiles = Object.filter(self.profiles, function(profile){ return !profile.isCore() });
var count = Object.getLength(non_core_profiles);
self.settings.createGroup({ self.settings.createGroup({
'label': 'Quality Profiles', 'label': 'Quality Profiles',
'description': 'Create your own profiles with multiple qualities.' 'description': 'Create your own profiles with multiple qualities.'
}).inject(self.content).adopt( }).inject(self.content).adopt(
self.profile_container = new Element('div.container'),
new Element('a.add_new_profile', { new Element('a.add_new_profile', {
'text': 'Create a new quality profile', 'text': count > 0 ? 'Create another quality profile' : 'Click here to create a quality profile.',
'events': { 'events': {
'click': function(){ 'click': function(){
var profile = self.createProfilesClass(); var profile = self.createProfilesClass();
$(profile).inject(self.profile_container, 'top') $(profile).inject(self.profile_container)
} }
} }
}), })
self.profile_container = new Element('div.container') );
)
// Add profiles, that aren't part of the core (for editing) // Add profiles, that aren't part of the core (for editing)
Object.each(self.profiles, function(profile){ Object.each(non_core_profiles, function(profile){
if(!profile.isCore()) $(profile).inject(self.profile_container)
$(profile).inject(self.profile_container, 'top') });
})
}, },
@ -96,22 +98,17 @@ var QualityBase = new Class({
var profile_list; var profile_list;
var group = self.settings.createGroup({ var group = self.settings.createGroup({
'label': 'Profile Order', 'label': 'Profile Defaults'
'description': 'Change the order the profiles are in the dropdown list.'
}).adopt( }).adopt(
new Element('.ctrlHolder#profile_ordering').adopt( new Element('.ctrlHolder#profile_ordering').adopt(
new Element('label[text=Order]'), new Element('label[text=Order]'),
new Element('.head').adopt( profile_list = new Element('ul'),
new Element('span.show[text=Show]'), new Element('p.formHint', {
new Element('span.profile_label[text=Profile]') 'html': 'Change the order the profiles are in the dropdown list. Uncheck to hide it completely.<br />First one will be default.'
), })
profile_list = new Element('ul')
) )
).inject(self.content) ).inject(self.content)
Object.each(self.profiles, function(profile){ Object.each(self.profiles, function(profile){
var check; var check;
new Element('li', {'data-id': profile.data.id}).adopt( new Element('li', {'data-id': profile.data.id}).adopt(
@ -126,9 +123,9 @@ var QualityBase = new Class({
}), }),
new Element('span.handle') new Element('span.handle')
).inject(profile_list); ).inject(profile_list);
new Form.Check(check); new Form.Check(check);
}); });
// Sortable // Sortable
@ -140,26 +137,25 @@ var QualityBase = new Class({
}); });
}, },
saveProfileOrdering: function(){ saveProfileOrdering: function(){
var self = this; var self = this;
var ids = []; var ids = [];
var hidden = []; var hidden = [];
self.profile_sortable.list.getElements('li').each(function(el, nr){ self.profile_sortable.list.getElements('li').each(function(el, nr){
ids.include(el.get('data-id')); ids.include(el.get('data-id'));
hidden[nr] = +!el.getElement('input[type=checkbox]').get('checked'); hidden[nr] = +!el.getElement('input[type=checkbox]').get('checked');
}); });
p(ids, hidden);
Api.request('profile.save_order', { Api.request('profile.save_order', {
'data': { 'data': {
'ids': ids, 'ids': ids,
'hidden': hidden 'hidden': hidden
} }
}); });
}, },
/** /**

Loading…
Cancel
Save