Skip to content

Add clickability to all data rows when a default action is obvious (CO-1949) #28

Merged
merged 4 commits into from
Oct 26, 2021
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
3 changes: 2 additions & 1 deletion app/templates/ApiUsers/columns.inc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ if(!empty($vv_cur_mg)) {

$indexColumns = [
'username' => [
'type' => 'link'
'type' => 'link',
'cssClass' => 'row-link'
]
];

Expand Down
3 changes: 2 additions & 1 deletion app/templates/AttributeGroups/columns.inc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

$indexColumns = [
'name' => [
'type' => 'link'
'type' => 'link',
'cssClass' => 'row-link'
]
];
3 changes: 2 additions & 1 deletion app/templates/AttributeMappings/columns.inc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
$indexColumns = [
'query' => [
'type' => 'link',
'sortable' => true
'sortable' => true,
'cssClass' => 'row-link'
],
'value' => [
'type' => 'echo',
Expand Down
3 changes: 2 additions & 1 deletion app/templates/AttributeMaps/columns.inc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@

$indexColumns = [
'name' => [
'type' => 'link'
'type' => 'link',
'cssClass' => 'row-link'
]
];

Expand Down
3 changes: 2 additions & 1 deletion app/templates/Attributes/columns.inc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@

$indexColumns = [
'name' => [
'type' => 'link'
'type' => 'link',
'cssClass' => 'row-link'
],
'attribute_group_id' => [
'type' => 'fk'
Expand Down
3 changes: 2 additions & 1 deletion app/templates/Matchgrids/columns.inc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@

$indexColumns = [
'table_name' => [
'type' => 'link'
'type' => 'link',
'cssClass' => 'row-link'
],
'status' => [
'type' => 'enum',
Expand Down
5 changes: 2 additions & 3 deletions app/templates/Matchgrids/pending.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,12 @@
</tr>
<?php foreach($vv_pending as $p): ?>
<tr class="linked-row spin">
<td>
<td class="row-link">
<?= $this->Html->link(
$p['sorid'],
['action' => 'reconcile',
$vv_matchgrid_id,
'?' => [ 'rowid' => $p['id'] ] ],
['class' => 'row-link']
'?' => [ 'rowid' => $p['id'] ] ]
); ?>
</td>
<td>
Expand Down
3 changes: 2 additions & 1 deletion app/templates/Permissions/columns.inc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@

$indexColumns = [
'username' => [
'type' => 'link'
'type' => 'link',
'cssClass' => 'row-link'
],
'matchgrid_id' => [ 'type' => 'fk' ],
'permission' => [
Expand Down
3 changes: 2 additions & 1 deletion app/templates/RuleAttributes/columns.inc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ $indexColumns = [
'type' => 'link',
'model' => 'attribute',
'field' => 'name',
'sortable' => 'Attributes.name'
'sortable' => 'Attributes.name',
'cssClass' => 'row-link'
],
'crosscheck_attribute_id' => [
'type' => 'fk',
Expand Down
3 changes: 2 additions & 1 deletion app/templates/Rules/columns.inc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@

$indexColumns = [
'name' => [
'type' => 'link'
'type' => 'link',
'cssClass' => 'row-link'
],
'confidence_mode' => [
'type' => 'enum',
Expand Down
4 changes: 2 additions & 2 deletions app/templates/Standard/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function _column_key($modelsName, $c, $tz=null) {
<table id="<?= $vv_tablename . '-table'; ?>">
<tr>
<?php foreach($indexColumns as $col => $cfg): ?>
<th><?php
<th<?= !empty($cfg['cssClass']) ? ' class="' . $cfg['cssClass'] . '"' : ''; ?>><?php
$label = !empty($cfg['label']) ? $cfg['label'] : _column_key($modelsName, $col, $vv_tz);

if(isset($cfg['sortable']) && $cfg['sortable']) {
Expand Down Expand Up @@ -171,7 +171,7 @@ function _column_key($modelsName, $c, $tz=null) {
?>
<tr>
<?php foreach($indexColumns as $col => $cfg): ?>
<td>
<td<?= !empty($cfg['cssClass']) ? ' class="' . $cfg['cssClass'] . '"' : ''; ?>>
<?php
switch($cfg['type']) {
case 'boolean':
Expand Down
3 changes: 2 additions & 1 deletion app/templates/SystemsOfRecord/columns.inc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@

$indexColumns = [
'label' => [
'type' => 'link'
'type' => 'link',
'cssClass' => 'row-link'
],
'resolution_mode' => [
'type' => 'enum',
Expand Down
23 changes: 18 additions & 5 deletions app/templates/element/javascript.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,24 @@

// Enable Bootstrap Popovers. Unless needed elsewhere, constrain this to #content
$('#content [data-toggle="popover"]').popover();
// Generic row click handling
$('.linked-row').click(function (e) {
location.href = $(this).find('a.row-link').attr('href');

// Generic row click handling for div-based rows
$('div.linked-row').click(function (e) {
location.href = $(this).find('a.row-link').attr('href');
});

// Generic row click handling for table rows
$('td.row-link').each(function (e) {
url = $(this).find('a').attr('href');
if(url != undefined && url != '') {
$(this).closest('tr').addClass('linked-row').attr('data-target',url).click(function (e) {
location.href = $(this).attr('data-target');
}).find('a').on('click',function(e){
// don't propagate on other links to avoid redirecting dialog boxes
e.stopPropagation();
});
}
});

// Add loading animation when a form is submitted, when any item with a "spin" class is clicked,
// or on any button or anchor tag lacking the .nospin class.
Expand All @@ -203,4 +216,4 @@

</script>

<?= $this->Flash->render() ?>
<?= $this->Flash->render() ?>
2 changes: 1 addition & 1 deletion app/webroot/css/co-base.css
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ td.indented {
}
.linked-row:hover,
.linked-row:hover td {
background-color: var(--cmg-color-lightgray-002) !important;
background-color: var(--cmg-color-lightgray-004) !important;
}
.menuitembutton {
width: 250px;
Expand Down