Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
WEBUI JS: Fix rendering of weekdays in autorec
  • Loading branch information
perexg committed Sep 10, 2014
1 parent 8323fa7 commit 6ba1d6f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
30 changes: 29 additions & 1 deletion src/webui/static/app/dvr.js
Expand Up @@ -354,8 +354,36 @@ tvheadend.autorec_editor = function(panel, index) {
del: true,
list: 'enabled,title,channel,tag,content_type,minduration,' +
'maxduration,weekdays,start,pri,config_name,creator,comment',
columns: {
weekdays: {
renderer: function(st) {
return function(v) {
var t = [];
var d = v.push ? v : [v];
if (d.length == 7) {
v = "All days";
} else if (d.length == 0) {
v = "No days";
} else {
for (var i = 0; i < d.length; i++) {
var r = st.find('key', d[i]);
if (r !== -1) {
var nv = st.getAt(r).get('val');
if (nv)
t.push(nv);
} else {
t.push(d[i]);
}
}
v = t.join(',');
}
return v;
}
}
}
},
sort: {
field: 'name',
field: 'title',
direction: 'ASC'
},
help: function() {
Expand Down
8 changes: 3 additions & 5 deletions src/webui/static/app/idnode.js
Expand Up @@ -134,7 +134,6 @@ tvheadend.IdNodeField = function(conf)
*/

this.onrefresh = function(callback) {
this.rcallback = callback;
var st = this.store;
if (st && st instanceof Ext.data.JsonStore)
st.on('load', callback);
Expand Down Expand Up @@ -175,7 +174,7 @@ tvheadend.IdNodeField = function(conf)
dataIndex: this.id,
header: this.text,
editor: this.editor({create: false}),
renderer: cfg.renderer ? cfg.renderer() : this.renderer(),
renderer: cfg.renderer ? cfg.renderer(this.store) : this.renderer(this.store),
editable: !this.rdonly,
hidden: this.hidden,
filter: {
Expand All @@ -194,7 +193,7 @@ tvheadend.IdNodeField = function(conf)
return props;
};

this.renderer = function()
this.renderer = function(st)
{
if (this.password)
return function(v) {
Expand Down Expand Up @@ -224,10 +223,9 @@ tvheadend.IdNodeField = function(conf)
}
}

if (!this.store)
if (!st)
return null;

var st = this.store;
return function(v) {
if (st && st instanceof Ext.data.JsonStore) {
var t = [];
Expand Down

0 comments on commit 6ba1d6f

Please sign in to comment.