diff --git a/administrator/templates/hathor/css/template.css b/administrator/templates/hathor/css/template.css index 8bd16f128eeb4..76fe0d1bab4f6 100644 --- a/administrator/templates/hathor/css/template.css +++ b/administrator/templates/hathor/css/template.css @@ -3947,3 +3947,6 @@ div.toggle-editor { .popover-content { min-height: 33px; } +template { + display: none; +} diff --git a/administrator/templates/isis/css/template.css b/administrator/templates/isis/css/template.css index d385ac7ca0409..9ff0750e6df05 100644 --- a/administrator/templates/isis/css/template.css +++ b/administrator/templates/isis/css/template.css @@ -9135,3 +9135,6 @@ input:focus, column-count: auto; } } +template { + display: none; +} diff --git a/layouts/joomla/form/field/subform/repeatable-table.php b/layouts/joomla/form/field/subform/repeatable-table.php index 66f73fd072c0f..707e30047af64 100644 --- a/layouts/joomla/form/field/subform/repeatable-table.php +++ b/layouts/joomla/form/field/subform/repeatable-table.php @@ -118,21 +118,23 @@ class="btn btn-mini button btn-success group-add group-add- - - - - + + + diff --git a/layouts/joomla/form/field/subform/repeatable.php b/layouts/joomla/form/field/subform/repeatable.php index 4569b94af90f4..10b138f1d484f 100644 --- a/layouts/joomla/form/field/subform/repeatable.php +++ b/layouts/joomla/form/field/subform/repeatable.php @@ -69,20 +69,21 @@ ); endforeach; ?> - - - + + + diff --git a/media/system/js/subform-repeatable-uncompressed.js b/media/system/js/subform-repeatable-uncompressed.js index 123df96b80371..a0fcb67e5e2a5 100644 --- a/media/system/js/subform-repeatable-uncompressed.js +++ b/media/system/js/subform-repeatable-uncompressed.js @@ -68,12 +68,6 @@ // Find the template element and get its HTML content, this is our template. var $tmplElement = this.$container.find(this.options.rowTemplateSelector).last(); - // Move the template out of the form scope, for IE compatibility. - // But only a root template (!!!) - if (!$tmplElement.parents(this.options.rowTemplateSelector).length) { - $(document.body).append($tmplElement); - } - this.template = $.trim($tmplElement.html()) || ''; this.$tmplElement = $tmplElement; } @@ -105,7 +99,7 @@ } // make new from template - var row = $.parseHTML(this.template); + var row = $.parseHTML(htmlspecialchar.decode(this.template)); //add to container if(after){ @@ -313,5 +307,26 @@ $(container || document).find('div.subform-repeatable').subformRepeatable(); } }); - + window.htmlspecialchar = { + /** + * @param {String} str htmlSet entities + **/ + decode : function(str) { + var map = { + '&': '&', + '&': "&", + '<': '<', + '>': '>', + '"': '"', + ''': "'", + '’': "’", + '‘': "‘", + '–': "–", + '—': "—", + '…': "…", + '”': '”' + }; + return str.replace(/\&[\w\d\#]{2,5}\;/g, function(m) { return map[m]; }); + } + }; })(jQuery); diff --git a/media/system/js/subform-repeatable.js b/media/system/js/subform-repeatable.js index 1972b8834f1c9..c2896966a2064 100644 --- a/media/system/js/subform-repeatable.js +++ b/media/system/js/subform-repeatable.js @@ -1 +1 @@ -(function($){"use strict";$.subformRepeatable=function(container,options){this.$container=$(container);if(this.$container.data("subformRepeatable")){return self}this.$container.data("subformRepeatable",self);this.options=$.extend({},$.subformRepeatable.defaults,options);this.template="";this.prepareTemplate();this.$containerRows=this.options.rowsContainer?this.$container.find(this.options.rowsContainer):this.$container;var self=this;this.$container.on("click",this.options.btAdd,function(e){e.preventDefault();var after=$(this).parents(self.options.repeatableElement);if(!after.length){after=null}self.addRow(after)});this.$container.on("click",this.options.btRemove,function(e){e.preventDefault();var $row=$(this).parents(self.options.repeatableElement);self.removeRow($row)});if(this.options.btMove){this.$containerRows.sortable({items:this.options.repeatableElement,handle:this.options.btMove,tolerance:"pointer"})}this.$container.trigger("subform-ready")};$.subformRepeatable.prototype.prepareTemplate=function(){if(this.options.rowTemplateSelector){var $tmplElement=this.$container.find(this.options.rowTemplateSelector).last();if(!$tmplElement.parents(this.options.rowTemplateSelector).length){$(document.body).append($tmplElement)}this.template=$.trim($tmplElement.html())||"";this.$tmplElement=$tmplElement}else{var row=this.$container.find(this.options.repeatableElement).get(0),$row=$(row).clone();try{this.clearScripts($row)}catch(e){if(window.console){console.log(e)}}this.template=$row.prop("outerHTML")}};$.subformRepeatable.prototype.addRow=function(after){var count=this.$containerRows.find(this.options.repeatableElement).length;if(count>=this.options.maximum){return null}var row=$.parseHTML(this.template);if(after){$(after).after(row)}else{this.$containerRows.append(row)}var $row=$(row);$row.attr("data-new","true");this.fixUniqueAttributes($row,count);try{this.fixScripts($row)}catch(e){if(window.console){console.log(e)}}this.$container.trigger("subform-row-add",$row);return $row};$.subformRepeatable.prototype.removeRow=function($row){var count=this.$containerRows.find(this.options.repeatableElement).length;if(count<=this.options.minimum){return}this.$container.trigger("subform-row-remove",$row);$row.remove()};$.subformRepeatable.prototype.fixUniqueAttributes=function($row,_count,_group,_basename){var group=typeof _group==="undefined"?$row.attr("data-group"):_group,basename=typeof _basename==="undefined"?$row.attr("data-base-name"):_basename,count=typeof _count==="undefined"?0:_count,groupnew=basename+count;$row.attr("data-group",groupnew);var haveName=$row.find("[name]"),ids={};for(var i=0,l=haveName.length;i=this.options.maximum)return null;var r=t.parseHTML(htmlspecialchar.decode(this.template));e?t(e).after(r):this.$containerRows.append(r);var a=t(r);a.attr("data-new","true"),this.fixUniqueAttributes(a,o);try{this.fixScripts(a)}catch(t){window.console&&console.log(t)}return this.$container.trigger("subform-row-add",a),a},t.subformRepeatable.prototype.removeRow=function(t){this.$containerRows.find(this.options.repeatableElement).length<=this.options.minimum||(this.$container.trigger("subform-row-remove",t),t.remove())},t.subformRepeatable.prototype.fixUniqueAttributes=function(e,o,r,a){var i=void 0===r?e.attr("data-group"):r,n=void 0===a?e.attr("data-base-name"):a,s=void 0===o?0:o,l=n+s;e.attr("data-group",l);for(var p=e.find("[name]"),c={},f=0,h=p.length;f",""":'"',"'":"'","’":"’","‘":"‘","–":"–","—":"—","…":"…","”":"”"};return t.replace(/\&[\w\d\#]{2,5}\;/g,function(t){return e[t]})}}}(jQuery);