From 65788a3e513e2ad271a49a5e56811e4ffd090fb4 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Wed, 2 Oct 2013 17:15:40 +0200 Subject: [PATCH] change the way domids are built for checkboxes in a hazelnut - new method Plugin.flat_id --- manifold/static/js/plugin.js | 13 +++++++++++++ plugins/hazelnut/static/js/hazelnut.js | 9 ++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/manifold/static/js/plugin.js b/manifold/static/js/plugin.js index f3929617..3745f649 100644 --- a/manifold/static/js/plugin.js +++ b/manifold/static/js/plugin.js @@ -192,6 +192,19 @@ var Plugin = Class.extend({ return key_field + manifold.separator + unfold.escape_id(value).replace(/\\/g, ''); }, + // we do not need to carry around all the nonsense about backslashing dots in hrns + // likewise, DOM ids do not like to have dots in them + // because "#foo.bar" matches an elem named foo with class bar - not an id that is foo.bar + // so this method gives you a valid DOMID but that cannot be 'reversed' back to retrieve an hrn or the like + // e.g. + // input=input="ple.aluiple.host147-82-static\\.93-94-b\\.business\\.telecomitalia\\.it" + // > "ple.aluiple.host147-82-static\.93-94-b\.business\.telecomitalia\.it" + // flat_id(input) + // "ple-aluiple-host147-82-static-93-94-b-business-telecomitalia-it" + flat_id : function (id_in) { + return id_in.replace(/\\\./g,"-").replace(/\\/g,"-").replace(/\./g,"-"); + }, + id_from_record: function(method, record) { var keys = manifold.metadata.get_key(method); if (!keys) diff --git a/plugins/hazelnut/static/js/hazelnut.js b/plugins/hazelnut/static/js/hazelnut.js index 81cf1e26..c572d6a9 100644 --- a/plugins/hazelnut/static/js/hazelnut.js +++ b/plugins/hazelnut/static/js/hazelnut.js @@ -154,7 +154,7 @@ // Prefix id with plugin_uuid result += "