Skip to content

Commit

Permalink
Commit code styling errors and add an aria label for the outermost 'a…
Browse files Browse the repository at this point in the history
…dd' button.
  • Loading branch information
Rene Pasing committed Sep 16, 2018
1 parent cefdf8b commit 2bb31c0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
7 changes: 5 additions & 2 deletions layouts/joomla/form/field/subform/repeatable-table.php
Expand Up @@ -86,8 +86,11 @@ class="subform-repeatable"
<th style="width:8%;">
<?php if (!empty($buttons['add'])) : ?>
<div class="btn-group">
<a class="btn btn-mini button btn-success group-add-<?php echo $unique_subform_id; ?>">
<span class="icon-plus"></span>
<a
class="btn btn-mini button btn-success group-add-<?php echo $unique_subform_id; ?>"
aria-label="<?php echo JText::_('JGLOBAL_FIELD_ADD'); ?>"
>
<span class="icon-plus" aria-hidden="true"></span>
</a>
</div>
<?php endif; ?>
Expand Down
18 changes: 9 additions & 9 deletions media/system/js/subform-repeatable-uncompressed.js
Expand Up @@ -29,7 +29,7 @@
this.$containerRows = this.options.rowsContainer ? this.$container.find(this.options.rowsContainer) : this.$container;

// last row number, help to avoid the name duplications
this.lastRowNum = this.$containerRows.find(this.options.repeatableElement).length;
this.lastRowNum = this.$containerRows.find(this.options.repeatableElement).length;

// To avoid scope issues,
var self = this;
Expand Down Expand Up @@ -145,13 +145,13 @@
// fix names and id`s for fields in $row
$.subformRepeatable.prototype.fixUniqueAttributes = function(
$row, // the jQuery object to do fixes in
count, // existing count of rows
group, // current group name, e.g. 'optionsX'
basename // group base name, without count, e.g. 'options'
_count, // existing count of rows
_group, // current group name, e.g. 'optionsX'
_basename // group base name, without count, e.g. 'options'
) {
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),
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),
countnew = Math.max(this.lastRowNum, count),
groupnew = basename + countnew;

Expand Down Expand Up @@ -217,10 +217,10 @@
*/
var nestedTemplates = $row.find(this.options.rowTemplateSelector);
// If we found it, iterate over the found ones (might be more than one!)
for (var i = 0; i < nestedTemplates.length; i++) {
for (var j = 0; j < nestedTemplates.length; j++) {
// Get the nested templates content (as DocumentFragment) and cast it
// to a jQuery object
var nestedTemplate = $($(nestedTemplates[i]).prop('content'));
var nestedTemplate = $($(nestedTemplates[j]).prop('content'));
// Fix the attributes for this nested template.
this.fixUniqueAttributes(nestedTemplate, count, group, basename);
}
Expand Down

0 comments on commit 2bb31c0

Please sign in to comment.