Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions layouts/joomla/form/field/subform/repeatable-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,25 @@ class="btn btn-mini button btn-success group-add group-add-<?php echo $unique_su
</table>

<?php if ($multiple) : ?>
<template class="subform-repeatable-template-section"><?php echo trim(
$this->sublayout(
$sublayout,
array(
'form' => $tmpl,
'basegroup' => $fieldname,
'group' => $fieldname . 'X',
'buttons' => $buttons,
'unique_subform_id' => $unique_subform_id,
)
)
); ?></template>
<template class="subform-repeatable-template-section" style="display: none;"><?php
// Use str_replace to escape HTML in a simple way, it need for IE compatibility, and should be removed later
echo str_replace(
array('<', '>'),
array('SUBFORMLT', 'SUBFORMGT'),
trim(
$this->sublayout(
$sublayout,
array(
'form' => $tmpl,
'basegroup' => $fieldname,
'group' => $fieldname . 'X',
'buttons' => $buttons,
'unique_subform_id' => $unique_subform_id,
)
)
)
);
?></template>
<?php endif; ?>
</div>
</div>
Expand Down
31 changes: 19 additions & 12 deletions layouts/joomla/form/field/subform/repeatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,25 @@
endforeach;
?>
<?php if ($multiple) : ?>
<template class="subform-repeatable-template-section"><?php echo trim(
$this->sublayout(
$sublayout,
array(
'form' => $tmpl,
'basegroup' => $fieldname,
'group' => $fieldname . 'X',
'buttons' => $buttons,
'unique_subform_id' => $unique_subform_id,
)
)
); ?></template>
<template class="subform-repeatable-template-section" style="display: none;"><?php
// Use str_replace to escape HTML in a simple way, it need for IE compatibility, and should be removed later
echo str_replace(
array('<', '>'),
array('SUBFORMLT', 'SUBFORMGT'),
trim(
$this->sublayout(
$sublayout,
array(
'form' => $tmpl,
'basegroup' => $fieldname,
'group' => $fieldname . 'X',
'buttons' => $buttons,
'unique_subform_id' => $unique_subform_id,
)
)
)
);
?></template>
<?php endif; ?>
</div>
</div>
Expand Down
14 changes: 7 additions & 7 deletions media/system/js/subform-repeatable-uncompressed.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@
// 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;

// This is IE fix for <template>
$tmplElement.css('display', 'none'); // Make sure it not visible
var map = {'SUBFORMLT': '<', 'SUBFORMGT': '>'};
this.template = this.template.replace(/(SUBFORMLT)|(SUBFORMGT)/g, function(match){
return map[match];
});
}
// create from existing rows
else {
Expand Down
2 changes: 1 addition & 1 deletion media/system/js/subform-repeatable.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.