Browse Source

Actions

pull/1/merge
Ruud 14 years ago
parent
commit
2a60a4eaa3
  1. 2
      couchpotato/core/settings/__init__.py
  2. BIN
      couchpotato/static/images/edit.png
  3. BIN
      couchpotato/static/images/gear.png
  4. BIN
      couchpotato/static/images/imdb.png
  5. BIN
      couchpotato/static/images/rating.png
  6. BIN
      couchpotato/static/images/reload.png
  7. 34
      couchpotato/static/scripts/block/search.js
  8. 4
      couchpotato/static/scripts/file.js
  9. 2
      couchpotato/static/scripts/page/settings.js
  10. 184
      couchpotato/static/scripts/page/wanted.js
  11. 1
      couchpotato/static/style/main.css
  12. 19
      couchpotato/static/style/page/settings.css
  13. 134
      couchpotato/static/style/page/wanted.css
  14. 12
      couchpotato/static/style/plugin/movie_add.css
  15. 1
      couchpotato/templates/_desktop.html

2
couchpotato/core/settings/__init__.py

@ -75,7 +75,7 @@ class Settings():
values[section] = {}
for option in self.p.items(section):
(option_name, option_value) = option
values[section][option_name] = option_value
values[section][option_name] = self.cleanValue(option_value)
return values
def save(self):

BIN
couchpotato/static/images/edit.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1015 B

BIN
couchpotato/static/images/gear.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
couchpotato/static/images/imdb.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

BIN
couchpotato/static/images/rating.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

BIN
couchpotato/static/images/reload.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 B

34
couchpotato/static/scripts/block/search.js

