From fa2b231a03fe83a9a291a755d60dfbb0c09aab87 Mon Sep 17 00:00:00 2001
From: Xiaowu Zhang <xiaowu.zhang@tiolive.com>
Date: Mon, 10 Nov 2014 17:20:51 +0000
Subject: [PATCH] Load js file only once in a page

Really useful when same field declared in one page
---
 .../erp5_xhtml_style/template_erp5_xhtml_style.xml           | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/template_erp5_xhtml_style.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/template_erp5_xhtml_style.xml
index 8df08e540b..e0e7cb6e96 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/template_erp5_xhtml_style.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/template_erp5_xhtml_style.xml
@@ -80,7 +80,7 @@ IDEAS:\n
                          tal:attributes="type python:\'text/css\'">\n
                   </style>\n
                 </tal:block>\n
-                <tal:block tal:define="dummy python: js_list.extend(field.get_javascript_list(REQUEST=request))" />\n
+                <tal:block tal:define="dummy python: js_list.extend(x for x in field.get_javascript_list(REQUEST=request) if not (x in js_list))" />\n
               </tal:block>\n
             </tal:block>\n
           </tal:block>\n
@@ -149,8 +149,7 @@ IDEAS:\n
       </html>\n
     </tal:block>\n
   </tal:block>\n
-</tal:block>\n
-
+</tal:block>
 
 ]]></unicode> </value>
         </item>
-- 
2.30.9