From f3af1b70a03c3ce4d8eeacb7463e57800f0a5091 Mon Sep 17 00:00:00 2001 From: rolux Date: Mon, 22 Dec 2014 10:43:23 +0000 Subject: [PATCH] remove site.flags, add 'flag' item key property; update 0xDB config; update filter.js --- pandora/config.0xdb.jsonc | 6 ++---- pandora/config.pandora.jsonc | 8 +++----- static/js/filter.js | 9 ++++++--- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/pandora/config.0xdb.jsonc b/pandora/config.0xdb.jsonc index 701091c8..251b28d5 100644 --- a/pandora/config.0xdb.jsonc +++ b/pandora/config.0xdb.jsonc @@ -86,10 +86,6 @@ included in find annotations. */ "clipLayers": ["subtitles"], - /* - "flags" sets if in filters, countries and languages have a flag icon. - */ - "flags": true, /* "help" specifies the sections of the help dialog. There isn't much of a point in making changes to this. @@ -177,6 +173,7 @@ "columnWidth": 120, "filter": true, "find": true, + "flag": "country", "sort": true }, { @@ -198,6 +195,7 @@ "columnWidth": 120, "filter": true, "find": true, + "flag": "language", "sort": true }, { diff --git a/pandora/config.pandora.jsonc b/pandora/config.pandora.jsonc index 5af09d37..acc6d05e 100644 --- a/pandora/config.pandora.jsonc +++ b/pandora/config.pandora.jsonc @@ -126,11 +126,6 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution. } ], /* - If "flags" is set to true, then filters for countries and languages will - appear with a flag icon. - */ - "flags": false, - /* "help" specifies the sections of the help dialog. */ "help": [ @@ -176,6 +171,8 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution. this key can be added in list view. "filter": If true, one can filter results by this key "find": If true, this key will appear as an option in the find element + "flag": Can be "country" or "language". If set (and filter is true), a + flag icon corresponding to the field's value will be displayed. "format": {type: string, args: [value, value, ...]}, used for special formatting. This will invoke Ox.formatType(args). For details, see https://oxjs.org/#doc/Ox.formatArea etc. @@ -263,6 +260,7 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution. "columnWidth": 180, "filter": true, "find": true, + "flag": "country", "sort": true }, { diff --git a/static/js/filter.js b/static/js/filter.js index 8de3d36f..e1459fa4 100644 --- a/static/js/filter.js +++ b/static/js/filter.js @@ -15,12 +15,14 @@ pandora.ui.filter = function(id) { align: 'left', id: 'name', format: function(value) { - return pandora.site.flags && ['country', 'language'].indexOf(id) > -1 + return filter.flag ? $('
') .append( $('') .attr({src: Ox[ - id == 'country' ? 'getFlagByGeoname' : 'getFlagByLanguage' + filter.flag == 'country' + ? 'getFlagByGeoname' + : 'getFlagByLanguage' ](value, 16)}) .css({ float: 'left', @@ -35,7 +37,8 @@ pandora.ui.filter = function(id) { .addClass('flagname') .css({ float: 'left', - width: pandora.user.ui.filterSizes[i] - 68 - Ox.UI.SCROLLBAR_SIZE, + width: pandora.user.ui.filterSizes[i] + - 68 - Ox.UI.SCROLLBAR_SIZE, textOverflow: 'ellipsis', overflowX: 'hidden' })