get rid of filters in config, only use itemKeys filter: true

This commit is contained in:
j 2013-09-30 18:34:44 +00:00
parent a04711e94c
commit 7a529bfd12
7 changed files with 19 additions and 53 deletions

View file

@ -75,23 +75,6 @@
included in find annotations.
*/
"clipLayers": ["subtitles"],
// fixme: either this, or filter: true in itemKeys, but not both
"filters": [
{"id": "director", "title": "Director", "type": "string"},
{"id": "country", "title": "Country", "type": "string"},
{"id": "year", "title": "Year", "type": "integer"},
{"id": "language", "title": "Language", "type": "string"},
{"id": "color", "title": "Color", "type": "string"},
{"id": "sound", "title": "Sound", "type": "string"},
{"id": "writer", "title": "Writer", "type": "string"},
{"id": "producer", "title": "Producer", "type": "string"},
{"id": "cinematographer", "title": "Cinematographer", "type": "string"},
{"id": "editor", "title": "Editor", "type": "string"},
{"id": "actor", "title": "Actor", "type": "string"},
{"id": "productionCompany", "title": "Studio", "type": "string"},
{"id": "genre", "title": "Genre", "type": "string"},
{"id": "keyword", "title": "Keyword", "type": "string"}
],
"flags": true,
"help": [
{"id": "help", "title": "Help"},
@ -304,6 +287,7 @@
"type": ["string"],
"autocomplete": true,
"columnWidth": 180,
"filter": true,
"find": true,
"sort": true
},

View file

@ -77,25 +77,6 @@
included in find annotations.
*/
"clipLayers": ["subtitles", "keywords", "notes"],
// fixme: either this, or filter: true in itemKeys, but not both
"filters": [
{"id": "director", "title": "Director", "type": "string"},
{"id": "year", "title": "Year", "type": "integer"},
{"id": "language", "title": "Language", "type": "string"},
{"id": "color", "title": "Color", "type": "string"},
{"id": "sound", "title": "Sound", "type": "string"},
{"id": "productionCompany", "title": "Studio", "type": "string"},
{"id": "producer", "title": "Producer", "type": "string"},
{"id": "codirector", "title": "Co-Director", "type": "string"},
{"id": "writer", "title": "Writer", "type": "string"},
{"id": "cinematographer", "title": "Cinematographer", "type": "string"},
{"id": "editor", "title": "Editor", "type": "string"},
{"id": "composer", "title": "Composer", "type": "string"},
{"id": "lyricist", "title": "Lyricist", "type": "string"},
{"id": "actor", "title": "Actor", "type": "string"},
{"id": "genre", "title": "Genre", "type": "string"},
{"id": "keyword", "title": "Keyword", "type": "string"}
],
"flags": false,
"help": [
{"id": "help", "title": "Help"},
@ -177,7 +158,6 @@
"type": ["string"],
"autocomplete": true,
"columnWidth": 120,
"filter": true,
"find": true,
"sort": true
},

View file

@ -183,6 +183,7 @@
"title": "People",
"type": ["string"],
"autocomplete": true,
"filter": true,
"find": true
},
{
@ -272,18 +273,21 @@
"id": "places",
"title": "Places",
"type": "layer",
"filter": true,
"find": true
},
{
"id": "events",
"title": "Events",
"type": "layer",
"filter": true,
"find": true
},
{
"id": "keywords",
"title": "Keywords",
"type": "layer",
"filter": true,
"find": true
},
{

View file

@ -73,15 +73,6 @@
included in find annotations. // FIXME: the last bit is not implemented.
*/
"clipLayers": ["publicnotes", "keywords", "subtitles"],
// fixme: either this, or filter: true in itemKeys, but not both
"filters": [
{"id": "director", "title": "Director", "type": "string"},
{"id": "country", "title": "Country", "type": "string"},
{"id": "year", "title": "Year", "type": "integer"},
{"id": "language", "title": "Languages", "type": "string"},
{"id": "featuring", "title": "Featuring", "type": "string"},
{"id": "keywords", "title": "Keywords", "type": "string"}
],
"flags": false,
"help": [
{"id": "help", "title": "Help"},
@ -157,6 +148,7 @@
"autocomplete": true,
"columnRequired": true,
"columnWidth": 180,
"filter": true,
"sort": true,
"sortType": "person"
},
@ -225,6 +217,7 @@
"id": "keywords",
"title": "Keywords",
"type": "layer",
"filter": true,
"find": true
},
{

View file

@ -42,9 +42,6 @@ def parseCondition(condition, user, owner=None):
exclude = False
facet_keys = models.Item.facet_keys + ['title']
for f in settings.CONFIG['filters']:
if f['id'] not in facet_keys:
facet_keys.append(f['id'])
key_type = settings.CONFIG['keys'].get(k, {'type':'string'}).get('type')
if isinstance(key_type, list):
key_type = key_type[0]

View file

@ -895,10 +895,9 @@ class Item(models.Model):
Facet.objects.get_or_create(item=self, key=key, value=value, sortvalue=sortvalue)
def update_layer_facets(self):
filters = [f['id'] for f in settings.CONFIG['filters']]
for layer in settings.CONFIG['layers']:
if layer['id'] in filters:
self.update_layer_facet(layer['id'])
for k in settings.CONFIG['itemKeys']:
if k.get('filter') and k['type'] == 'layer':
self.update_layer_facet(k['id'])
def update_facets(self):
for key in self.facet_keys + ['title']:

View file

@ -287,6 +287,15 @@ appPanel
operator: pandora.getSortOperator(key.id)
});
}),
filters: data.site.itemKeys.filter(function(key) {
return key.filter;
}).map(function(key) {
return {
id: key.id,
title: key.title,
type: Ox.isArray(key.type) ? key.type[0] : key.type
};
}),
findKeys: data.site.itemKeys.filter(function(key) {
return key.find;
}),