Switch single and double quotes in attributes values
authorThierry Florac <thierry.florac@onf.fr>
Wed, 11 Mar 2015 12:19:41 +0100
changeset 34 8b517db52592
parent 33 82fbc0843490
child 35 7e635fcf2555
Switch single and double quotes in attributes values
src/pyams_skin/table.py
--- a/src/pyams_skin/table.py	Wed Mar 11 12:19:06 2015 +0100
+++ b/src/pyams_skin/table.py	Wed Mar 11 12:19:41 2015 +0100
@@ -101,7 +101,7 @@
             for key, value in attrs.items():
                 checked_value = self.check_data_attribute(value, source)
                 if checked_value is not None:
-                    result += "{0}='{1}'".format(key, checked_value)
+                    result += ' {0}="{1}"'.format(key, checked_value)
             return result
         else:
             return ''
@@ -169,11 +169,12 @@
                 return ''
         translate = self.request.localizer.translate
         return '''<a class="hint" title="{title}" href="{url}"
-                     data-ams-target="{target}" {modal} data-ams-hint-gravity="e">
+                     data-ams-stop-propagation="true"
+                     {target} {modal} data-ams-hint-gravity="e">
             <i class="{icon_class}"></i>
         </a>'''.format(title=translate(self.icon_hint),
                        url=self.get_url(item),
-                       target=self.target,
+                       target='data-ams-target="{0}"'.format(self.target) if self.target else '',
                        modal='data-toggle="modal"' if self.modal_target else '',
                        icon_class=self.icon_class)