Skip to content

Commit

Permalink
Merge pull request #10697 from mrclay/10696_tables
Browse files Browse the repository at this point in the history
fix(views): in table lists, rows now have IDs
  • Loading branch information
jdalsem committed Jan 19, 2017
2 parents ac157ba + e42fa63 commit 273ab5e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions views/default/page/components/list.php
Expand Up @@ -69,8 +69,10 @@
if ($subtype) {
$li_attrs['class'][] = "elgg-item-$type-$subtype";
}
} else if (is_callable(array($item, 'getType'))) {
$li_attrs['id'] = "item-{$item->getType()}-{$item->id}";
} elseif (is_callable(array($item, 'getType'))) {
$type = $item->getType();

$li_attrs['id'] = "item-$type-{$item->id}";
}

$list_items .= elgg_format_element('li', $li_attrs, $item_view);
Expand Down
4 changes: 3 additions & 1 deletion views/default/page/components/table.php
Expand Up @@ -91,16 +91,18 @@
$type = $item->type;
$subtype = $item->getSubtype();

$row_attrs['id'] = "elgg-$type-$guid";
$row_attrs['class'][] = "elgg-item-$type";
$row_attrs['data-elgg-guid'] = $guid;
$row_attrs['data-elgg-type-subtype'] = "$type:$subtype";
if ($subtype) {
$row_attrs['class'][] = "elgg-item-$type-$subtype";
}

} else if (is_callable(array($item, 'getType'))) {
} elseif (is_callable(array($item, 'getType'))) {
$type = $item->getType();

$row_attrs['id'] = "elgg-$type-{$item->id}";
$row_attrs['data-elgg-id'] = $item->id;
$row_attrs['data-elgg-type'] = $type;
}
Expand Down

0 comments on commit 273ab5e

Please sign in to comment.