@ -127,16 +127,9 @@ Block.Search = new Class({
Object.each(json.movies, function(movie){
// if(!movie.imdb || (movie.imdb && !self.results.getElement('#'+movie.imdb))){
var m = new Block.Search.Item(movie);
$(m).inject(self.results)
self.movies[movie.imdb || 'r-'+Math.floor(Math.random()*10000)] = m
// }
// else {
// self.movies[movie.imdb].alternativeTitle({
// 'title': movie.title
// })
// }
var m = new Block.Search.Item(movie);
$(m).inject(self.results)
self.movies[movie.imdb || 'r-'+Math.floor(Math.random()*10000)] = m
});
@ -213,7 +206,6 @@ Block.Search.Item = new Class({
})
}
info.titles.each(function(title){
self.alternativeTitle({
'title': title
@ -235,10 +227,17 @@ Block.Search.Item = new Class({
if(!self.width)
self.width = self.data_container.getCoordinates().width
self.data_container.tween('margin-left', 0, self.width);
self.data_container.tween('left', 0, self.width);
self.el.addEvent('outerClick', self.closeOptions.bind(self))
},
self.el.addEvents('outerClick', self.closeOptions.bind(self))
closeOptions: function(){
var self = this;
self.data_container.tween('left', self.width, 0);
self.el.removeEvents('outerClick')
},
add: function(e){
@ -303,7 +302,7 @@ Block.Search.Item = new Class({
}).inject(self.title_select)
})
Array.each(Quality.profiles, function(profile){
Object.each(Quality.profiles, function(profile){
new Element('option', {
'value': profile.id ? profile.id : profile.data.id,
'text': profile.label ? profile.label : profile.data.label
@ -315,13 +314,6 @@ Block.Search.Item = new Class({
},
closeOptions: function(){
var self = this;
self.data_container.tween('margin-left', self.width, 0);
self.el.removeEvents('outerClick', self.closeOptions.bind(self))
},
toElement: function(){
return this.el
}

4
couchpotato/static/scripts/file.js

@ -13,7 +13,9 @@ var File = new Class({
createImage: function(){
var self = this;
self.el = new Element('div.type_image').adopt(
self.el = new Element('div', {
'class': 'type_image ' + self.type.identifier
}).adopt(
new Element('img', {
'src': Api.createUrl('file.cache') + self.data.path.substring(1) + '/'
})

2
couchpotato/static/scripts/page/settings.js

@ -436,7 +436,7 @@ Option.Enabler = new Class({
checkState: function(){
var self = this;
self.parentFieldset[ self.getValue() ? 'addClass' : 'removeClass']('enabled');
self.parentFieldset[ self.getValue() ? 'removeClass' : 'addClass']('disabled');
},
afterInject: function(){

184
couchpotato/static/scripts/page/wanted.js

@ -23,6 +23,7 @@ Page.Wanted = new Class({
Object.each(self.movies, function(info){
var m = new Movie(self, {}, info);
$(m).inject(self.movie_container);
m.fireEvent('injected');
});
self.movie_container.addEvents({
@ -69,29 +70,37 @@ var Movie = new Class({
self.profile = Quality.getProfile(data.profile_id);
self.parent(self, options);
self.addEvent('injected', self.afterInject.bind(self))
},
create: function(){
var self = this;
self.el = new Element('div.movie').adopt(
self.data_container = new Element('div').adopt(
self.data_container = new Element('div.data', {
'tween': {
duration: 400,
transition: 'quint:in:out'
}
}).adopt(
self.thumbnail = File.Select.single('poster', self.data.library.files),
self.title = new Element('div.title', {
'text': self.getTitle()
}),
self.description = new Element('div.description', {
'text': self.data.library.plot
}),
self.rating = new Element('div.rating', {
'text': self.data.library.rating || 10
}),
self.year = new Element('div.year', {
'text': self.data.library.year || 'Unknown'
}),
self.quality = new Element('div.quality', {
'text': self.profile.get('label')
}),
self.info_container = new Element('div.info').adopt(
self.title = new Element('div.title', {
'text': self.getTitle()
}),
self.year = new Element('div.year', {
'text': self.data.library.year || 'Unknown'
}),
self.rating = new Element('div.rating', {
'text': self.data.library.rating
}),
self.description = new Element('div.description', {
'text': self.data.library.plot
}),
self.quality = new Element('div.quality', {
'text': self.profile.get('label')
})
),
self.actions = new Element('div.actions').adopt(
self.action_imdb = new Movie.Action.IMDB(self),
self.action_edit = new Movie.Action.Edit(self),
@ -101,6 +110,16 @@ var Movie = new Class({
)
);
if(!self.data.library.rating)
self.rating.hide();
},
afterInject: function(){
var self = this;
var height = self.getHeight();
self.el.setStyle('height', height);
},
getTitle: function(){
@ -120,6 +139,37 @@ var Movie = new Class({
return 'Unknown movie'
},
slide: function(direction){
var self = this;
if(direction == 'in'){
self.el.addEvent('outerClick', self.slide.bind(self, 'out'))
self.data_container.tween('left', 0, self.getWidth());
}
else {
self.el.removeEvents('outerClick')
self.data_container.tween('left', self.getWidth(), 0);
}
},
getHeight: function(){
var self = this;
if(!self.height)
self.height = self.data_container.getCoordinates().height;
return self.height;
},
getWidth: function(){
var self = this;
if(!self.width)
self.width = self.data_container.getCoordinates().width;
return self.width;
},
get: function(attr){
return this.data[attr] || this.data.library[attr]
}
@ -164,7 +214,6 @@ Movie.Action.Edit = new Class({
var self = this;
self.el = new Element('a.edit', {
'text': 'edit',
'title': 'Refresh the movie info and do a forced search',
'events': {
'click': self.editMovie.bind(self)
@ -177,21 +226,27 @@ Movie.Action.Edit = new Class({
var self = this;
(e).stop();
self.optionContainer = new Element('div.options').adopt(
$(self.movie.thumbnail).clone(),
self.title_select = new Element('select', {
'name': 'title'
}),
self.profile_select = new Element('select', {
'name': 'profile'
}),
new Element('a.button.edit', {
'text': 'Save',
'events': {
'click': self.save.bind(self)
}
})
).inject(self.movie, 'top');
if(!self.options_container){
self.options_container = new Element('div.options').adopt(
$(self.movie.thumbnail).clone(),
new Element('div.form').adopt(
self.title_select = new Element('select', {
'name': 'title'
}),
self.profile_select = new Element('select', {
'name': 'profile'
}),
new Element('a.button.edit', {
'text': 'Save',
'events': {
'click': self.save.bind(self)
}
})
)
).inject(self.movie, 'top');
}
self.movie.slide('in');
},
save: function(){
@ -220,7 +275,6 @@ Movie.Action.IMDB = new Class({
self.id = self.movie.get('identifier');
self.el = new Element('a.imdb', {
'text': 'imdb',
'title': 'Go to the IMDB page of ' + self.movie.getTitle(),
'events': {
'click': self.gotoIMDB.bind(self)
@ -247,7 +301,6 @@ Movie.Action.Refresh = new Class({
var self = this;
self.el = new Element('a.refresh', {
'text': 'refresh',
'title': 'Refresh the movie info and do a forced search',
'events': {
'click': self.doSearch.bind(self)
@ -279,7 +332,6 @@ Movie.Action.Delete = new Class({
var self = this;
self.el = new Element('a.delete', {
'text': 'delete',
'title': 'Remove the movie from your wanted list',
'events': {
'click': self.showConfirm.bind(self)
@ -292,27 +344,39 @@ Movie.Action.Delete = new Class({
var self = this;
(e).stop();
self.mask = $(self.movie).mask({
'destroyOnHide': true
});
$(self.mask).adopt(
new Element('a.button.cancel', {
'text': 'Cancel',
'events': {
'click': self.mask.hide.bind(self.mask)
}
}),
new Element('span', {
'text': 'or'
}),
new Element('a.button.delete', {
'text': 'Delete movie',
'events': {
'click': self.del.bind(self)
if(!self.delete_container){
self.delete_container = new Element('div.delete_container', {
'styles': {
'line-height': self.movie.getHeight()
}
})
);
}).adopt(
new Element('a.cancel', {
'text': 'Cancel',
'events': {
'click': self.hideConfirm.bind(self)
}
}),
new Element('span.or', {
'text': 'or'
}),
new Element('a.button.delete', {
'text': 'Delete movie',
'events': {
'click': self.del.bind(self)
}
})
).inject(self.movie, 'top')
}
self.movie.slide('in');
},
hideConfirm: function(e){
var self = this;
(e).stop();
self.movie.slide('out');
},
del: function(e){
@ -323,7 +387,7 @@ Movie.Action.Delete = new Class({
self.chain(
function(){
$(self.mask).empty().addClass('loading');
$(movie).mask().addClass('loading')
self.callChain();
},
function(){
@ -332,8 +396,12 @@ Movie.Action.Delete = new Class({
'id': self.movie.get('id')
},
'onComplete': function(){
p(movie, $(self.movie))
movie.slide('in');
movie.set('tween', {
'onComplete': function(){
movie.destroy();
}
})
movie.tween('height', 0)
}
})
}

1
couchpotato/static/style/main.css

@ -42,6 +42,7 @@ a {
text-decoration:none;
color: #6ea1d7;
outline: 0;
cursor: pointer;
}
a:hover { color: #4d66c4; }

19
couchpotato/static/style/page/settings.css

@ -55,7 +55,7 @@
.page.settings fieldset h2 {
font-weight: normal;
font-size: 25px;
padding: 0 9px 10px;
padding: 0 9px 10px 30px;
margin: 0;
border-bottom: 1px solid #f3f3f3;
}
@ -64,10 +64,23 @@
font-size: 12px;
margin-left: 10px;
}
.page.settings fieldset.disabled .ctrlHolder {
display: none;
}
.page.settings fieldset .ctrlHolder:first-child {
display: block;
padding: 0;
width: auto;
margin: 0;
position: relative;
margin-bottom: -25px;
border: none;
}
.page.settings .ctrlHolder {
line-height: 25px;
padding: 10px;
padding: 10px 10px 10px 30px;
border-bottom: 1px solid #f3f3f3;
font-size: 14px;
}
@ -97,7 +110,7 @@
padding: 6px 0 0;
}
.page.settings input[type=text] {
.page.settings input[type=text], .page.settings input[type=password] {
border: 1px solid #aaa;
padding: 3px;
margin: 0;

134
couchpotato/static/style/page/wanted.css

@ -0,0 +1,134 @@
/* @override http://localhost:5000/static/style/page/wanted.css */
.page.wanted .movies {
padding: 20px 0;
}
.page.wanted .movie {
overflow: hidden;
position: relative;
background: #999;
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
margin: 10px 0;
border: 1px solid #fff;
border-color: #eee #fff #fff #eee;
background: #ddd;
}
.page.wanted .movie:hover {
border-color: #ddd #fff #fff #ddd;
}
.page.wanted .movie:hover .data {
background: #f5f5f5;
}
.page.wanted .data {
padding: 2%;
position: absolute;
width: 96.1%;
top: 0;
left: 0;
background: #f9f9f9;
}
.page.wanted .data:after {
content: "";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.page.wanted .data .poster, .page.wanted .options .poster {
overflow: hidden;
float: left;
max-width: 10%;
margin: 0 2% 0 0;
border-radius:3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-moz-box-shadow: 0 0 10px rgba(0,0,0,0.35);
-webkit-box-shadow: 0 0 10px rgba(0,0,0,0.35);
line-height: 0;
}
.page.wanted .info {
float: right;
width: 88%;
}
.page.wanted .info .title {
font-size: 30px;
font-weight: bold;
margin-bottom: 10px;
float: left;
width: 80%;
}
.page.wanted .info .year {
font-size: 30px;
margin-bottom: 10px;
float: right;
color: #bbb;
width: 10%;
text-align: right;
}
.page.wanted .info .rating {
font-size: 30px;
margin-bottom: 10px;
color: #444;
float: left;
width: 5%;
padding: 0 0 0 3%;
background: url('../../images/rating.png') no-repeat left center;
}
.page.wanted .info .description {
clear: both;
width: 95%;
}
.page.wanted .data .actions {
position: absolute;
right: 15px;
bottom: 15px;
line-height: 0;
}
.page.wanted .data:hover .action { opacity: 0.6; }
.page.wanted .data:hover .action:hover { opacity: 1; }
.page.wanted .data .action {
background: no-repeat center;
display: inline-block;
width: 20px;
height: 20px;
padding: 3px;
opacity: 0;
}
.page.wanted .data .action.refresh { background-image: url('../../images/reload.png'); }
.page.wanted .data .action.delete { background-image: url('../../images/delete.png'); }
.page.wanted .data .action.edit { background-image: url('../../images/edit.png'); }
.page.wanted .data .action.imdb { background-image: url('../../images/imdb.png'); }
.page.wanted .delete_container {
clear: both;
text-align: center;
font-size: 20px;
position: relative;
}
.page.wanted .delete_container .cancel {
}
.page.wanted .delete_container .or {
padding: 10px;
}
.page.wanted .delete_container .delete {
background-color: #ff321c;
font-weight: normal;
}
.page.wanted .delete_container .delete:hover {
color: #fff;
background-color: #d32917;
}
.page.wanted .options {
padding: 2%;
}

12
couchpotato/static/style/plugin/movie_add.css

@ -1,4 +1,4 @@
/* @override http://localhost:5000/static/style/movie_add.css */
/* @override http://localhost:5000/static/style/plugin/movie_add.css */
.search_form {
display: inline-block;
@ -71,7 +71,7 @@
}
.search_form .results .movie .options > div {
margin: 0 10px;
padding: 0 15px;
}
.search_form .results .movie .options .thumbnail {
@ -90,6 +90,14 @@
vertical-align: middle;
display: inline-block;
}
.search_form .results .movie .options .message {
height: 100%;
line-height: 140px;
font-size: 20px;
text-align: center;
color: #fff;
}
.search_form .results .movie .data {
padding: 0 15px;

1
couchpotato/templates/_desktop.html

@ -6,6 +6,7 @@
<link rel="stylesheet" href="{{ url_for('.static', filename='style/uniform.css') }}" type="text/css">
<link rel="stylesheet" href="{{ url_for('.static', filename='style/page/settings.css') }}" type="text/css">
<link rel="stylesheet" href="{{ url_for('.static', filename='style/page/wanted.css') }}" type="text/css">
<link rel="stylesheet" href="{{ url_for('.static', filename='style/plugin/movie_add.css') }}" type="text/css">
<link rel="stylesheet" href="{{ url_for('.static', filename='style/plugin/quality.css') }}" type="text/css">

Loading…
Cancel
Save