Fix company name encoding in UI

Change-Id: I0fda3f207b172303afc4426f954b85ebad4bfdae
This commit is contained in:
Ilya Shakhat 2014-10-10 13:41:58 +04:00
parent f296a7cafa
commit 592c5429e5
3 changed files with 6 additions and 5 deletions

View File

@ -89,7 +89,8 @@ class CachedMemoryStorage(MemoryStorage):
if have_updates:
self.company_name_mapping = dict(
(c.lower(), c) for c in self.company_index.keys())
(c.lower().replace('&', ''), c)
for c in self.company_index.keys())
return have_updates

View File

@ -288,7 +288,7 @@ function makeURI(uri, options) {
$.extend(ops, options);
}
var str = $.map(ops,function (val, index) {
return index + "=" + encodeURI(val).toLowerCase();
return index + "=" + encodeURI(val.replace("&", "")).toLowerCase();
}).join("&");
return (str == "") ? uri : uri + "?" + str;
@ -329,7 +329,7 @@ function initSingleSelector(name, api_url, select2_extra_options, change_handler
success: function (data) {
var initial_value = getUrlVars()[name];
if (initial_value) {
initial_value = encodeURI(initial_value).toLocaleLowerCase();
initial_value = (initial_value).toLocaleLowerCase();
} else if (data["default"]) {
initial_value = data["default"];
}

View File

@ -272,7 +272,7 @@ def get_contribution_json(records, **kwargs):
@decorators.record_filter(ignore=['company'])
def get_companies_json(record_ids, **kwargs):
memory_storage = vault.get_memory_storage()
companies = set(memory_storage.get_original_company_name(company)
companies = set(company
for company in memory_storage.get_index_keys_by_record_ids(
'company_name', record_ids))
@ -280,7 +280,7 @@ def get_companies_json(record_ids, **kwargs):
companies.add(memory_storage.get_original_company_name(
kwargs['_params']['company'][0]))
return [{'id': utils.safe_encode(c.lower()), 'text': c}
return [{'id': c.lower().replace('&', ''), 'text': c}
for c in sorted(companies)]